As part of checksum calculation for a received packet we were
comparing the checksum returned from in_cksum. Typically
when we calculate the checksum the value stored in the checksum
must be all 0's. Store the received checksum and then set
the checksum to 0 and then compare.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
int ip_hlen, iplen, datalen;
struct zebra_if *zi;
struct irdp_interface *irdp;
+ uint16_t saved_chksum;
zi = ifp->info;
if (!zi)
icmp = (struct icmphdr *)(p + ip_hlen);
+ saved_chksum = icmp->checksum;
+ icmp->checksum = 0;
/* check icmp checksum */
- if (in_cksum(icmp, datalen) != icmp->checksum) {
+ if (in_cksum(icmp, datalen) != saved_chksum) {
flog_warn(
EC_ZEBRA_IRDP_BAD_CHECKSUM,
"IRDP: RX ICMP packet from %s. Bad checksum, silently ignored",