summaryrefslogtreecommitdiff
path: root/pimd/pim_igmpv3.c
diff options
context:
space:
mode:
authorMobashshera Rasool <mrasool@vmware.com>2020-10-14 13:51:32 +0000
committerMobashshera Rasool <mrasool@vmware.com>2020-11-17 13:34:12 +0000
commit9041c30ad1a8db6be436bc24421fabdd5ad54a6b (patch)
tree266d590f50baad77f4a9cbb415f677f46df998a3 /pimd/pim_igmpv3.c
parentb131b5f539962c2a438cd7434bd83e14888437b7 (diff)
pimd: checksum must be validated before accepting igmp packets
Issue: When an IGMPv2 leave packet is received, it did not validate the checksum and hence the packet is accepted and group specific query is sent out in response to this. Due to this IGMP conformance test case 6.1 failed. https://github.com/FRRouting/frr/issues/6868 Fix: Validate the checksum for all IGMP packets Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
Diffstat (limited to 'pimd/pim_igmpv3.c')
-rw-r--r--pimd/pim_igmpv3.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c
index 22767a8629..425adfe166 100644
--- a/pimd/pim_igmpv3.c
+++ b/pimd/pim_igmpv3.c
@@ -1830,8 +1830,6 @@ void igmp_v3_recv_query(struct igmp_sock *igmp, const char *from_str,
int igmp_v3_recv_report(struct igmp_sock *igmp, struct in_addr from,
const char *from_str, char *igmp_msg, int igmp_msg_len)
{
- uint16_t recv_checksum;
- uint16_t checksum;
int num_groups;
uint8_t *group_record;
uint8_t *report_pastend = (uint8_t *)igmp_msg + igmp_msg_len;
@@ -1853,16 +1851,10 @@ int igmp_v3_recv_report(struct igmp_sock *igmp, struct in_addr from,
return -1;
}
- recv_checksum = *(uint16_t *)(igmp_msg + IGMP_CHECKSUM_OFFSET);
-
- /* for computing checksum */
- *(uint16_t *)(igmp_msg + IGMP_CHECKSUM_OFFSET) = 0;
-
- checksum = in_cksum(igmp_msg, igmp_msg_len);
- if (checksum != recv_checksum) {
+ if (igmp_validate_checksum(igmp_msg, igmp_msg_len) == -1) {
zlog_warn(
- "Recv IGMP report v3 from %s on %s: checksum mismatch: received=%x computed=%x",
- from_str, ifp->name, recv_checksum, checksum);
+ "Recv IGMPv3 report from %s on %s with invalid checksum",
+ from_str, ifp->name);
return -1;
}
@@ -1880,9 +1872,8 @@ int igmp_v3_recv_report(struct igmp_sock *igmp, struct in_addr from,
if (PIM_DEBUG_IGMP_PACKETS) {
zlog_debug(
- "Recv IGMP report v3 from %s on %s: size=%d checksum=%x groups=%d",
- from_str, ifp->name, igmp_msg_len, checksum,
- num_groups);
+ "Recv IGMP report v3 from %s on %s: size=%d groups=%d",
+ from_str, ifp->name, igmp_msg_len, num_groups);
}
group_record = (uint8_t *)igmp_msg + IGMP_V3_REPORT_GROUPPRECORD_OFFSET;