diff options
author | pmikus <pmikus@cisco.com> | 2021-06-14 08:15:25 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2021-06-14 09:27:09 +0000 |
commit | b67b82c15d7d0da402df180b0aaab3daa4cfc76c (patch) | |
tree | 307c3481f5c026871fd38cbb03f682125a7db27e /GPL/traffic_scripts | |
parent | a4ba3f4e9d2124050502b8dc5c53acbdebd39e11 (diff) |
FIX: vpp_device ignore packets list
Signed-off-by: pmikus <pmikus@cisco.com>
Change-Id: Ifda8fcb102661e7c585bc5fe3a16113ae629d516
Diffstat (limited to 'GPL/traffic_scripts')
-rw-r--r-- | GPL/traffic_scripts/geneve_tunnel.py | 15 | ||||
-rw-r--r-- | GPL/traffic_scripts/ipsec_interface.py | 18 | ||||
-rw-r--r-- | GPL/traffic_scripts/ipsec_policy.py | 19 | ||||
-rw-r--r-- | GPL/traffic_scripts/lisp/lisp_check.py | 6 | ||||
-rw-r--r-- | GPL/traffic_scripts/nat.py | 24 | ||||
-rw-r--r-- | GPL/traffic_scripts/policer.py | 6 | ||||
-rw-r--r-- | GPL/traffic_scripts/send_icmp_wait_for_reply.py | 11 | ||||
-rw-r--r-- | GPL/traffic_scripts/send_ip_check_headers.py | 11 | ||||
-rw-r--r-- | GPL/traffic_scripts/srv6_encap.py | 14 |
9 files changed, 97 insertions, 27 deletions
diff --git a/GPL/traffic_scripts/geneve_tunnel.py b/GPL/traffic_scripts/geneve_tunnel.py index 19dae6d5c9..be9502c2d4 100644 --- a/GPL/traffic_scripts/geneve_tunnel.py +++ b/GPL/traffic_scripts/geneve_tunnel.py @@ -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 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 @@ -284,6 +284,10 @@ def main(): # 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 @@ -341,9 +345,12 @@ def main(): # 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) diff --git a/GPL/traffic_scripts/ipsec_interface.py b/GPL/traffic_scripts/ipsec_interface.py index d49e8bc57e..574985f679 100644 --- a/GPL/traffic_scripts/ipsec_interface.py +++ b/GPL/traffic_scripts/ipsec_interface.py @@ -29,7 +29,7 @@ import sys 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 @@ -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 + 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 @@ -275,6 +283,14 @@ def main(): # 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 diff --git a/GPL/traffic_scripts/ipsec_policy.py b/GPL/traffic_scripts/ipsec_policy.py index b0d4545114..413f36bceb 100644 --- a/GPL/traffic_scripts/ipsec_policy.py +++ b/GPL/traffic_scripts/ipsec_policy.py @@ -29,7 +29,7 @@ import sys 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 @@ -209,6 +209,10 @@ def main(): # 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 @@ -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 - 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) diff --git a/GPL/traffic_scripts/lisp/lisp_check.py b/GPL/traffic_scripts/lisp/lisp_check.py index f7b4c6a797..c388348b3b 100644 --- a/GPL/traffic_scripts/lisp/lisp_check.py +++ b/GPL/traffic_scripts/lisp/lisp_check.py @@ -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.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 @@ -166,6 +166,10 @@ def main(): # 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 diff --git a/GPL/traffic_scripts/nat.py b/GPL/traffic_scripts/nat.py index 43715fb383..994157ae81 100644 --- a/GPL/traffic_scripts/nat.py +++ b/GPL/traffic_scripts/nat.py @@ -30,7 +30,7 @@ import sys 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 @@ -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 - 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}") @@ -202,9 +209,12 @@ def main(): # 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}") diff --git a/GPL/traffic_scripts/policer.py b/GPL/traffic_scripts/policer.py index 46131da2a0..76b7812687 100644 --- a/GPL/traffic_scripts/policer.py +++ b/GPL/traffic_scripts/policer.py @@ -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 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 @@ -116,6 +116,10 @@ def main(): # 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 diff --git a/GPL/traffic_scripts/send_icmp_wait_for_reply.py b/GPL/traffic_scripts/send_icmp_wait_for_reply.py index fefa60f44e..295de2fc0b 100644 --- a/GPL/traffic_scripts/send_icmp_wait_for_reply.py +++ b/GPL/traffic_scripts/send_icmp_wait_for_reply.py @@ -30,7 +30,7 @@ import ipaddress 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 @@ -130,9 +130,12 @@ def main(): # 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 \ diff --git a/GPL/traffic_scripts/send_ip_check_headers.py b/GPL/traffic_scripts/send_ip_check_headers.py index e052b12190..0ecebbe398 100644 --- a/GPL/traffic_scripts/send_ip_check_headers.py +++ b/GPL/traffic_scripts/send_ip_check_headers.py @@ -34,7 +34,7 @@ import ipaddress 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 @@ -145,9 +145,12 @@ def main(): # 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") diff --git a/GPL/traffic_scripts/srv6_encap.py b/GPL/traffic_scripts/srv6_encap.py index ce62d79974..9c4ea257a0 100644 --- a/GPL/traffic_scripts/srv6_encap.py +++ b/GPL/traffic_scripts/srv6_encap.py @@ -28,7 +28,7 @@ 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 @@ -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 + 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 @@ -300,6 +308,10 @@ def main(): # 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 |