42 |
|
|
43 |
#include "lwip/stats.h" |
#include "lwip/stats.h" |
44 |
|
|
45 |
#if LWIP_SNMP > 0 |
#include "snmp.h" |
|
# include "snmp.h" |
|
|
#endif |
|
46 |
/*-----------------------------------------------------------------------------------*/ |
/*-----------------------------------------------------------------------------------*/ |
47 |
void |
void |
48 |
icmp_input(struct pbuf *p, struct netif *inp) |
icmp_input(struct pbuf *p, struct netif *inp) |
56 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
57 |
++lwip_stats.icmp.recv; |
++lwip_stats.icmp.recv; |
58 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
|
#if LWIP_SNMP > 0 |
|
59 |
snmp_inc_icmpinmsgs(); |
snmp_inc_icmpinmsgs(); |
|
#endif |
|
60 |
|
|
61 |
|
|
62 |
iphdr = p->payload; |
iphdr = p->payload; |
84 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
85 |
++lwip_stats.icmp.lenerr; |
++lwip_stats.icmp.lenerr; |
86 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
|
#if LWIP_SNMP > 0 |
|
87 |
snmp_inc_icmpinerrors(); |
snmp_inc_icmpinerrors(); |
|
#endif |
|
88 |
|
|
89 |
return; |
return; |
90 |
} |
} |
95 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
96 |
++lwip_stats.icmp.chkerr; |
++lwip_stats.icmp.chkerr; |
97 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
|
#if LWIP_SNMP > 0 |
|
98 |
snmp_inc_icmpinerrors(); |
snmp_inc_icmpinerrors(); |
|
#endif |
|
99 |
return; |
return; |
100 |
} |
} |
101 |
tmpaddr.addr = iphdr->src.addr; |
tmpaddr.addr = iphdr->src.addr; |
111 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
112 |
++lwip_stats.icmp.xmit; |
++lwip_stats.icmp.xmit; |
113 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
|
#if LWIP_SNMP > 0 |
|
114 |
/* increase number of messages attempted to send */ |
/* increase number of messages attempted to send */ |
115 |
snmp_inc_icmpoutmsgs(); |
snmp_inc_icmpoutmsgs(); |
116 |
/* increase number of echo replies attempted to send */ |
/* increase number of echo replies attempted to send */ |
117 |
snmp_inc_icmpoutechoreps(); |
snmp_inc_icmpoutechoreps(); |
|
#endif |
|
118 |
|
|
119 |
pbuf_header(p, hlen); |
pbuf_header(p, hlen); |
120 |
ip_output_if(p, &(iphdr->src), IP_HDRINCL, |
ip_output_if(p, &(iphdr->src), IP_HDRINCL, |
154 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
155 |
++lwip_stats.icmp.xmit; |
++lwip_stats.icmp.xmit; |
156 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
|
#if LWIP_SNMP > 0 |
|
157 |
/* increase number of messages attempted to send */ |
/* increase number of messages attempted to send */ |
158 |
snmp_inc_icmpoutmsgs(); |
snmp_inc_icmpoutmsgs(); |
159 |
/* increase number of destination unreachable messages attempted to send */ |
/* increase number of destination unreachable messages attempted to send */ |
160 |
snmp_inc_icmpoutdestunreachs(); |
snmp_inc_icmpoutdestunreachs(); |
|
#endif |
|
161 |
|
|
162 |
ip_output(q, NULL, &(iphdr->src), |
ip_output(q, NULL, &(iphdr->src), |
163 |
ICMP_TTL, IP_PROTO_ICMP); |
ICMP_TTL, IP_PROTO_ICMP); |
196 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
197 |
++lwip_stats.icmp.xmit; |
++lwip_stats.icmp.xmit; |
198 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
|
#if LWIP_SNMP > 0 |
|
199 |
/* increase number of messages attempted to send */ |
/* increase number of messages attempted to send */ |
200 |
snmp_inc_icmpoutmsgs(); |
snmp_inc_icmpoutmsgs(); |
201 |
/* increase number of destination unreachable messages attempted to send */ |
/* increase number of destination unreachable messages attempted to send */ |
202 |
snmp_inc_icmpouttimeexcds(); |
snmp_inc_icmpouttimeexcds(); |
|
#endif |
|
203 |
ip_output(q, NULL, &(iphdr->src), |
ip_output(q, NULL, &(iphdr->src), |
204 |
ICMP_TTL, IP_PROTO_ICMP); |
ICMP_TTL, IP_PROTO_ICMP); |
205 |
pbuf_free(q); |
pbuf_free(q); |