/[lwip]/lwip/src/core/ipv6/ip6.c
ViewVC logotype

Diff of /lwip/src/core/ipv6/ip6.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by jani, Fri Feb 21 16:43:46 2003 UTC revision 1.5.2.1 by likewise, Wed May 14 14:38:28 2003 UTC
# Line 77  ip_route(struct ip_addr *dest) Line 77  ip_route(struct ip_addr *dest)
77    struct netif *netif;    struct netif *netif;
78        
79    for(netif = netif_list; netif != NULL; netif = netif->next) {    for(netif = netif_list; netif != NULL; netif = netif->next) {
80      if(ip_addr_maskcmp(dest, &(netif->ip_addr), &(netif->netmask))) {      if (ip_addr_maskcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
81        return netif;        return netif;
82      }      }
83    }    }
# Line 99  ip_forward(struct pbuf *p, struct ip_hdr Line 99  ip_forward(struct pbuf *p, struct ip_hdr
99        
100    PERF_START;    PERF_START;
101        
102    if((netif = ip_route((struct ip_addr *)&(iphdr->dest))) == NULL) {    if ((netif = ip_route((struct ip_addr *)&(iphdr->dest))) == NULL) {
103    
104      DEBUGF(IP_DEBUG, ("ip_input: no forwarding route found for "));      DEBUGF(IP_DEBUG, ("ip_input: no forwarding route found for "));
105  #if IP_DEBUG  #if IP_DEBUG
# Line 110  ip_forward(struct pbuf *p, struct ip_hdr Line 110  ip_forward(struct pbuf *p, struct ip_hdr
110      return;      return;
111    }    }
112    /* Decrement TTL and send ICMP if ttl == 0. */    /* Decrement TTL and send ICMP if ttl == 0. */
113    if(--iphdr->hoplim == 0) {    if (--iphdr->hoplim == 0) {
114      /* Don't send ICMP messages in response to ICMP messages */      /* Don't send ICMP messages in response to ICMP messages */
115      if(iphdr->nexthdr != IP_PROTO_ICMP) {      if (iphdr->nexthdr != IP_PROTO_ICMP) {
116        icmp_time_exceeded(p, ICMP_TE_TTL);        icmp_time_exceeded(p, ICMP_TE_TTL);
117      }      }
118      pbuf_free(p);      pbuf_free(p);
# Line 174  ip_input(struct pbuf *p, struct netif *i Line 174  ip_input(struct pbuf *p, struct netif *i
174    iphdr = p->payload;    iphdr = p->payload;
175    
176        
177    if(iphdr->v != 6) {    if (iphdr->v != 6) {
178      DEBUGF(IP_DEBUG, ("IP packet dropped due to bad version number\n"));      DEBUGF(IP_DEBUG, ("IP packet dropped due to bad version number\n"));
179  #if IP_DEBUG  #if IP_DEBUG
180      ip_debug_print(p);      ip_debug_print(p);
# Line 196  ip_input(struct pbuf *p, struct netif *i Line 196  ip_input(struct pbuf *p, struct netif *i
196      ip_addr_debug_print(&(netif->ip_addr));      ip_addr_debug_print(&(netif->ip_addr));
197      DEBUGF(IP_DEBUG, ("\n"));      DEBUGF(IP_DEBUG, ("\n"));
198  #endif /* IP_DEBUG */  #endif /* IP_DEBUG */
199      if(ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) {      if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) {
200        break;        break;
201      }      }
202    }    }
203    
204        
205    if(netif == NULL) {    if (netif == NULL) {
206      /* packet not for us, route or discard */      /* packet not for us, route or discard */
207  #ifdef IP_FORWARD  #ifdef IP_FORWARD
208      ip_forward(p, iphdr);      ip_forward(p, iphdr);
# Line 223  ip_input(struct pbuf *p, struct netif *i Line 223  ip_input(struct pbuf *p, struct netif *i
223    
224    pbuf_header(p, -IP_HLEN);    pbuf_header(p, -IP_HLEN);
225    
226    switch(iphdr->nexthdr) {    switch (iphdr->nexthdr) {
227    case IP_PROTO_UDP:    case IP_PROTO_UDP:
228      udp_input(p);      udp_input(p);
229      break;      break;
# Line 258  ip_input(struct pbuf *p, struct netif *i Line 258  ip_input(struct pbuf *p, struct netif *i
258   */   */
259  /*-----------------------------------------------------------------------------------*/  /*-----------------------------------------------------------------------------------*/
260  err_t  err_t
261  ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,  ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
262               u8_t ttl,               u8_t ttl,
263               u8_t proto, struct netif *netif)               u8_t proto, struct netif *netif)
264  {  {
# Line 267  ip_output_if(struct pbuf *p, struct ip_a Line 267  ip_output_if(struct pbuf *p, struct ip_a
267    PERF_START;    PERF_START;
268    
269    printf("len %u tot_len %u\n", p->len, p->tot_len);    printf("len %u tot_len %u\n", p->len, p->tot_len);
270    if(pbuf_header(p, IP_HLEN)) {    if (pbuf_header(p, IP_HLEN)) {
271      DEBUGF(IP_DEBUG, ("ip_output: not enough room for IP header in pbuf\n"));      DEBUGF(IP_DEBUG, ("ip_output: not enough room for IP header in pbuf\n"));
272  #ifdef IP_STATS  #ifdef IP_STATS
273      ++lwip_stats.ip.err;      ++lwip_stats.ip.err;
# Line 280  ip_output_if(struct pbuf *p, struct ip_a Line 280  ip_output_if(struct pbuf *p, struct ip_a
280    iphdr = p->payload;    iphdr = p->payload;
281        
282    
283    if(dest != IP_HDRINCL) {    if (dest != IP_HDRINCL) {
284      printf("!IP_HDRLINCL\n");      printf("!IP_HDRLINCL\n");
285      iphdr->hoplim = ttl;      iphdr->hoplim = ttl;
286      iphdr->nexthdr = proto;      iphdr->nexthdr = proto;
# Line 289  ip_output_if(struct pbuf *p, struct ip_a Line 289  ip_output_if(struct pbuf *p, struct ip_a
289    
290      iphdr->v = 6;      iphdr->v = 6;
291    
292      if(ip_addr_isany(src)) {      if (ip_addr_isany(src)) {
293        ip_addr_set(&(iphdr->src), &(netif->ip_addr));        ip_addr_set(&(iphdr->src), &(netif->ip_addr));
294      } else {      } else {
295        ip_addr_set(&(iphdr->src), src);        ip_addr_set(&(iphdr->src), src);
# Line 323  ip_output(struct pbuf *p, struct ip_addr Line 323  ip_output(struct pbuf *p, struct ip_addr
323            u8_t ttl, u8_t proto)            u8_t ttl, u8_t proto)
324  {  {
325    struct netif *netif;    struct netif *netif;
326    if((netif = ip_route(dest)) == NULL) {    if ((netif = ip_route(dest)) == NULL) {
327      DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%lx\n", dest->addr));      DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%lx\n", dest->addr));
328  #ifdef IP_STATS  #ifdef IP_STATS
329      ++lwip_stats.ip.rterr;      ++lwip_stats.ip.rterr;
# Line 331  ip_output(struct pbuf *p, struct ip_addr Line 331  ip_output(struct pbuf *p, struct ip_addr
331      return ERR_RTE;      return ERR_RTE;
332    }    }
333    
334    return ip_output_if(p, src, dest, ttl, proto, netif);    return ip_output_if (p, src, dest, ttl, proto, netif);
335  }  }
336  /*-----------------------------------------------------------------------------------*/  /*-----------------------------------------------------------------------------------*/
337  #if IP_DEBUG  #if IP_DEBUG

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.5.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26