pimd: Remove unused pim checksum in favour of quagga's version.
diff --git a/pimd/Makefile.am b/pimd/Makefile.am
index 70c5096..9345460 100644
--- a/pimd/Makefile.am
+++ b/pimd/Makefile.am
@@ -22,7 +22,6 @@
# PIM_DEBUG_BYDEFAULT: Automatically enables all pimd "debug ..." commands
# PIM_ZCLIENT_DEBUG: Support for internal ZEBRA client debugging
# PIM_MOTD_VERSION: Includes pimd version in default MOTD
-# PIM_USE_QUAGGA_INET_CHECKSUM: Prefer Quagga inet checksum
# PIM_CHECK_RECV_IFINDEX_SANITY: Compare socket ifindex with recv ifindex
# PIM_REPORT_RECV_IFINDEX_MISMATCH: Report sock/recv ifindex mismatch
# PIM_ENFORCE_LOOPFREE_MFC: Refuse adding looping MFC entries
@@ -36,7 +35,6 @@
#PIM_DEFS += -DPIM_REPORT_RECV_IFINDEX_MISMATCH
PIM_DEFS += -DPIM_ZCLIENT_DEBUG
PIM_DEFS += -DPIM_MOTD_VERSION
-PIM_DEFS += -DPIM_USE_QUAGGA_INET_CHECKSUM
PIM_DEFS += -DPIM_ENFORCE_LOOPFREE_MFC
#PIM_DEFS += -DPIM_UNEXPECTED_KERNEL_UPCALL
#PIM_DEFS += -DPIM_USE_QUAGGA_GETTIME
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 8b51977..eaf209c 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -3590,7 +3590,7 @@
igmp_msg_len = IGMP_V3_MSG_MIN_SIZE + (num_sources << 4); /* v3 report for one single group record */
/* compute checksum */
- *(uint16_t *)(igmp_msg + IGMP_V3_CHECKSUM_OFFSET) = pim_inet_checksum(igmp_msg, igmp_msg_len);
+ *(uint16_t *)(igmp_msg + IGMP_V3_CHECKSUM_OFFSET) = in_cksum(igmp_msg, igmp_msg_len);
/* "receive" message */
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index 03cf3cd..a54463f 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -299,7 +299,7 @@
/* for computing checksum */
*(uint16_t *) (igmp_msg + IGMP_V3_CHECKSUM_OFFSET) = 0;
- checksum = pim_inet_checksum(igmp_msg, igmp_msg_len);
+ checksum = in_cksum(igmp_msg, igmp_msg_len);
if (checksum != recv_checksum) {
zlog_warn("Recv IGMP query v%d from %s on %s: checksum mismatch: received=%x computed=%x",
query_version, from_str, ifp->name, recv_checksum, checksum);
@@ -470,7 +470,7 @@
/* for computing checksum */
*(uint16_t *) (igmp_msg + IGMP_V3_CHECKSUM_OFFSET) = 0;
- checksum = pim_inet_checksum(igmp_msg, igmp_msg_len);
+ checksum = in_cksum(igmp_msg, igmp_msg_len);
if (checksum != recv_checksum) {
zlog_warn("Recv IGMP report v3 from %s on %s: checksum mismatch: received=%x computed=%x",
from_str, ifp->name, recv_checksum, checksum);
diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c
index 24db40b..b95adb6 100644
--- a/pimd/pim_igmpv3.c
+++ b/pimd/pim_igmpv3.c
@@ -1651,7 +1651,7 @@
query_buf[9] = qqic;
*(uint16_t *)(query_buf + IGMP_V3_NUMSOURCES_OFFSET) = htons(num_sources);
- checksum = pim_inet_checksum(query_buf, msg_size);
+ checksum = in_cksum(query_buf, msg_size);
*(uint16_t *)(query_buf + IGMP_V3_CHECKSUM_OFFSET) = checksum;
if (PIM_DEBUG_IGMP_PACKETS) {
diff --git a/pimd/pim_main.c b/pimd/pim_main.c
index b314df2..768ac08 100644
--- a/pimd/pim_main.c
+++ b/pimd/pim_main.c
@@ -281,10 +281,6 @@
#endif
#endif
-#ifdef PIM_USE_QUAGGA_INET_CHECKSUM
- zlog_notice("PIM_USE_QUAGGA_INET_CHECKSUM: using Quagga's builtin checksum");
-#endif
-
#ifdef PIM_UNEXPECTED_KERNEL_UPCALL
zlog_notice("PIM_UNEXPECTED_KERNEL_UPCALL: report unexpected kernel upcall");
#endif
diff --git a/pimd/pim_msg.c b/pimd/pim_msg.c
index 79ae33a..8ead7ce 100644
--- a/pimd/pim_msg.c
+++ b/pimd/pim_msg.c
@@ -46,7 +46,7 @@
*/
*(uint16_t *) PIM_MSG_HDR_OFFSET_CHECKSUM(pim_msg) = 0;
- checksum = pim_inet_checksum(pim_msg, pim_msg_size);
+ checksum = in_cksum(pim_msg, pim_msg_size);
*(uint16_t *) PIM_MSG_HDR_OFFSET_CHECKSUM(pim_msg) = checksum;
}
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index 4fda26e..fb6c3ac 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -194,7 +194,7 @@
/* for computing checksum */
*(uint16_t *) PIM_MSG_HDR_OFFSET_CHECKSUM(pim_msg) = 0;
- checksum = pim_inet_checksum(pim_msg, pim_msg_len);
+ checksum = in_cksum(pim_msg, pim_msg_len);
if (checksum != pim_checksum) {
zlog_warn("Ignoring PIM pkt from %s with invalid checksum: received=%x calculated=%x",
ifp->name, pim_checksum, checksum);
diff --git a/pimd/pim_util.c b/pimd/pim_util.c
index a7e8234..fdfed2b 100644
--- a/pimd/pim_util.c
+++ b/pimd/pim_util.c
@@ -98,43 +98,6 @@
return value;
}
-#ifndef PIM_USE_QUAGGA_INET_CHECKSUM
-/*
- RFC 3376: 4.1.2. Checksum
-
- The Checksum is the 16-bit one's complement of the one's complement
- sum of the whole IGMP message (the entire IP payload). For
- computing the checksum, the Checksum field is set to zero. When
- receiving packets, the checksum MUST be verified before processing a
- packet. [RFC-1071]
-*/
-uint16_t pim_inet_checksum(const char *buf, int size)
-{
- const uint16_t *ptr;
- uint32_t sum;
- uint16_t checksum;
-
- ptr = (const uint16_t *) buf;
- sum = 0;
- while (size > 1) {
- sum += *ptr;
- ++ptr;
- size -= 2;
- }
-
- /* Add left-over byte, if any */
- if (size > 0)
- sum += (uint16_t) *(const uint8_t *) ptr;
-
- /* Fold 32-bit sum to 16 bits */
- sum = (sum & 0xffff) + (sum >> 16);
-
- checksum = ~sum;
-
- return checksum;
-}
-#endif /* PIM_USE_QUAGGA_INET_CHECKSUM */
-
void pim_pkt_dump(const char *label, const uint8_t *buf, int size)
{
char dump_buf[1000];
diff --git a/pimd/pim_util.h b/pimd/pim_util.h
index 6f5bf22..a8613e2 100644
--- a/pimd/pim_util.h
+++ b/pimd/pim_util.h
@@ -32,12 +32,6 @@
uint8_t igmp_msg_encode16to8(uint16_t value);
uint16_t igmp_msg_decode8to16(uint8_t code);
-#ifdef PIM_USE_QUAGGA_INET_CHECKSUM
-#define pim_inet_checksum(buf,size) in_cksum(buf,size)
-#else
-uint16_t pim_inet_checksum(const char *buf, int size);
-#endif /* PIM_USE_QUAGGA_INET_CHECKSUM */
-
void pim_pkt_dump(const char *label, const uint8_t *buf, int size);
#endif /* PIM_UTIL_H */