FIX: vpp_device ignore packets list 93/32693/2
authorpmikus <pmikus@cisco.com>
Mon, 14 Jun 2021 08:15:25 +0000 (08:15 +0000)
committerPeter Mikus <pmikus@cisco.com>
Mon, 14 Jun 2021 09:27:09 +0000 (09:27 +0000)
Signed-off-by: pmikus <pmikus@cisco.com>
Change-Id: Ifda8fcb102661e7c585bc5fe3a16113ae629d516

GPL/traffic_scripts/geneve_tunnel.py
GPL/traffic_scripts/ipsec_interface.py
GPL/traffic_scripts/ipsec_policy.py
GPL/traffic_scripts/lisp/lisp_check.py
GPL/traffic_scripts/nat.py
GPL/traffic_scripts/policer.py
GPL/traffic_scripts/send_icmp_wait_for_reply.py
GPL/traffic_scripts/send_ip_check_headers.py
GPL/traffic_scripts/srv6_encap.py

index 19dae6d..be9502c 100644 (file)
@@ -30,7 +30,7 @@ import sys
 from ipaddress import ip_address
 from scapy.contrib.geneve import GENEVE
 from scapy.layers.inet import IP, UDP
 from ipaddress import ip_address
 from scapy.contrib.geneve import GENEVE
 from scapy.layers.inet import IP, UDP
-from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2
+from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2, ICMPv6ND_RA
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 
@@ -284,6 +284,10 @@ def main():
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
+        elif rx_pkt_recv.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
 
         # otherwise process the current packet
         break
 
         # otherwise process the current packet
         break
@@ -341,9 +345,12 @@ def main():
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
-        else:
-            # otherwise process the current packet
-            break
+        elif tx_pkt_recv.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
+
+        break
 
     check_ip(
         tx_pkt_recv, ip_layer, tx_dst_mac, tx_src_mac, str(dst_ip), str(src_ip)
 
     check_ip(
         tx_pkt_recv, ip_layer, tx_dst_mac, tx_src_mac, str(dst_ip), str(src_ip)
index d49e8bc..574985f 100644 (file)
@@ -29,7 +29,7 @@ import sys
 
 from ipaddress import ip_address
 from scapy.layers.inet import IP
 
 from ipaddress import ip_address
 from scapy.layers.inet import IP
-from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2
+from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2, ICMPv6ND_RA
 from scapy.layers.ipsec import SecurityAssociation, ESP
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 from scapy.layers.ipsec import SecurityAssociation, ESP
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
@@ -243,6 +243,14 @@ def main():
         if rx_pkt_recv.haslayer(ICMPv6ND_NS):
             # read another packet in the queue if the current one is ICMPv6ND_NS
             continue
         if rx_pkt_recv.haslayer(ICMPv6ND_NS):
             # read another packet in the queue if the current one is ICMPv6ND_NS
             continue
+        elif rx_pkt_recv.haslayer(ICMPv6MLReport2):
+            # read another packet in the queue if the current one is
+            # ICMPv6MLReport2
+            continue
+        elif rx_pkt_recv.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
 
         # otherwise process the current packet
         break
 
         # otherwise process the current packet
         break
@@ -275,6 +283,14 @@ def main():
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
+        elif tx_pkt_recv.haslayer(ICMPv6MLReport2):
+            # read another packet in the queue if the current one is
+            # ICMPv6MLReport2
+            continue
+        elif tx_pkt_recv.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
 
         # otherwise process the current packet
         break
 
         # otherwise process the current packet
         break
index b0d4545..413f36b 100644 (file)
@@ -29,7 +29,7 @@ import sys
 
 from ipaddress import ip_address
 from scapy.layers.inet import IP
 
 from ipaddress import ip_address
 from scapy.layers.inet import IP
-from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2
+from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2, ICMPv6ND_RA
 from scapy.layers.ipsec import SecurityAssociation, ESP
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 from scapy.layers.ipsec import SecurityAssociation, ESP
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
@@ -209,6 +209,10 @@ def main():
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
+        elif rx_pkt_recv.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
 
         # otherwise process the current packet
         break
 
         # otherwise process the current packet
         break
@@ -232,9 +236,16 @@ def main():
         if tx_pkt_recv.haslayer(ICMPv6ND_NS):
             # read another packet in the queue if the current one is ICMPv6ND_NS
             continue
         if tx_pkt_recv.haslayer(ICMPv6ND_NS):
             # read another packet in the queue if the current one is ICMPv6ND_NS
             continue
-        else:
-            # otherwise process the current packet
-            break
+        elif tx_pkt_recv.haslayer(ICMPv6MLReport2):
+            # read another packet in the queue if the current one is
+            # ICMPv6MLReport2
+            continue
+        elif tx_pkt_recv.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
+
+        break
 
     check_ipsec(tx_pkt_recv, ip_layer, src_tun, dst_ip, src_ip, sa_in)
 
 
     check_ipsec(tx_pkt_recv, ip_layer, src_tun, dst_ip, src_ip, sa_in)
 
index f7b4c6a..c388348 100644 (file)
@@ -34,7 +34,7 @@ from scapy.all import bind_layers, Packet
 from scapy.fields import FlagsField, BitField, IntField
 from scapy.layers.inet import ICMP, IP, UDP
 from scapy.layers.inet6 import ICMPv6EchoRequest
 from scapy.fields import FlagsField, BitField, IntField
 from scapy.layers.inet import ICMP, IP, UDP
 from scapy.layers.inet6 import ICMPv6EchoRequest
-from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2
+from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2, ICMPv6ND_RA
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 
@@ -166,6 +166,10 @@ def main():
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
+        elif ether.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
 
         # otherwise process the current packet
         break
 
         # otherwise process the current packet
         break
index 43715fb..994157a 100644 (file)
@@ -30,7 +30,7 @@ import sys
 import ipaddress
 
 from scapy.layers.inet import IP, TCP, UDP
 import ipaddress
 
 from scapy.layers.inet import IP, TCP, UDP
-from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2
+from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2, ICMPv6ND_RA
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 
@@ -136,9 +136,16 @@ def main():
         if ether.haslayer(ICMPv6ND_NS):
             # read another packet in the queue if the current one is ICMPv6ND_NS
             continue
         if ether.haslayer(ICMPv6ND_NS):
             # read another packet in the queue if the current one is ICMPv6ND_NS
             continue
-        else:
-            # otherwise process the current packet
-            break
+        elif ether.haslayer(ICMPv6MLReport2):
+            # read another packet in the queue if the current one is
+            # ICMPv6MLReport2
+            continue
+        elif ether.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
+
+        break
 
     if rx_dst_mac != ether[Ether].dst or rx_src_mac != ether[Ether].src:
         raise RuntimeError(f"Matching packet unsuccessful: {ether!r}")
 
     if rx_dst_mac != ether[Ether].dst or rx_src_mac != ether[Ether].src:
         raise RuntimeError(f"Matching packet unsuccessful: {ether!r}")
@@ -202,9 +209,12 @@ def main():
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
-        else:
-            # otherwise process the current packet
-            break
+        elif ether.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
+
+        break
 
     if ether[Ether].dst != tx_src_mac or ether[Ether].src != tx_dst_mac:
         raise RuntimeError(f"Matching packet unsuccessful: {ether!r}")
 
     if ether[Ether].dst != tx_src_mac or ether[Ether].src != tx_dst_mac:
         raise RuntimeError(f"Matching packet unsuccessful: {ether!r}")
index 46131da..76b7812 100644 (file)
@@ -30,7 +30,7 @@ import sys
 from ipaddress import ip_address
 from scapy.layers.l2 import Ether
 from scapy.layers.inet import IP, TCP
 from ipaddress import ip_address
 from scapy.layers.l2 import Ether
 from scapy.layers.inet import IP, TCP
-from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2
+from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2, ICMPv6ND_RA
 from scapy.packet import Raw
 
 from .TrafficScriptArg import TrafficScriptArg
 from scapy.packet import Raw
 
 from .TrafficScriptArg import TrafficScriptArg
@@ -116,6 +116,10 @@ def main():
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
+        elif pkt_recv.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
 
         # otherwise process the current packet
         break
 
         # otherwise process the current packet
         break
index fefa60f..295de2f 100644 (file)
@@ -30,7 +30,7 @@ import ipaddress
 
 from scapy.layers.inet import ICMP, IP
 from scapy.layers.inet6 import ICMPv6EchoRequest, ICMPv6EchoReply,\
 
 from scapy.layers.inet import ICMP, IP
 from scapy.layers.inet6 import ICMPv6EchoRequest, ICMPv6EchoReply,\
-    ICMPv6ND_NS, ICMPv6MLReport2
+    ICMPv6ND_NS, ICMPv6MLReport2, ICMPv6ND_RA
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 
@@ -130,9 +130,12 @@ def main():
                 # read another packet in the queue if the current one is
                 # ICMPv6MLReport2
                 continue
                 # read another packet in the queue if the current one is
                 # ICMPv6MLReport2
                 continue
-            else:
-                # otherwise process the current packet
-                break
+            elif icmp_reply.haslayer(ICMPv6ND_RA):
+                # read another packet in the queue if the current one is
+                # ICMPv6ND_RA
+                continue
+
+            break
 
         if icmp_reply[ip_layer][icmp_resp].type == icmp_type:
             if icmp_reply[ip_layer].src == dst_ip and \
 
         if icmp_reply[ip_layer][icmp_resp].type == icmp_type:
             if icmp_reply[ip_layer].src == dst_ip and \
index e052b12..0ecebbe 100644 (file)
@@ -34,7 +34,7 @@ import ipaddress
 
 from robot.api import logger
 from scapy.layers.inet import IP
 
 from robot.api import logger
 from scapy.layers.inet import IP
-from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2
+from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6MLReport2, ICMPv6ND_RA
 from scapy.layers.l2 import Ether, Dot1Q
 from scapy.packet import Raw
 
 from scapy.layers.l2 import Ether, Dot1Q
 from scapy.packet import Raw
 
@@ -145,9 +145,12 @@ def main():
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
-        else:
-            # otherwise process the current packet
-            break
+        elif ether.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
+
+        break
 
     if rx_dst_mac == ether[Ether].dst and rx_src_mac == ether[Ether].src:
         logger.trace(u"MAC matched")
 
     if rx_dst_mac == ether[Ether].dst and rx_src_mac == ether[Ether].src:
         logger.trace(u"MAC matched")
index ce62d79..9c4ea25 100644 (file)
@@ -28,7 +28,7 @@
 import sys
 
 from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, IPv6ExtHdrSegmentRouting,\
 import sys
 
 from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, IPv6ExtHdrSegmentRouting,\
-    ipv6nh, ICMPv6MLReport2
+    ipv6nh, ICMPv6MLReport2, ICMPv6ND_RA
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 
 from scapy.layers.l2 import Ether
 from scapy.packet import Raw
 
@@ -255,6 +255,14 @@ def main():
         if rx_pkt_recv.haslayer(ICMPv6ND_NS):
             # read another packet in the queue if the current one is ICMPv6ND_NS
             continue
         if rx_pkt_recv.haslayer(ICMPv6ND_NS):
             # read another packet in the queue if the current one is ICMPv6ND_NS
             continue
+        elif rx_pkt_recv.haslayer(ICMPv6MLReport2):
+            # read another packet in the queue if the current one is
+            # ICMPv6MLReport2
+            continue
+        elif rx_pkt_recv.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
 
         # otherwise process the current packet
         break
 
         # otherwise process the current packet
         break
@@ -300,6 +308,10 @@ def main():
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
             # read another packet in the queue if the current one is
             # ICMPv6MLReport2
             continue
+        elif tx_pkt_recv.haslayer(ICMPv6ND_RA):
+            # read another packet in the queue if the current one is
+            # ICMPv6ND_RA
+            continue
 
         # otherwise process the current packet
         break
 
         # otherwise process the current packet
         break