@ -51,9 +51,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
struct ip_hdr * iphdr ;
struct ip_addr tmpaddr ;
# if ICMP_STATS
+ + lwip_stats . icmp . recv ;
# endif /* ICMP_STATS */
ICMP_STATS_INC ( icmp . recv ) ;
/* TODO: check length before accessing payload! */
@ -67,20 +65,14 @@ icmp_input(struct pbuf *p, struct netif *inp)
LWIP_DEBUGF ( ICMP_DEBUG , ( " icmp_input: bad ICMP echo received \n " ) ) ;
pbuf_free ( p ) ;
# if ICMP_STATS
+ + lwip_stats . icmp . lenerr ;
# endif /* ICMP_STATS */
ICMP_STATS_INC ( icmp . lenerr ) ;
return ;
}
iecho = p - > payload ;
iphdr = ( struct ip_hdr * ) ( ( u8_t * ) p - > payload - IP_HLEN ) ;
if ( inet_chksum_pbuf ( p ) ! = 0 ) {
LWIP_DEBUGF ( ICMP_DEBUG , ( " icmp_input: checksum failed for received ICMP echo (% " X16_F " ) \n " , inet_chksum_pseudo ( p , & ( iphdr - > src ) , & ( iphdr - > dest ) , IP_PROTO_ICMP , p - > tot_len ) ) ) ;
# if ICMP_STATS
+ + lwip_stats . icmp . chkerr ;
# endif /* ICMP_STATS */
ICMP_STATS_INC ( icmp . chkerr ) ;
/* return;*/
}
LWIP_DEBUGF ( ICMP_DEBUG , ( " icmp: p->len % " S16_F " p->tot_len % " S16_F " \n " , p - > len , p - > tot_len ) ) ;
@ -95,9 +87,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
iecho - > chksum + = htons ( ICMP6_ECHO < < 8 ) ;
}
LWIP_DEBUGF ( ICMP_DEBUG , ( " icmp_input: checksum failed for received ICMP echo (% " X16_F " ) \n " , inet_chksum_pseudo ( p , & ( iphdr - > src ) , & ( iphdr - > dest ) , IP_PROTO_ICMP , p - > tot_len ) ) ) ;
# if ICMP_STATS
+ + lwip_stats . icmp . xmit ;
# endif /* ICMP_STATS */
ICMP_STATS_INC ( icmp . xmit ) ;
/* LWIP_DEBUGF("icmp: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len);*/
ip_output_if ( p , & ( iphdr - > src ) , IP_HDRINCL ,
@ -105,10 +95,8 @@ icmp_input(struct pbuf *p, struct netif *inp)
break ;
default :
LWIP_DEBUGF ( ICMP_DEBUG , ( " icmp_input: ICMP type % " S16_F " not supported. \n " , ( s16_t ) type ) ) ;
# if ICMP_STATS
+ + lwip_stats . icmp . proterr ;
+ + lwip_stats . icmp . drop ;
# endif /* ICMP_STATS */
ICMP_STATS_INC ( icmp . proterr ) ;
ICMP_STATS_INC ( icmp . drop ) ;
}
pbuf_free ( p ) ;
@ -143,9 +131,7 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
/* calculate checksum */
idur - > chksum = 0 ;
idur - > chksum = inet_chksum ( idur , q - > len ) ;
# if ICMP_STATS
+ + lwip_stats . icmp . xmit ;
# endif /* ICMP_STATS */
ICMP_STATS_INC ( icmp . xmit ) ;
ip_output ( q , NULL ,
( struct ip_addr * ) & ( iphdr - > src ) , ICMP_TTL , IP_PROTO_ICMP ) ;
@ -184,9 +170,7 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
/* calculate checksum */
tehdr - > chksum = 0 ;
tehdr - > chksum = inet_chksum ( tehdr , q - > len ) ;
# if ICMP_STATS
+ + lwip_stats . icmp . xmit ;
# endif /* ICMP_STATS */
ICMP_STATS_INC ( icmp . xmit ) ;
ip_output ( q , NULL ,
( struct ip_addr * ) & ( iphdr - > src ) , ICMP_TTL , IP_PROTO_ICMP ) ;
pbuf_free ( q ) ;