diff options
author | Matus Fabian <matfabia@cisco.com> | 2017-10-04 08:03:56 -0700 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2017-10-09 10:53:40 +0000 |
commit | 87da476db0cd804e11463cc453a2bb41c6808542 (patch) | |
tree | 19bf8317d9d20dd53df96bdb3593b7c905dfcdd5 /src/plugins/nat/nat.c | |
parent | deabc7f731410122c2efb873e8da3c9f68270033 (diff) |
NAT: hairpinning rework (VPP-1003)
Change-Id: I7c6911cd6ac366fe62675fd0ff8b0246a25ea1db
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat.c')
-rw-r--r-- | src/plugins/nat/nat.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c index c2f9586ce7d..8b4f50c76cb 100644 --- a/src/plugins/nat/nat.c +++ b/src/plugins/nat/nat.c @@ -95,6 +95,14 @@ VNET_FEATURE_INIT (ip4_snat_hairpin_src, static) = { .runs_before = VNET_FEATURES ("interface-output"), }; +/* Hook up ip4-local features */ +VNET_FEATURE_INIT (ip4_nat_hairpinning, static) = +{ + .arc_name = "ip4-local", + .node_name = "nat44-hairpinning", + .runs_before = VNET_FEATURES("ip4-local-end-of-arc"), +}; + /* *INDENT-OFF* */ VLIB_PLUGIN_REGISTER () = { @@ -993,7 +1001,11 @@ int snat_interface_add_del (u32 sw_if_index, u8 is_inside, int is_del) /* Add/delete external addresses to FIB */ fib: if (is_inside) - return 0; + { + vnet_feature_enable_disable ("ip4-local", "nat44-hairpinning", + sw_if_index, !is_del, 0, 0); + return 0; + } vec_foreach (ap, sm->addresses) snat_add_del_addr_to_fib(&ap->addr, 32, sw_if_index, !is_del); |