diff options
author | Matus Fabian <matfabia@cisco.com> | 2018-06-13 05:39:07 -0700 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2018-06-15 06:53:24 +0000 |
commit | a6110b6ea5a066b64005347850f61df9a2000fe9 (patch) | |
tree | e8c836dadfe7238592ef5baaabc9cf520c5e813f /src/plugins/nat/nat_inlines.h | |
parent | e43832c7e77b8b008ab452386b143bb3f7f5be40 (diff) |
NAT44: endpoint dependent mode (VPP-1273)
To enable NAT plugin endpoint dependent mode add following to statrup config:
nat { endpoint-dependent }
Enable endpoint dependent filtering and mapping for all sessions.
Move some existing functionality such as service load balancing, twice nat,
out2in-only static mappings and unknown protocol dynamic translations, which
use endpoint dependent lookup hash tables before. Basically split to vanilla
NAT44 and extra features NAT44.
Change-Id: I3925eb5ddcc8f1ec4cf6af4e2a618a7ec7aa9735
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat_inlines.h')
-rw-r--r-- | src/plugins/nat/nat_inlines.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/plugins/nat/nat_inlines.h b/src/plugins/nat/nat_inlines.h index db5b295f938..3724986b9b8 100644 --- a/src/plugins/nat/nat_inlines.h +++ b/src/plugins/nat/nat_inlines.h @@ -239,6 +239,38 @@ nat44_session_update_lru (snat_main_t * sm, snat_session_t * s, s->per_user_list_head_index, s->per_user_index); } +always_inline void +make_ed_kv (clib_bihash_kv_16_8_t * kv, ip4_address_t * l_addr, + ip4_address_t * r_addr, u8 proto, u32 fib_index, u16 l_port, + u16 r_port) +{ + nat_ed_ses_key_t *key = (nat_ed_ses_key_t *) kv->key; + + key->l_addr.as_u32 = l_addr->as_u32; + key->r_addr.as_u32 = r_addr->as_u32; + key->fib_index = fib_index; + key->proto = proto; + key->l_port = l_port; + key->r_port = r_port; + + kv->value = ~0ULL; +} + +always_inline void +make_sm_kv (clib_bihash_kv_8_8_t * kv, ip4_address_t * addr, u8 proto, + u32 fib_index, u16 port) +{ + snat_session_key_t key; + + key.addr.as_u32 = addr->as_u32; + key.port = port; + key.protocol = proto; + key.fib_index = fib_index; + + kv->key = key.as_u64; + kv->value = ~0ULL; +} + #endif /* __included_nat_inlines_h__ */ /* |