Fixed bug #21107 (didn't reset IP TTL in ICMP echo replies)

This commit is contained in:
goldsimon 2007-09-19 06:12:34 +00:00
parent 2bdd916b06
commit 0bf32b957d
2 changed files with 11 additions and 0 deletions

View File

@ -405,6 +405,9 @@ HISTORY
++ Bug fixes:
2007-09-19 Simon Goldschmidt
* icmp.c: Fixed bug #21107 (didn't reset IP TTL in ICMP echo replies)
2007-09-06 Frédéric Bernon
* several-files: replace some #include "arch/cc.h" by "lwip/arch.h", or simply remove
it as long as "lwip/opt.h" is included before (this one include "lwip/debug.h" which

View File

@ -163,6 +163,14 @@ icmp_input(struct pbuf *p, struct netif *inp)
} else {
iecho->chksum += htons(ICMP_ECHO << 8);
}
/* Set the correct TTL and recalculate the header checksum. */
IPH_TTL_SET(iphdr, ICMP_TTL);
IPH_CHKSUM_SET(iphdr, 0);
#if CHECKSUM_GEN_IP
IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN));
#endif /* CHECKSUM_GEN_IP */
ICMP_STATS_INC(icmp.xmit);
/* increase number of messages attempted to send */
snmp_inc_icmpoutmsgs();