mpls: Fix the fragmentation in mpls-output.
Type: fix
the MTU needs to be adjusted to account for the label stack, since the size of fragments produced is stack+mtu.
these changes are to the use of the stack variable 'mtu'
most of the patch results from appeasing checkstyle.
@@ -411,6 +411,7 @@ mpls_frag (vlib_main_t * vm,
u32 pi0, adj_index0;
ip_frag_error_t error0 = IP_FRAG_ERROR_NONE;
i16 encap_size;
+ u16 mtu;
u8 is_ip4;
pi0 = to_next[0] = from[0];
@@ -421,25 +422,21 @@ mpls_frag (vlib_main_t * vm,
adj_index0 = vnet_buffer (p0)->ip.adj_index[VLIB_TX];
adj0 = adj_get (adj_index0);
-
/* the size of the MPLS stack */
encap_size = vnet_buffer (p0)->l3_hdr_offset - p0->current_data;
+ mtu = adj0->rewrite_header.max_l3_packet_bytes - encap_size;
/* IP fragmentation */
if (is_ip4)
- error0 = ip4_frag_do_fragment (vm, pi0,
- adj0->rewrite_header.max_l3_packet_bytes,
- encap_size, &frags);
+ error0 = ip4_frag_do_fragment (vm, pi0, mtu, encap_size, &frags);
else
- error0 = ip6_frag_do_fragment (vm, pi0,
- adj0->rewrite_header.max_l3_packet_bytes,
- encap_size, &frags);
+ error0 = ip6_frag_do_fragment (vm, pi0, mtu, encap_size, &frags);
if (PREDICT_FALSE (p0->flags & VLIB_BUFFER_IS_TRACED))
{
mpls_frag_trace_t *tr =
vlib_add_trace (vm, node, p0, sizeof (*tr));
- tr->mtu = adj0->rewrite_header.max_l3_packet_bytes;
+ tr->mtu = mtu;
tr->pkt_size = vlib_buffer_length_in_chain (vm, p0);
}
@@ -486,9 +483,8 @@ mpls_frag (vlib_main_t * vm,
p0 = vlib_get_buffer (vm, i);
p0->error = error_node->errors[error0];
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
- to_next, n_left_to_next, i,
- next0);
+ vlib_validate_buffer_enqueue_x1 (
+ vm, node, next_index, to_next, n_left_to_next, i, next0);
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
vlib_get_next_frame (vm, node, next_index, to_next,
