diff options
author | Maxime Peim <mpeim@cisco.com> | 2024-03-21 16:01:50 +0100 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2024-03-22 10:15:55 +0000 |
commit | e1195861386e5344a653782cad772a5d1f596228 (patch) | |
tree | bfc62798c79da48e3e3f5f1904308c31a248a0fd | |
parent | 5bd96b7733c82c074216c0e9fe78bedc54d86eb5 (diff) |
mss_clamp: fix next layer in ipv6
Type: fix
Change-Id: I06d56e6d4be2e728e13053a66273a71656ac14c4
Signed-off-by: Maxime Peim <mpeim@cisco.com>
-rw-r--r-- | src/plugins/mss_clamp/mss_clamp_node.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/plugins/mss_clamp/mss_clamp_node.c b/src/plugins/mss_clamp/mss_clamp_node.c index 7c403b129b2..de00a5a8094 100644 --- a/src/plugins/mss_clamp/mss_clamp_node.c +++ b/src/plugins/mss_clamp/mss_clamp_node.c @@ -182,17 +182,15 @@ mssc_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, { ip6_header_t *ip0 = (ip6_header_t *) h0; ip6_header_t *ip1 = (ip6_header_t *) h1; - - if (IP_PROTOCOL_TCP == ip0->protocol) - { - clamped0 = mssc_mss_fixup (b[0], ip6_next_header (ip0), - cm->max_mss6[sw_if_index0]); - } - if (IP_PROTOCOL_TCP == ip1->protocol) - { - clamped1 = mssc_mss_fixup (b[1], ip6_next_header (ip1), - cm->max_mss6[sw_if_index1]); - } + tcp_header_t *tcp0 = + ip6_ext_header_find (vm, b[0], ip0, IP_PROTOCOL_TCP, NULL); + tcp_header_t *tcp1 = + ip6_ext_header_find (vm, b[1], ip1, IP_PROTOCOL_TCP, NULL); + + if (tcp0) + clamped0 = mssc_mss_fixup (b[0], tcp0, cm->max_mss6[sw_if_index0]); + if (tcp1) + clamped1 = mssc_mss_fixup (b[1], tcp1, cm->max_mss6[sw_if_index1]); } pkts_clamped += clamped0 + clamped1; @@ -255,12 +253,11 @@ mssc_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, else if (FIB_PROTOCOL_IP6 == fproto) { ip6_header_t *ip0 = (ip6_header_t *) h0; + tcp_header_t *tcp0 = + ip6_ext_header_find (vm, b[0], ip0, IP_PROTOCOL_TCP, NULL); - if (IP_PROTOCOL_TCP == ip0->protocol) - { - clamped0 = mssc_mss_fixup (b[0], ip6_next_header (ip0), - cm->max_mss6[sw_if_index0]); - } + if (tcp0) + clamped0 = mssc_mss_fixup (b[0], tcp0, cm->max_mss6[sw_if_index0]); } pkts_clamped += clamped0; |