aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_pg_interface.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-01-07 10:04:09 -0800
committerOle Trøan <otroan@employees.org>2017-01-09 08:53:57 +0000
commit465a1a3a462d80407c781573226033a5a4ada96e (patch)
tree207fe5341950035c85a37f3a583c25acfcd9bc62 /test/vpp_pg_interface.py
parent45a00c44d1dd893474819e88a7d7eed1c7947c4d (diff)
In python tests send NS packets to the solicited mcast address with correct mcast MAC, rather than to quiered addr and broadcast MAC
Change-Id: Idb2f8ad09ccb421b7974b8a944cb411cfb4be9d5 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/vpp_pg_interface.py')
-rw-r--r--test/vpp_pg_interface.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/vpp_pg_interface.py b/test/vpp_pg_interface.py
index 2256ada0..aef0052e 100644
--- a/test/vpp_pg_interface.py
+++ b/test/vpp_pg_interface.py
@@ -1,5 +1,6 @@
import os
import time
+import socket
from traceback import format_exc
from scapy.utils import wrpcap, rdpcap, PcapReader
from vpp_interface import VppInterface
@@ -9,7 +10,8 @@ from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6ND_NA,\
ICMPv6NDOptSrcLLAddr, ICMPv6NDOptDstLLAddr, ICMPv6ND_RA, RouterAlert, \
IPv6ExtHdrHopByHop
from util import ppp, ppc
-
+from scapy.utils6 import in6_getnsma, in6_getnsmac
+from scapy.utils import inet_pton, inet_ntop
def is_ipv6_misc(p):
""" Is packet one of uninteresting IPv6 broadcasts? """
@@ -304,8 +306,11 @@ class VppPGInterface(VppInterface):
def create_ndp_req(self):
"""Create NDP - NS applicable for this interface"""
- return (Ether(dst="ff:ff:ff:ff:ff:ff", src=self.remote_mac) /
- IPv6(src=self.remote_ip6, dst=self.local_ip6) /
+ nsma = in6_getnsma(inet_pton(socket.AF_INET6, self.local_ip6))
+ d = inet_ntop(socket.AF_INET6, nsma)
+
+ return (Ether(dst=in6_getnsmac(nsma)) /
+ IPv6(dst=d, src=self.remote_ip6) /
ICMPv6ND_NS(tgt=self.local_ip6) /
ICMPv6NDOptSrcLLAddr(lladdr=self.remote_mac))