summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat.h
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-09-04 02:17:18 -0700
committerOle Trøan <otroan@employees.org>2017-09-06 08:49:25 +0000
commit704018cf117b6667f08b09d6db5fbec105bf6d57 (patch)
tree27a52337f4b5f35092a422290998f7c37b4071f7 /src/plugins/nat/nat.h
parent030ab4815f777d6a0fdbfbc457e0f55fc32df8d3 (diff)
NAT: Destination NAT44 with load-balancing (VPP-954)
added load-balancing static mappings with unequal load support Change-Id: Ie505e41f24d46f812b94dd28bdafe3dc170a6060 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat.h')
-rw-r--r--src/plugins/nat/nat.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/plugins/nat/nat.h b/src/plugins/nat/nat.h
index 04c466dc6f5..8935144dd54 100644
--- a/src/plugins/nat/nat.h
+++ b/src/plugins/nat/nat.h
@@ -62,12 +62,13 @@ typedef struct {
ip4_address_t l_addr;
ip4_address_t r_addr;
u32 fib_index;
+ u16 l_port;
u8 proto;
- u8 rsvd[3];
+ u8 rsvd;
};
u64 as_u64[2];
};
-} snat_unk_proto_ses_key_t;
+} nat_ed_ses_key_t;
typedef struct {
union
@@ -139,6 +140,7 @@ typedef enum {
#define SNAT_SESSION_FLAG_STATIC_MAPPING 1
#define SNAT_SESSION_FLAG_UNKNOWN_PROTO 2
+#define SNAT_SESSION_FLAG_LOAD_BALANCING 4
typedef CLIB_PACKED(struct {
snat_session_key_t out2in; /* 0-15 */
@@ -206,6 +208,13 @@ typedef struct {
} snat_det_map_t;
typedef struct {
+ ip4_address_t addr;
+ u16 port;
+ u8 probability;
+ u8 prefix;
+} nat44_lb_addr_port_t;
+
+typedef struct {
ip4_address_t local_addr;
ip4_address_t external_addr;
u16 local_port;
@@ -214,6 +223,7 @@ typedef struct {
u32 vrf_id;
u32 fib_index;
snat_protocol_t proto;
+ nat44_lb_addr_port_t *locals;
} snat_static_mapping_t;
typedef struct {
@@ -264,9 +274,9 @@ typedef struct snat_main_s {
clib_bihash_8_8_t out2in;
clib_bihash_8_8_t in2out;
- /* Unknown protocol sessions lookup tables */
- clib_bihash_16_8_t out2in_unk_proto;
- clib_bihash_16_8_t in2out_unk_proto;
+ /* Endpoint address dependent sessions lookup tables */
+ clib_bihash_16_8_t out2in_ed;
+ clib_bihash_16_8_t in2out_ed;
/* Find-a-user => src address lookup */
clib_bihash_8_8_t user_hash;
@@ -496,6 +506,9 @@ int snat_interface_add_del_output_feature(u32 sw_if_index, u8 is_inside,
int snat_add_interface_address(snat_main_t *sm, u32 sw_if_index, int is_del);
uword unformat_snat_protocol(unformat_input_t * input, va_list * args);
u8 * format_snat_protocol(u8 * s, va_list * args);
+int nat44_add_del_lb_static_mapping (ip4_address_t e_addr, u16 e_port,
+ snat_protocol_t proto, u32 vrf_id,
+ nat44_lb_addr_port_t *locals, u8 is_add);
static_always_inline u8
icmp_is_error_message (icmp46_header_t * icmp)