42 |
|
|
43 |
#include "lwip/stats.h" |
#include "lwip/stats.h" |
44 |
|
|
45 |
|
#if LWIP_SNMP > 0 |
46 |
|
# include "snmp.h" |
47 |
|
#endif |
48 |
/*-----------------------------------------------------------------------------------*/ |
/*-----------------------------------------------------------------------------------*/ |
49 |
void |
void |
50 |
icmp_input(struct pbuf *p, struct netif *inp) |
icmp_input(struct pbuf *p, struct netif *inp) |
58 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
59 |
++stats.icmp.recv; |
++stats.icmp.recv; |
60 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
61 |
|
#if LWIP_SNMP > 0 |
62 |
|
snmp_inc_icmpinmsgs(); |
63 |
|
#endif |
64 |
|
|
65 |
|
|
66 |
iphdr = p->payload; |
iphdr = p->payload; |
88 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
89 |
++stats.icmp.lenerr; |
++stats.icmp.lenerr; |
90 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
91 |
|
#if LWIP_SNMP > 0 |
92 |
|
snmp_inc_icmpinerrors(); |
93 |
|
#endif |
94 |
|
|
95 |
return; |
return; |
96 |
} |
} |
101 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
102 |
++stats.icmp.chkerr; |
++stats.icmp.chkerr; |
103 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
104 |
|
#if LWIP_SNMP > 0 |
105 |
|
snmp_inc_icmpinerrors(); |
106 |
|
#endif |
107 |
return; |
return; |
108 |
} |
} |
109 |
tmpaddr.addr = iphdr->src.addr; |
tmpaddr.addr = iphdr->src.addr; |
119 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
120 |
++stats.icmp.xmit; |
++stats.icmp.xmit; |
121 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
122 |
|
#if LWIP_SNMP > 0 |
123 |
|
/* increase number of messages attempted to send */ |
124 |
|
snmp_inc_icmpoutmsgs(); |
125 |
|
/* increase number of echo replies attempted to send */ |
126 |
|
snmp_inc_icmpoutechoreps(); |
127 |
|
#endif |
128 |
|
|
129 |
pbuf_header(p, hlen); |
pbuf_header(p, hlen); |
130 |
ip_output_if(p, &(iphdr->src), IP_HDRINCL, |
ip_output_if(p, &(iphdr->src), IP_HDRINCL, |
164 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
165 |
++stats.icmp.xmit; |
++stats.icmp.xmit; |
166 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
167 |
|
#if LWIP_SNMP > 0 |
168 |
|
/* increase number of messages attempted to send */ |
169 |
|
snmp_inc_icmpoutmsgs(); |
170 |
|
/* increase number of destination unreachable messages attempted to send */ |
171 |
|
snmp_inc_icmpoutdestunreachs(); |
172 |
|
#endif |
173 |
|
|
174 |
ip_output(q, NULL, &(iphdr->src), |
ip_output(q, NULL, &(iphdr->src), |
175 |
ICMP_TTL, IP_PROTO_ICMP); |
ICMP_TTL, IP_PROTO_ICMP); |
208 |
#ifdef ICMP_STATS |
#ifdef ICMP_STATS |
209 |
++stats.icmp.xmit; |
++stats.icmp.xmit; |
210 |
#endif /* ICMP_STATS */ |
#endif /* ICMP_STATS */ |
211 |
|
#if LWIP_SNMP > 0 |
212 |
|
/* increase number of messages attempted to send */ |
213 |
|
snmp_inc_icmpoutmsgs(); |
214 |
|
/* increase number of destination unreachable messages attempted to send */ |
215 |
|
snmp_inc_icmpouttimeexcds(); |
216 |
|
#endif |
217 |
ip_output(q, NULL, &(iphdr->src), |
ip_output(q, NULL, &(iphdr->src), |
218 |
ICMP_TTL, IP_PROTO_ICMP); |
ICMP_TTL, IP_PROTO_ICMP); |
219 |
pbuf_free(q); |
pbuf_free(q); |