diff options
author | Vladimir Isaev <visaev@netgate.com> | 2020-05-21 16:34:17 +0300 |
---|---|---|
committer | John Lo <loj@cisco.com> | 2020-06-08 14:17:59 +0000 |
commit | 698eb87a8eed847fe555ef327bcc99a4467ed59a (patch) | |
tree | 102c29c5d96a23a3e185e4d2d765f763445e8076 /test | |
parent | e3621518046ad7f37ccf77c549a93375ab89da19 (diff) |
vxlan: Fixed checksum caclculation offset
VXLAN uses csum_offload for IPv6 packets.
But without gso node we have csum calculated only for inner
packet.
This patch adds support for outer header csum calculation.
Checksum for inner packet should be calculated before
interface-output node (for example in vxlan node).
Type: fix
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Signed-off-by: Vladimir Isaev <visaev@netgate.com>
Change-Id: Ica68429ede4426293769207cd83c791ebe72fe56
Diffstat (limited to 'test')
-rw-r--r-- | test/test_gso.py | 4 | ||||
-rw-r--r-- | test/test_vxlan.py | 3 | ||||
-rw-r--r-- | test/test_vxlan6.py | 35 | ||||
-rw-r--r-- | test/test_vxlan_gbp.py | 3 | ||||
-rw-r--r-- | test/test_vxlan_gpe.py | 2 |
5 files changed, 41 insertions, 6 deletions
diff --git a/test/test_gso.py b/test/test_gso.py index 29a54eb396f..7189104a859 100644 --- a/test/test_gso.py +++ b/test/test_gso.py @@ -444,7 +444,7 @@ class TestGSO(VppTestCase): self.assertEqual(rx[Ether].dst, self.pg0.remote_mac) self.assertEqual(rx[IPv6].src, self.pg0.local_ip6) self.assertEqual(rx[IPv6].dst, self.pg0.remote_ip6) - self.assert_udp_checksum_valid(rx) + self.assert_udp_checksum_valid(rx, ignore_zero_checksum=False) self.assertEqual(rx[VXLAN].vni, 10) inner = rx[VXLAN].payload self.assertEqual(rx[IPv6].plen - 8 - 8, len(inner)) @@ -474,7 +474,7 @@ class TestGSO(VppTestCase): self.assertEqual(rx[Ether].dst, self.pg0.remote_mac) self.assertEqual(rx[IPv6].src, self.pg0.local_ip6) self.assertEqual(rx[IPv6].dst, self.pg0.remote_ip6) - self.assert_udp_checksum_valid(rx) + self.assert_udp_checksum_valid(rx, ignore_zero_checksum=False) self.assertEqual(rx[VXLAN].vni, 10) inner = rx[VXLAN].payload self.assertEqual(rx[IPv6].plen - 8 - 8, len(inner)) diff --git a/test/test_vxlan.py b/test/test_vxlan.py index 1793e494251..54d0c2d4a59 100644 --- a/test/test_vxlan.py +++ b/test/test_vxlan.py @@ -80,7 +80,8 @@ class TestVxlan(BridgeDomain, VppTestCase): # Verify UDP destination port is VXLAN 4789, source UDP port could be # arbitrary. self.assertEqual(pkt[UDP].dport, type(self).dport) - # TODO: checksum check + # Verify UDP checksum + self.assert_udp_checksum_valid(pkt) # Verify VNI self.assertEqual(pkt[VXLAN].vni, vni) diff --git a/test/test_vxlan6.py b/test/test_vxlan6.py index 3a11ea91db1..d9e2d8159d1 100644 --- a/test/test_vxlan6.py +++ b/test/test_vxlan6.py @@ -6,7 +6,8 @@ from framework import VppTestCase, VppTestRunner from template_bd import BridgeDomain from scapy.layers.l2 import Ether -from scapy.layers.inet6 import IPv6, UDP +from scapy.packet import Raw +from scapy.layers.inet6 import IP, IPv6, UDP from scapy.layers.vxlan import VXLAN import util @@ -80,7 +81,8 @@ class TestVxlan6(BridgeDomain, VppTestCase): # Verify UDP destination port is VXLAN 4789, source UDP port could be # arbitrary. self.assertEqual(pkt[UDP].dport, type(self).dport) - # TODO: checksum check + # Verify UDP checksum + self.assert_udp_checksum_valid(pkt, ignore_zero_checksum=False) # Verify VNI self.assertEqual(pkt[VXLAN].vni, vni) @@ -190,6 +192,35 @@ class TestVxlan6(BridgeDomain, VppTestCase): self.logger.info(self.vapi.cli("show bridge-domain 3 detail")) self.logger.info(self.vapi.cli("show vxlan tunnel")) + def test_encap_fragmented_packet(self): + """ Encapsulation test send fragments from pg1 + Verify receipt of encapsulated frames on pg0 + """ + + frame = (Ether(src='00:00:00:00:00:02', dst='00:00:00:00:00:01') / + IP(src='4.3.2.1', dst='1.2.3.4') / + UDP(sport=20000, dport=10000) / + Raw(b'\xa5' * 1000)) + + frags = util.fragment_rfc791(frame, 400) + + self.pg1.add_stream(frags) + + self.pg0.enable_capture() + + self.pg_start() + + out = self.pg0.get_capture(3) + + payload = [] + for pkt in out: + payload.append(self.decapsulate(pkt)) + self.check_encapsulation(pkt, self.single_tunnel_vni) + + reassembled = util.reassemble4(payload) + + self.assertEqual(Ether(raw(frame))[IP], reassembled[IP]) + if __name__ == '__main__': unittest.main(testRunner=VppTestRunner) diff --git a/test/test_vxlan_gbp.py b/test/test_vxlan_gbp.py index 79eb23d45a4..f332aced7d8 100644 --- a/test/test_vxlan_gbp.py +++ b/test/test_vxlan_gbp.py @@ -80,7 +80,8 @@ class TestVxlanGbp(VppTestCase): # Verify UDP destination port is VXLAN GBP 48879, source UDP port could # be arbitrary. self.assertEqual(pkt[UDP].dport, type(self).dport) - # TODO: checksum check + # Verify UDP checksum + self.assert_udp_checksum_valid(pkt) # Verify VNI # pkt.show() self.assertEqual(pkt[VXLAN].vni, vni) diff --git a/test/test_vxlan_gpe.py b/test/test_vxlan_gpe.py index 5c3ac16640c..c5d6bf07f7c 100644 --- a/test/test_vxlan_gpe.py +++ b/test/test_vxlan_gpe.py @@ -80,6 +80,8 @@ class TestVxlanGpe(BridgeDomain, VppTestCase): # Verify UDP destination port is VXLAN-GPE 4790, source UDP port # could be arbitrary. self.assertEqual(pkt[UDP].dport, type(self).dport) + # Verify UDP checksum + self.assert_udp_checksum_valid(pkt) # Verify VNI self.assertEqual(pkt[VXLAN].vni, vni) |