mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-03 21:32:08 +00:00
Added option CHECKSUM_GEN_ICMP
This commit is contained in:
parent
e9255d3714
commit
69d61eda01
@ -6,6 +6,9 @@ HISTORY
|
|||||||
|
|
||||||
++ New features:
|
++ New features:
|
||||||
|
|
||||||
|
2012-01-16: Simon Goldschmidt
|
||||||
|
* opt.h, icmp.c: Added option CHECKSUM_GEN_ICMP
|
||||||
|
|
||||||
2011-12-17: Simon Goldschmidt
|
2011-12-17: Simon Goldschmidt
|
||||||
* ip.h: implemented API functions to access so_options of IP pcbs (UDP, TCP, RAW)
|
* ip.h: implemented API functions to access so_options of IP pcbs (UDP, TCP, RAW)
|
||||||
(fixes bug #35061)
|
(fixes bug #35061)
|
||||||
|
@ -189,12 +189,16 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
ip_addr_copy(iphdr->src, *ip_current_dest_addr());
|
ip_addr_copy(iphdr->src, *ip_current_dest_addr());
|
||||||
ip_addr_copy(iphdr->dest, *ip_current_src_addr());
|
ip_addr_copy(iphdr->dest, *ip_current_src_addr());
|
||||||
ICMPH_TYPE_SET(iecho, ICMP_ER);
|
ICMPH_TYPE_SET(iecho, ICMP_ER);
|
||||||
|
#if CHECKSUM_GEN_ICMP
|
||||||
/* adjust the checksum */
|
/* adjust the checksum */
|
||||||
if (iecho->chksum >= PP_HTONS(0xffffU - (ICMP_ECHO << 8))) {
|
if (iecho->chksum >= PP_HTONS(0xffffU - (ICMP_ECHO << 8))) {
|
||||||
iecho->chksum += PP_HTONS(ICMP_ECHO << 8) + 1;
|
iecho->chksum += PP_HTONS(ICMP_ECHO << 8) + 1;
|
||||||
} else {
|
} else {
|
||||||
iecho->chksum += PP_HTONS(ICMP_ECHO << 8);
|
iecho->chksum += PP_HTONS(ICMP_ECHO << 8);
|
||||||
}
|
}
|
||||||
|
#else /* CHECKSUM_GEN_ICMP */
|
||||||
|
iecho->chksum = 0;
|
||||||
|
#endif /* CHECKSUM_GEN_ICMP */
|
||||||
|
|
||||||
/* Set the correct TTL and recalculate the header checksum. */
|
/* Set the correct TTL and recalculate the header checksum. */
|
||||||
IPH_TTL_SET(iphdr, ICMP_TTL);
|
IPH_TTL_SET(iphdr, ICMP_TTL);
|
||||||
|
@ -1855,6 +1855,13 @@
|
|||||||
#define CHECKSUM_GEN_TCP 1
|
#define CHECKSUM_GEN_TCP 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CHECKSUM_GEN_ICMP==1: Generate checksums in software for outgoing ICMP packets.
|
||||||
|
*/
|
||||||
|
#ifndef CHECKSUM_GEN_ICMP
|
||||||
|
#define CHECKSUM_GEN_ICMP 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
|
* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user