FD.io VPP
v18.10-34-gcce845e
Vector Packet Processing
|
NAT plugin client-IP based session affinity for load-balancing. More...
Go to the source code of this file.
Macros | |
#define | AFFINITY_HASH_BUCKETS 65536 |
#define | AFFINITY_HASH_MEMORY (2 << 25) |
Functions | |
u8 * | format_affinity_kvp (u8 *s, va_list *args) |
clib_error_t * | nat_affinity_init (vlib_main_t *vm) |
Initialize NAT client-IP based affinity. More... | |
static_always_inline void | make_affinity_kv (clib_bihash_kv_16_8_t *kv, ip4_address_t client_addr, ip4_address_t service_addr, u8 proto, u16 service_port) |
u32 | nat_affinity_get_per_service_list_head_index (void) |
Get new affinity per service list head index. More... | |
void | nat_affinity_flush_service (u32 affinity_per_service_list_head_index) |
Flush all service affinity data. More... | |
int | nat_affinity_find_and_lock (ip4_address_t client_addr, ip4_address_t service_addr, u8 proto, u16 service_port, u8 *backend_index) |
Find service backend index for client-IP and take a reference counting lock. More... | |
static int | affinity_is_expired_cb (clib_bihash_kv_16_8_t *kv, void *arg) |
int | nat_affinity_create_and_lock (ip4_address_t client_addr, ip4_address_t service_addr, u8 proto, u16 service_port, u8 backend_index, u32 sticky_time, u32 affinity_per_service_list_head_index) |
Create affinity record and take reference counting lock. More... | |
void | nat_affinity_unlock (ip4_address_t client_addr, ip4_address_t service_addr, u8 proto, u16 service_port) |
Release a reference counting lock for affinity. More... | |
Variables | |
nat_affinity_main_t | nat_affinity_main |
NAT plugin client-IP based session affinity for load-balancing.
Definition in file nat_affinity.c.
#define AFFINITY_HASH_BUCKETS 65536 |
Definition at line 25 of file nat_affinity.c.
#define AFFINITY_HASH_MEMORY (2 << 25) |
Definition at line 26 of file nat_affinity.c.
|
static |
Definition at line 168 of file nat_affinity.c.
Definition at line 29 of file nat_affinity.c.
static_always_inline void make_affinity_kv | ( | clib_bihash_kv_16_8_t * | kv, |
ip4_address_t | client_addr, | ||
ip4_address_t | service_addr, | ||
u8 | proto, | ||
u16 | service_port | ||
) |
int nat_affinity_create_and_lock | ( | ip4_address_t | client_addr, |
ip4_address_t | service_addr, | ||
u8 | proto, | ||
u16 | service_port, | ||
u8 | backend_index, | ||
u32 | sticky_time, | ||
u32 | affinity_per_service_list_head_index | ||
) |
Create affinity record and take reference counting lock.
client_addr | Client IP address. |
service_addr | Service IP address. |
proto | IP protocol number. |
service_port | Service L4 port number. |
backend_index | Service backend index for client-IP. |
sticky_time | Affinity sticky time in seconds. |
affinity_per_service_list_head_index | Per sevice list head index. |
Definition at line 191 of file nat_affinity.c.
int nat_affinity_find_and_lock | ( | ip4_address_t | client_addr, |
ip4_address_t | service_addr, | ||
u8 | proto, | ||
u16 | service_port, | ||
u8 * | backend_index | ||
) |
Find service backend index for client-IP and take a reference counting lock.
client_addr | Client IP address. |
service_addr | Service IP address. |
proto | IP protocol number. |
service_port | Service L4 port number. |
backend_index | Service backend index for client-IP if found. |
Definition at line 127 of file nat_affinity.c.
void nat_affinity_flush_service | ( | u32 | affinity_per_service_list_head_index | ) |
Flush all service affinity data.
affinity_per_service_list_head_index | Per sevice list head index. |
Definition at line 97 of file nat_affinity.c.
u32 nat_affinity_get_per_service_list_head_index | ( | void | ) |
Get new affinity per service list head index.
Definition at line 81 of file nat_affinity.c.
clib_error_t* nat_affinity_init | ( | vlib_main_t * | vm | ) |
Initialize NAT client-IP based affinity.
vm | vlib main. |
Definition at line 47 of file nat_affinity.c.
void nat_affinity_unlock | ( | ip4_address_t | client_addr, |
ip4_address_t | service_addr, | ||
u8 | proto, | ||
u16 | service_port | ||
) |
Release a reference counting lock for affinity.
client_addr | Client IP address. |
service_addr | Service IP address. |
proto | IP protocol number. |
Definition at line 242 of file nat_affinity.c.
nat_affinity_main_t nat_affinity_main |
Definition at line 23 of file nat_affinity.c.