]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Add TTL check for IGMP conformance
authorMobashshera Rasool <mrasool@vmware.com>
Mon, 19 Jul 2021 19:29:09 +0000 (19:29 +0000)
committerMobashshera Rasool <mrasool@vmware.com>
Mon, 19 Jul 2021 19:46:10 +0000 (19:46 +0000)
IGMPv3 packets with invalid TTL should be dropped.
Test Case ID: 4.10
TEST_DESCRIPTION
Every IGMP message described in this document is sent with an IP
Time-to-Live of 1 (Tests that IGMPv3 Membership Report Message
conforms to above statement)
TEST_REFERENCE
NEGATIVE: RFC 3376, IGMP Version 3, s4 p7 Message Formats
Issue: #9070

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
pimd/pim_igmp.c

index 36f044b16f0ea7655e410eddf1250026b276d00e..069c515971ae84120b370c14d739940ce712753b 100644 (file)
@@ -484,6 +484,16 @@ bool pim_igmp_verify_header(struct ip *ip_hdr, size_t len, int igmp_msg_len,
                return false;
        }
 
+       if ((msg_type != PIM_IGMP_MTRACE_RESPONSE)
+           && (msg_type != PIM_IGMP_MTRACE_QUERY_REQUEST)) {
+               if (ip_hdr->ip_ttl != 1) {
+                       zlog_warn(
+                               "Recv IGMP packet with invalid ttl=%u, discarding the packet",
+                               ip_hdr->ip_ttl);
+                       return -1;
+               }
+       }
+
        return true;
 }