aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat_inlines.h
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2020-06-03 11:47:55 +0200
committerOle Troan <ot@cisco.com>2020-06-03 11:48:50 +0200
commitec62d0a436be00bcc084a56548c8c7fa55b2cb61 (patch)
treeb80ef1eb7340165c0cabf348198e0084c36990f4 /src/plugins/nat/nat_inlines.h
parentbe360ee4d7d34954bd93ed852c9d7bf9109ce6fb (diff)
nat: refactor mss_clamping to not depend on snat_main_t
Type: refactor Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I1110e425859a4f1f07952c91b50f263cb7323836
Diffstat (limited to 'src/plugins/nat/nat_inlines.h')
-rw-r--r--src/plugins/nat/nat_inlines.h48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/plugins/nat/nat_inlines.h b/src/plugins/nat/nat_inlines.h
index 121d2c71aaa..4dad11bed72 100644
--- a/src/plugins/nat/nat_inlines.h
+++ b/src/plugins/nat/nat_inlines.h
@@ -657,54 +657,6 @@ get_icmp_o2i_ed_key (vlib_buffer_t * b, ip4_header_t * ip0, u32 rx_fib_index,
return 0;
}
-always_inline void
-mss_clamping (snat_main_t * sm, tcp_header_t * tcp, ip_csum_t * sum)
-{
- u8 *data;
- u8 opt_len, opts_len, kind;
- u16 mss;
-
- if (!(sm->mss_clamping && tcp_syn (tcp)))
- return;
-
- opts_len = (tcp_doff (tcp) << 2) - sizeof (tcp_header_t);
- data = (u8 *) (tcp + 1);
- for (; opts_len > 0; opts_len -= opt_len, data += opt_len)
- {
- kind = data[0];
-
- if (kind == TCP_OPTION_EOL)
- break;
- else if (kind == TCP_OPTION_NOOP)
- {
- opt_len = 1;
- continue;
- }
- else
- {
- if (opts_len < 2)
- return;
- opt_len = data[1];
-
- if (opt_len < 2 || opt_len > opts_len)
- return;
- }
-
- if (kind == TCP_OPTION_MSS)
- {
- mss = *(u16 *) (data + 2);
- if (clib_net_to_host_u16 (mss) > sm->mss_clamping)
- {
- *sum =
- ip_csum_update (*sum, mss, sm->mss_value_net, ip4_header_t,
- length);
- clib_memcpy_fast (data + 2, &sm->mss_value_net, 2);
- }
- return;
- }
- }
-}
-
/**
* @brief Check if packet should be translated
*