summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/mpls/mpls_output.c7
-rw-r--r--test/test_ip4.py1
-rw-r--r--test/test_mpls.py10
3 files changed, 11 insertions, 7 deletions
diff --git a/src/vnet/mpls/mpls_output.c b/src/vnet/mpls/mpls_output.c
index faeba748e89..d606360ce9e 100644
--- a/src/vnet/mpls/mpls_output.c
+++ b/src/vnet/mpls/mpls_output.c
@@ -470,14 +470,13 @@ mpls_frag (vlib_main_t * vm,
icmp4_error_set_vnet_buffer (
p0, ICMP4_destination_unreachable,
ICMP4_destination_unreachable_fragmentation_needed_and_dont_fragment_set,
- vnet_buffer (p0)->ip_frag.mtu);
+ mtu);
next0 = MPLS_FRAG_NEXT_ICMP4_ERROR;
}
else
{
- icmp6_error_set_vnet_buffer (
- p0, ICMP6_packet_too_big, 0,
- adj0->rewrite_header.max_l3_packet_bytes);
+ icmp6_error_set_vnet_buffer (p0, ICMP6_packet_too_big,
+ 0, mtu);
next0 = MPLS_FRAG_NEXT_ICMP6_ERROR;
}
}
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 873a38a22be..fb9b8faa769 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -1977,6 +1977,7 @@ class TestIPInput(VppTestCase):
self.assertEqual(icmptypes[icmp.type], "dest-unreach")
self.assertEqual(icmpcodes[icmp.type][icmp.code],
"fragmentation-needed")
+ self.assertEqual(icmp.nexthopmtu, 1500)
self.assertEqual(icmp.src, self.pg0.remote_ip4)
self.assertEqual(icmp.dst, self.pg1.remote_ip4)
diff --git a/test/test_mpls.py b/test/test_mpls.py
index d94676b67da..a568f849aed 100644
--- a/test/test_mpls.py
+++ b/test/test_mpls.py
@@ -17,7 +17,7 @@ from vpp_papi import VppEnum
import scapy.compat
from scapy.packet import Raw
from scapy.layers.l2 import Ether, ARP
-from scapy.layers.inet import IP, UDP, ICMP
+from scapy.layers.inet import IP, UDP, ICMP, icmptypes, icmpcodes
from scapy.layers.inet6 import IPv6, ICMPv6TimeExceeded, ICMPv6EchoRequest, \
ICMPv6PacketTooBig
from scapy.contrib.mpls import MPLS
@@ -961,7 +961,11 @@ class TestMPLS(VppTestCase):
rxs = self.send_and_expect_some(self.pg0, tx, self.pg0)
for rx in rxs:
- rx[ICMP].code = "fragmentation-needed"
+ self.assertEqual(icmptypes[rx[ICMP].type], "dest-unreach")
+ self.assertEqual(icmpcodes[rx[ICMP].type][rx[ICMP].code],
+ "fragmentation-needed")
+ # the link MTU is 9000, the MPLS over head is 4 bytes
+ self.assertEqual(rx[ICMP].nexthopmtu, 9000 - 4)
self.assertEqual(self.statistics.get_err_counter(
"/err/mpls-frag/can't fragment this packet"),
@@ -976,7 +980,7 @@ class TestMPLS(VppTestCase):
rxs = self.send_and_expect_some(self.pg0, tx, self.pg0)
for rx in rxs:
- rx[ICMPv6PacketTooBig].mtu = 9000
+ self.assertEqual(rx[ICMPv6PacketTooBig].mtu, 9000 - 4)
#
# cleanup