diff --git a/CHANGELOG b/CHANGELOG index c9c0799d..7114fd9f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c index e9dec868..8f03d3a2 100644 --- a/src/core/ipv4/icmp.c +++ b/src/core/ipv4/icmp.c @@ -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();