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

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

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

revision 1.6 by jani, Tue Feb 25 16:00:21 2003 UTC revision 1.6.2.1 by likewise, Wed May 14 14:38:28 2003 UTC
# Line 58  icmp_input(struct pbuf *p, struct netif Line 58  icmp_input(struct pbuf *p, struct netif
58    
59    type = ((char *)p->payload)[0];    type = ((char *)p->payload)[0];
60    
61    switch(type) {    switch (type) {
62    case ICMP6_ECHO:    case ICMP6_ECHO:
63      DEBUGF(ICMP_DEBUG, ("icmp_input: ping\n"));      DEBUGF(ICMP_DEBUG, ("icmp_input: ping\n"));
64    
65      if(p->tot_len < sizeof(struct icmp_echo_hdr)) {      if (p->tot_len < sizeof(struct icmp_echo_hdr)) {
66        DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n"));        DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n"));
67    
68        pbuf_free(p);        pbuf_free(p);
# Line 74  icmp_input(struct pbuf *p, struct netif Line 74  icmp_input(struct pbuf *p, struct netif
74      }      }
75      iecho = p->payload;      iecho = p->payload;
76      iphdr = (struct ip_hdr *)((char *)p->payload - IP_HLEN);      iphdr = (struct ip_hdr *)((char *)p->payload - IP_HLEN);
77      if(inet_chksum_pbuf(p) != 0) {      if (inet_chksum_pbuf(p) != 0) {
78        DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%x)\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len)));        DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%x)\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len)));
79    
80  #ifdef ICMP_STATS  #ifdef ICMP_STATS
# Line 88  icmp_input(struct pbuf *p, struct netif Line 88  icmp_input(struct pbuf *p, struct netif
88      ip_addr_set(&(iphdr->dest), &tmpaddr);      ip_addr_set(&(iphdr->dest), &tmpaddr);
89      iecho->type = ICMP6_ER;      iecho->type = ICMP6_ER;
90      /* adjust the checksum */      /* adjust the checksum */
91      if(iecho->chksum >= htons(0xffff - (ICMP6_ECHO << 8))) {      if (iecho->chksum >= htons(0xffff - (ICMP6_ECHO << 8))) {
92        iecho->chksum += htons(ICMP6_ECHO << 8) + 1;        iecho->chksum += htons(ICMP6_ECHO << 8) + 1;
93      } else {      } else {
94        iecho->chksum += htons(ICMP6_ECHO << 8);        iecho->chksum += htons(ICMP6_ECHO << 8);
# Line 99  icmp_input(struct pbuf *p, struct netif Line 99  icmp_input(struct pbuf *p, struct netif
99  #endif /* ICMP_STATS */  #endif /* ICMP_STATS */
100    
101      /*    DEBUGF("icmp: p->len %d p->tot_len %d\n", p->len, p->tot_len);*/      /*    DEBUGF("icmp: p->len %d p->tot_len %d\n", p->len, p->tot_len);*/
102      ip_output_if(p, &(iphdr->src), IP_HDRINCL,      ip_output_if (p, &(iphdr->src), IP_HDRINCL,
103                   iphdr->hoplim, IP_PROTO_ICMP, inp);                   iphdr->hoplim, IP_PROTO_ICMP, inp);
104      break;      break;
105    default:    default:

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.6.2.1

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