diff options
author | Filip Varga <fivarga@cisco.com> | 2022-01-18 13:17:07 -0800 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2022-02-01 12:09:17 +0000 |
commit | 53cee1579eb0bee09142a26285461638a796e99d (patch) | |
tree | 1c56c7b374e6d31cf7126b5d4cc1b016ccf52d68 /src/plugins/nat/nat44-ei/nat44_ei.c | |
parent | ca5f6b851daf1ca7c0c0640267f8fb1429bdd563 (diff) |
nat: nat44-ei hairpinning code cleanup
Removing obsolete unused nat44-ei nodes and functions.
Type: refactor
Change-Id: I1e03e283091c3c0d92908d04037cba00a348351a
Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat44-ei/nat44_ei.c')
-rw-r--r-- | src/plugins/nat/nat44-ei/nat44_ei.c | 49 |
1 files changed, 11 insertions, 38 deletions
diff --git a/src/plugins/nat/nat44-ei/nat44_ei.c b/src/plugins/nat/nat44-ei/nat44_ei.c index 7336a95408b..10b04ce6d71 100644 --- a/src/plugins/nat/nat44-ei/nat44_ei.c +++ b/src/plugins/nat/nat44-ei/nat44_ei.c @@ -40,7 +40,6 @@ nat44_ei_main_t nat44_ei_main; extern vlib_node_registration_t nat44_ei_hairpinning_node; -extern vlib_node_registration_t nat44_ei_hairpin_dst_node; extern vlib_node_registration_t nat44_ei_in2out_hairpinning_finish_ip4_lookup_node; extern vlib_node_registration_t @@ -111,31 +110,6 @@ VNET_FEATURE_INIT (ip4_nat44_ei_in2out_output, static) = { .runs_after = VNET_FEATURES ("acl-plugin-out-ip4-fa", "ip4-sv-reassembly-output-feature"), }; -VNET_FEATURE_INIT (ip4_nat44_ei_in2out_fast, static) = { - .arc_name = "ip4-unicast", - .node_name = "nat44-ei-in2out-fast", - .runs_after = VNET_FEATURES ("acl-plugin-in-ip4-fa", - "ip4-sv-reassembly-feature"), -}; -VNET_FEATURE_INIT (ip4_nat44_ei_out2in_fast, static) = { - .arc_name = "ip4-unicast", - .node_name = "nat44-ei-out2in-fast", - .runs_after = VNET_FEATURES ("acl-plugin-in-ip4-fa", - "ip4-sv-reassembly-feature", - "ip4-dhcp-client-detect"), -}; -VNET_FEATURE_INIT (ip4_nat44_ei_hairpin_dst, static) = { - .arc_name = "ip4-unicast", - .node_name = "nat44-ei-hairpin-dst", - .runs_after = VNET_FEATURES ("acl-plugin-in-ip4-fa", - "ip4-sv-reassembly-feature"), -}; -VNET_FEATURE_INIT (ip4_nat44_ei_hairpin_src, static) = { - .arc_name = "ip4-output", - .node_name = "nat44-ei-hairpin-src", - .runs_after = VNET_FEATURES ("acl-plugin-out-ip4-fa", - "ip4-sv-reassembly-output-feature"), -}; VNET_FEATURE_INIT (ip4_nat44_ei_hairpinning, static) = { .arc_name = "ip4-local", .node_name = "nat44-ei-hairpinning", @@ -482,8 +456,6 @@ nat44_ei_init (vlib_main_t *vm) nm->hairpinning_fq_index = vlib_frame_queue_main_init (nat44_ei_hairpinning_node.index, 0); - nm->hairpin_dst_fq_index = - vlib_frame_queue_main_init (nat44_ei_hairpin_dst_node.index, 0); nm->in2out_hairpinning_finish_ip4_lookup_node_fq_index = vlib_frame_queue_main_init ( nat44_ei_in2out_hairpinning_finish_ip4_lookup_node.index, 0); @@ -546,8 +518,6 @@ nat44_ei_plugin_enable (nat44_ei_config_t c) nm->user_buckets); nat44_ei_set_alloc_default (); - // TODO: zero simple counter for all counters missing - vlib_zero_simple_counter (&nm->total_users, 0); vlib_zero_simple_counter (&nm->total_sessions, 0); vlib_zero_simple_counter (&nm->user_limit_reached, 0); @@ -605,6 +575,13 @@ nat44_ei_get_interface (nat44_ei_interface_t *interfaces, u32 sw_if_index) return 0; } +static_always_inline int +nat44_ei_hairpinning_enable (u32 sw_if_index, u8 is_enable) +{ + return vnet_feature_enable_disable ("ip4-local", "nat44-ei-hairpinning", + sw_if_index, is_enable, 0, 0); +} + int nat44_ei_add_interface (u32 sw_if_index, u8 is_inside) { @@ -671,8 +648,7 @@ nat44_ei_add_interface (u32 sw_if_index, u8 is_inside) } if (!is_inside) { - rv = vnet_feature_enable_disable ( - "ip4-local", "nat44-ei-hairpinning", sw_if_index, 0, 0, 0); + rv = nat44_ei_hairpinning_enable (sw_if_index, 0); if (rv) { return rv; @@ -705,8 +681,7 @@ nat44_ei_add_interface (u32 sw_if_index, u8 is_inside) } if (is_inside && !nm->out2in_dpo) { - rv = vnet_feature_enable_disable ( - "ip4-local", "nat44-ei-hairpinning", sw_if_index, 1, 0, 0); + rv = nat44_ei_hairpinning_enable (sw_if_index, 1); if (rv) { return rv; @@ -811,8 +786,7 @@ nat44_ei_del_interface (u32 sw_if_index, u8 is_inside) } else { - rv = vnet_feature_enable_disable ( - "ip4-local", "nat44-ei-hairpinning", sw_if_index, 1, 0, 0); + rv = nat44_ei_hairpinning_enable (sw_if_index, 1); if (rv) { return rv; @@ -845,8 +819,7 @@ nat44_ei_del_interface (u32 sw_if_index, u8 is_inside) } if (is_inside) { - rv = vnet_feature_enable_disable ( - "ip4-local", "nat44-ei-hairpinning", sw_if_index, 0, 0, 0); + rv = nat44_ei_hairpinning_enable (sw_if_index, 0); if (rv) { return rv; |