summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip4_forward.c
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-02-09 06:05:16 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-02-12 11:23:33 +0000
commitffd78d1ef8fe80d1b756a71d42d5eadda60ae996 (patch)
tree99770e8773a7c3dd27c8b9b116edb6a39ace09ea /src/vnet/ip/ip4_forward.c
parent2d6f66e1748be190664cbd72c826db32616d759a (diff)
Improve MTU handling
- setting MTU on an interface updates the L3 max bytes too - value cached in the adjacency is also updated - MTU exceeded generates ICMP to sender Change-Id: I343ec71d8e903b529594c4bd0543f04bc7f370b3 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vnet/ip/ip4_forward.c')
-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 ==