summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgoldsimon <goldsimon@gmx.de>2012-01-16 09:40:15 +0100
committergoldsimon <goldsimon@gmx.de>2012-01-16 09:40:15 +0100
commit69d61eda016109700a680182913985302d1fb276 (patch)
tree37cada6b37b18dce88f0eddbbf99f6960bccee89
parente9255d3714dbb719a50c99e33805b4b708899c20 (diff)
downloadlwip-69d61eda016109700a680182913985302d1fb276.tar.gz
Added option CHECKSUM_GEN_ICMP
-rw-r--r--CHANGELOG3
-rw-r--r--src/core/ipv4/icmp.c4
-rw-r--r--src/include/lwip/opt.h7
3 files changed, 14 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 31fa1d5..818819e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,9 @@ HISTORY
++ New features:
+ 2012-01-16: Simon Goldschmidt
+ * opt.h, icmp.c: Added option CHECKSUM_GEN_ICMP
+
2011-12-17: Simon Goldschmidt
* ip.h: implemented API functions to access so_options of IP pcbs (UDP, TCP, RAW)
(fixes bug #35061)
diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c
index ca59acf..af47153 100644
--- a/src/core/ipv4/icmp.c
+++ b/src/core/ipv4/icmp.c
@@ -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->dest, *ip_current_src_addr());
ICMPH_TYPE_SET(iecho, ICMP_ER);
+#if CHECKSUM_GEN_ICMP
/* adjust the checksum */
if (iecho->chksum >= PP_HTONS(0xffffU - (ICMP_ECHO << 8))) {
iecho->chksum += PP_HTONS(ICMP_ECHO << 8) + 1;
} else {
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. */
IPH_TTL_SET(iphdr, ICMP_TTL);
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
index 4f52811..9d8c86d 100644
--- a/src/include/lwip/opt.h
+++ b/src/include/lwip/opt.h
@@ -1854,6 +1854,13 @@
#ifndef CHECKSUM_GEN_TCP
#define CHECKSUM_GEN_TCP 1
#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.