summaryrefslogtreecommitdiffstats
path: root/pimd/pim_igmp.c
diff options
context:
space:
mode:
authorMobashshera Rasool <mrasool@vmware.com>2021-07-19 21:31:56 +0200
committerMobashshera Rasool <mrasool@vmware.com>2021-07-19 21:46:10 +0200
commite39f74d04a1e61bd75a9519a8484ce5ae7f22b33 (patch)
tree2b2054ca5e27d6a10c49d51a1b7b10678b0bed7a /pimd/pim_igmp.c
parentpimd: Add TTL check for IGMP conformance (diff)
downloadfrr-e39f74d04a1e61bd75a9519a8484ce5ae7f22b33.tar.xz
frr-e39f74d04a1e61bd75a9519a8484ce5ae7f22b33.zip
pimd: Add TOS check for IGMP conformance
IGMPv3 packets with invalid TOS should be dropped. Test Case ID: 4.10 TEST_DESCRIPTION Every IGMP message described in this document is sent with IP Precedence of Internetwork Control (e.g., Type of Service 0xc0) (Tests that IGMPv3 Membership Query Message conforms to above statement) TEST_REFERENCE NEGATIVE: RFC 3376, IGMP Version 3, s4 p7 Message Formats Issue: #9071 Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
Diffstat (limited to 'pimd/pim_igmp.c')
-rw-r--r--pimd/pim_igmp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index 069c51597..477cf991b 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -494,6 +494,17 @@ bool pim_igmp_verify_header(struct ip *ip_hdr, size_t len, int igmp_msg_len,
}
}
+ if ((msg_type == PIM_IGMP_V3_MEMBERSHIP_REPORT)
+ || ((msg_type == PIM_IGMP_MEMBERSHIP_QUERY)
+ && (igmp_msg_len >= IGMP_V3_SOURCES_OFFSET))) {
+ /* All IGMPv3 messages must be received with TOS set to 0xC0*/
+ if (ip_hdr->ip_tos != IPTOS_PREC_INTERNETCONTROL) {
+ zlog_warn("Received IGMP Packet with invalid TOS %u",
+ ip_hdr->ip_tos);
+ return -1;
+ }
+ }
+
return true;
}