aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip4_forward.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index ae4510626d0..b9875d72b8e 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -2109,16 +2109,26 @@ ip4_rewrite_inline (vlib_main_t * vm,
vnet_buffer (p1)->ip.save_rewrite_length = rw_len1;
/* Check MTU of outgoing interface. */
- error0 =
- (vlib_buffer_length_in_chain (vm, p0) >
- adj0[0].
- rewrite_header.max_l3_packet_bytes ? IP4_ERROR_MTU_EXCEEDED :
- error0);
- error1 =
- (vlib_buffer_length_in_chain (vm, p1) >
- adj1[0].
- rewrite_header.max_l3_packet_bytes ? IP4_ERROR_MTU_EXCEEDED :
- error1);
+ if (vlib_buffer_length_in_chain (vm, p0) >
+ adj0[0].rewrite_header.max_l3_packet_bytes)
+ {
+ error0 = IP4_ERROR_MTU_EXCEEDED;
+ next0 = IP4_REWRITE_NEXT_ICMP_ERROR;
+ icmp4_error_set_vnet_buffer
+ (p0, ICMP4_destination_unreachable,
+ ICMP4_destination_unreachable_fragmentation_needed_and_dont_fragment_set,
+ 0);
+ }
+ if (vlib_buffer_length_in_chain (vm, p1) >
+ adj1[0].rewrite_header.max_l3_packet_bytes)
+ {
+ error1 = IP4_ERROR_MTU_EXCEEDED;
+ next1 = IP4_REWRITE_NEXT_ICMP_ERROR;
+ icmp4_error_set_vnet_buffer
+ (p1, ICMP4_destination_unreachable,
+ ICMP4_destination_unreachable_fragmentation_needed_and_dont_fragment_set,
+ 0);
+ }
if (is_mcast)
{
@@ -2290,9 +2300,16 @@ ip4_rewrite_inline (vlib_main_t * vm,
vlib_buffer_length_in_chain (vm, p0) + rw_len0);
/* Check MTU of outgoing interface. */
- error0 = (vlib_buffer_length_in_chain (vm, p0)
- > adj0[0].rewrite_header.max_l3_packet_bytes
- ? IP4_ERROR_MTU_EXCEEDED : error0);
+ if (vlib_buffer_length_in_chain (vm, p0) >
+ adj0[0].rewrite_header.max_l3_packet_bytes)
+ {
+ error0 = IP4_ERROR_MTU_EXCEEDED;
+ next0 = IP4_REWRITE_NEXT_ICMP_ERROR;
+ icmp4_error_set_vnet_buffer
+ (p0, ICMP4_destination_unreachable,
+ ICMP4_destination_unreachable_fragmentation_needed_and_dont_fragment_set,
+ 0);
+ }
if (is_mcast)
{
error0 = ((adj0[0].rewrite_header.sw_if_index ==