summaryrefslogtreecommitdiffstats
path: root/test/test_igmp.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-06-30 09:05:05 +0000
committerNeale Ranns <nranns@cisco.com>2019-06-30 09:14:18 +0000
commit01b0a05e4ffc9e84eeedf15919c1a320daec4e91 (patch)
treec01bcbc16cb05c8997e191a6d9ea83e8315ed279 /test/test_igmp.py
parent1671d3be382fc8690f24d3569733f3dcf96cf011 (diff)
igmp: accept packets that have more on the wire data than IGMP reports.
IGMPv3 sends a variable length of sources in a query. Today if the amount of data on the wire does not exactly match that required for the number of sources the packet is dropped. Relax this check and instead accept the packet is the amount of wire data is equal or greater than the number of sources. Some devices on the wild internet pad small packets. Type: feature Change-Id: I102682814b38c0a0614d71816c9a286d90b834df Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/test_igmp.py')
-rw-r--r--test/test_igmp.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/test_igmp.py b/test/test_igmp.py
index 017382d3b5b..68a3e4e41f3 100644
--- a/test/test_igmp.py
+++ b/test/test_igmp.py
@@ -2,7 +2,7 @@
import unittest
-from scapy.layers.l2 import Ether
+from scapy.layers.l2 import Ether, Raw
from scapy.layers.inet import IP, IPOption
from scapy.contrib.igmpv3 import IGMPv3, IGMPv3gr, IGMPv3mq, IGMPv3mr
@@ -194,12 +194,15 @@ class TestIgmp(VppTestCase):
#
# Send a general query (to the all router's address)
- # expect VPP to respond with a membership report
+ # expect VPP to respond with a membership report.
+ # Pad the query with 0 - some devices in the big wild
+ # internet are prone to this.
#
p_g = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
IP(src=self.pg0.remote_ip4, dst='224.0.0.1', tos=0xc0) /
IGMPv3(type="Membership Query", mrcode=100) /
- IGMPv3mq(gaddr="0.0.0.0"))
+ IGMPv3mq(gaddr="0.0.0.0") /
+ Raw('\x00' * 10))
self.send(self.pg0, p_g)
@@ -241,6 +244,19 @@ class TestIgmp(VppTestCase):
[IgmpRecord(h1.sg, "Mode Is Include")])
#
+ # A group and source specific query that reports more sources
+ # than the packet actually has.
+ #
+ p_gs2 = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
+ IP(src=self.pg0.remote_ip4, dst='239.1.1.1', tos=0xc0,
+ options=[IPOption(copy_flag=1, optclass="control",
+ option="router_alert")]) /
+ IGMPv3(type="Membership Query", mrcode=100) /
+ IGMPv3mq(gaddr="239.1.1.1", numsrc=4, srcaddrs=["1.1.1.1"]))
+
+ self.send_and_assert_no_replies(self.pg0, p_gs2, timeout=10)
+
+ #
# A group and source specific query, with the source NOT matching
# the source VPP has. There should be no response.
#