diff options
author | Florin Coras <fcoras@cisco.com> | 2017-03-07 01:20:52 -0800 |
---|---|---|
committer | John Lo <loj@cisco.com> | 2017-03-07 21:40:24 +0000 |
commit | a0b34a74a916eff88f9a8354c78a2cf9798c8578 (patch) | |
tree | 5ef5596d68570a5fa7691071ddd39f2f3275e52b /src/vnet/tcp/tcp.c | |
parent | f7f2a9feaa2cad8313afba53b53c32f1928f664c (diff) |
Register TCP with IP only if session is enabled
Change-Id: I73154179e78aeae5f879125237bce593d0978fae
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp/tcp.c')
-rw-r--r-- | src/vnet/tcp/tcp.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index e5feaeb1e03..69433e26a8c 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -633,18 +633,15 @@ tcp_initialize_timer_wheels (tcp_main_t * tm) } clib_error_t * -tcp_init (vlib_main_t * vm) +tcp_main_enable (vlib_main_t * vm) { - ip_main_t *im = &ip_main; - ip_protocol_info_t *pi; tcp_main_t *tm = vnet_get_tcp_main (); + ip_protocol_info_t *pi; + ip_main_t *im = &ip_main; vlib_thread_main_t *vtm = vlib_get_thread_main (); clib_error_t *error = 0; u32 num_threads; - tm->vlib_main = vm; - tm->vnet_main = vnet_get_main (); - if ((error = vlib_call_init_function (vm, ip_main_init))) return error; if ((error = vlib_call_init_function (vm, ip4_lookup_init))) @@ -697,6 +694,36 @@ tcp_init (vlib_main_t * vm) return error; } +clib_error_t * +vnet_tcp_enable_disable (vlib_main_t * vm, u8 is_en) +{ + if (is_en) + { + if (tcp_main.is_enabled) + return 0; + + return tcp_main_enable (vm); + } + else + { + tcp_main.is_enabled = 0; + } + + return 0; +} + +clib_error_t * +tcp_init (vlib_main_t * vm) +{ + tcp_main_t *tm = vnet_get_tcp_main (); + + tm->vlib_main = vm; + tm->vnet_main = vnet_get_main (); + tm->is_enabled = 0; + + return 0; +} + VLIB_INIT_FUNCTION (tcp_init); /* |