summaryrefslogtreecommitdiffstats
path: root/test/template_ipsec.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-07-16 06:19:35 -0700
committerNeale Ranns <nranns@cisco.com>2019-07-16 15:05:10 +0000
commit41afb33efe81a93ddf5879138802bf23602ccc81 (patch)
treec0a8f8b7866d58379e35fd5b57057b86b780115a /test/template_ipsec.py
parent37dab437be1331e40f6f3e63f52235655431f65f (diff)
ipsec: handle UDP keepalives
Type: feature Change-Id: I87cc1168466f267e8c4bbec318401982f4bdf03a Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/template_ipsec.py')
-rw-r--r--test/template_ipsec.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/template_ipsec.py b/test/template_ipsec.py
index d714a93d378..e40fa561dbd 100644
--- a/test/template_ipsec.py
+++ b/test/template_ipsec.py
@@ -558,6 +558,8 @@ class IpsecTun4(object):
def verify_encrypted(self, p, sa, rxs):
decrypt_pkts = []
for rx in rxs:
+ if p.nat_header:
+ self.assertEqual(rx[UDP].dport, 4500)
self.assert_packet_checksums_valid(rx)
self.assertEqual(len(rx) - len(Ether()), rx[IP].len)
try:
@@ -642,6 +644,23 @@ class IpsecTun4(object):
self.verify_counters4(p, count)
+ def verify_keepalive(self, p):
+ pkt = (Ether(src=self.tun_if.remote_mac, dst=self.tun_if.local_mac) /
+ IP(src=p.remote_tun_if_host, dst=self.tun_if.local_ip4) /
+ UDP(sport=333, dport=4500) /
+ Raw(0xff))
+ self.send_and_assert_no_replies(self.tun_if, pkt*31)
+ self.assert_error_counter_equal(
+ '/err/%s/NAT Keepalive' % self.tun4_input_node, 31)
+
+ pkt = (Ether(src=self.tun_if.remote_mac, dst=self.tun_if.local_mac) /
+ IP(src=p.remote_tun_if_host, dst=self.tun_if.local_ip4) /
+ UDP(sport=333, dport=4500) /
+ Raw(0xfe))
+ self.send_and_assert_no_replies(self.tun_if, pkt*31)
+ self.assert_error_counter_equal(
+ '/err/%s/Too Short' % self.tun4_input_node, 31)
+
class IpsecTun4Tests(IpsecTun4):
""" UT test methods for Tunnel v4 """