/[lwip]/lwip/src/core/ipv4/icmp.c
ViewVC logotype

Diff of /lwip/src/core/ipv4/icmp.c

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

revision 1.11 by likewise, Sun Mar 16 22:39:15 2003 UTC revision 1.12 by likewise, Thu May 1 08:29:54 2003 UTC
# Line 48  void Line 48  void
48  icmp_input(struct pbuf *p, struct netif *inp)  icmp_input(struct pbuf *p, struct netif *inp)
49  {  {
50    unsigned char type;    unsigned char type;
51      unsigned char code;
52    struct icmp_echo_hdr *iecho;    struct icmp_echo_hdr *iecho;
53    struct ip_hdr *iphdr;    struct ip_hdr *iphdr;
54    struct ip_addr tmpaddr;    struct ip_addr tmpaddr;
# Line 61  icmp_input(struct pbuf *p, struct netif Line 62  icmp_input(struct pbuf *p, struct netif
62        
63    iphdr = p->payload;    iphdr = p->payload;
64    hlen = IPH_HL(iphdr) * 4;    hlen = IPH_HL(iphdr) * 4;
65    pbuf_header(p, -((s16_t)hlen));    if (pbuf_header(p, -((s16_t)hlen)) || (p->tot_len < sizeof(u16_t)*2)) {
66        DEBUGF(ICMP_DEBUG, ("icmp_input: short ICMP (%u bytes) received\n", p->tot_len));
67        pbuf_free(p);
68    #ifdef ICMP_STATS
69        ++lwip_stats.icmp.lenerr;
70    #endif /* ICMP_STATS */
71        snmp_inc_icmpinerrors();
72        return;      
73      }
74    
75    type = *((u8_t *)p->payload);    type = *((u8_t *)p->payload);
76      code = *(((u8_t *)p->payload)+1);
77    switch(type) {    switch(type) {
78    case ICMP_ECHO:    case ICMP_ECHO:
79      if(ip_addr_isbroadcast(&iphdr->dest, &inp->netmask) ||      if(ip_addr_isbroadcast(&iphdr->dest, &inp->netmask) ||
# Line 121  icmp_input(struct pbuf *p, struct netif Line 130  icmp_input(struct pbuf *p, struct netif
130                   IPH_TTL(iphdr), IP_PROTO_ICMP, inp);                   IPH_TTL(iphdr), IP_PROTO_ICMP, inp);
131      break;      break;
132    default:    default:
133      DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type not supported.\n"));    DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %d code %d not supported.\n", (int)type, (int)code));
134  #ifdef ICMP_STATS  #ifdef ICMP_STATS
135      ++lwip_stats.icmp.proterr;      ++lwip_stats.icmp.proterr;
136      ++lwip_stats.icmp.drop;      ++lwip_stats.icmp.drop;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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