FD.io VPP  v21.01.1
Vector Packet Processing
nat_ha.h File Reference

NAT active-passive HA. More...

+ Include dependency graph for nat_ha.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* nat_ha_sadd_cb_t) (ip4_address_t *in_addr, u16 in_port, ip4_address_t *out_addr, u16 out_port, ip4_address_t *eh_addr, u16 eh_port, ip4_address_t *ehn_addr, u16 ehn_port, u8 proto, u32 fib_index, u16 flags, u32 thread_index)
 
typedef void(* nat_ha_sdel_cb_t) (ip4_address_t *out_addr, u16 out_port, ip4_address_t *eh_addr, u16 eh_port, u8 proto, u32 fib_index, u32 thread_index)
 
typedef void(* nat_ha_sref_cb_t) (ip4_address_t *out_addr, u16 out_port, ip4_address_t *eh_addr, u16 eh_port, u8 proto, u32 fib_index, u32 total_pkts, u64 total_bytes, u32 thread_index)
 
typedef void(* nat_ha_resync_event_cb_t) (u32 client_index, u32 pid, u32 missed_count)
 

Functions

void nat_ha_enable (nat_ha_sadd_cb_t sadd_cb, nat_ha_sdel_cb_t sdel_cb, nat_ha_sref_cb_t sref_cb)
 Enable NAT HA, set callbacks. More...
 
void nat_ha_disable ()
 Disable NAT HA. More...
 
void nat_ha_init (vlib_main_t *vm, u32 num_workers, u32 num_threads)
 Initialize NAT HA. More...
 
int nat_ha_set_listener (ip4_address_t *addr, u16 port, u32 path_mtu)
 Set HA listener (local settings) More...
 
void nat_ha_get_listener (ip4_address_t *addr, u16 *port, u32 *path_mtu)
 Get HA listener/local configuration. More...
 
int nat_ha_set_failover (ip4_address_t *addr, u16 port, u32 session_refresh_interval)
 Set HA failover (remote settings) More...
 
void nat_ha_get_failover (ip4_address_t *addr, u16 *port, u32 *session_refresh_interval)
 Get HA failover/remote settings. More...
 
void nat_ha_sadd (ip4_address_t *in_addr, u16 in_port, ip4_address_t *out_addr, u16 out_port, ip4_address_t *eh_addr, u16 eh_port, ip4_address_t *ehn_addr, u16 ehn_port, u8 proto, u32 fib_index, u16 flags, u32 thread_index, u8 is_resync)
 Create session add HA event. More...
 
void nat_ha_sdel (ip4_address_t *out_addr, u16 out_port, ip4_address_t *eh_addr, u16 eh_port, u8 proto, u32 fib_index, u32 thread_index)
 Create session delete HA event. More...
 
void nat_ha_sref (ip4_address_t *out_addr, u16 out_port, ip4_address_t *eh_addr, u16 eh_port, u8 proto, u32 fib_index, u32 total_pkts, u64 total_bytes, u32 thread_index, f64 *last_refreshed, f64 now)
 Create session refresh HA event. More...
 
void nat_ha_flush (u8 is_resync)
 Flush the current HA data (for testing) More...
 
int nat_ha_resync (u32 client_index, u32 pid, nat_ha_resync_event_cb_t event_callback)
 Resync HA (resend existing sessions to new failover) More...
 
void nat_ha_get_resync_status (u8 *in_resync, u32 *resync_ack_missed)
 Get resync status. More...
 

Detailed Description

NAT active-passive HA.

Definition in file nat_ha.h.

Typedef Documentation

◆ nat_ha_resync_event_cb_t

typedef void(* nat_ha_resync_event_cb_t) (u32 client_index, u32 pid, u32 missed_count)

Definition at line 155 of file nat_ha.h.

◆ nat_ha_sadd_cb_t

typedef void(* nat_ha_sadd_cb_t) (ip4_address_t *in_addr, u16 in_port, ip4_address_t *out_addr, u16 out_port, ip4_address_t *eh_addr, u16 eh_port, ip4_address_t *ehn_addr, u16 ehn_port, u8 proto, u32 fib_index, u16 flags, u32 thread_index)

Definition at line 27 of file nat_ha.h.

◆ nat_ha_sdel_cb_t

typedef void(* nat_ha_sdel_cb_t) (ip4_address_t *out_addr, u16 out_port, ip4_address_t *eh_addr, u16 eh_port, u8 proto, u32 fib_index, u32 thread_index)

Definition at line 33 of file nat_ha.h.

◆ nat_ha_sref_cb_t

typedef void(* nat_ha_sref_cb_t) (ip4_address_t *out_addr, u16 out_port, ip4_address_t *eh_addr, u16 eh_port, u8 proto, u32 fib_index, u32 total_pkts, u64 total_bytes, u32 thread_index)

Definition at line 36 of file nat_ha.h.

Function Documentation

◆ nat_ha_disable()

void nat_ha_disable ( )

Disable NAT HA.

Definition at line 327 of file nat_ha.c.

+ Here is the caller graph for this function:

◆ nat_ha_enable()

void nat_ha_enable ( nat_ha_sadd_cb_t  sadd_cb,
nat_ha_sdel_cb_t  sdel_cb,
nat_ha_sref_cb_t  sref_cb 
)

Enable NAT HA, set callbacks.

Definition at line 314 of file nat_ha.c.

+ Here is the caller graph for this function:

◆ nat_ha_flush()

void nat_ha_flush ( u8  is_resync)

Flush the current HA data (for testing)

Definition at line 685 of file nat_ha.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_ha_get_failover()

void nat_ha_get_failover ( ip4_address_t addr,
u16 port,
u32 session_refresh_interval 
)

Get HA failover/remote settings.

Definition at line 413 of file nat_ha.c.

+ Here is the caller graph for this function:

◆ nat_ha_get_listener()

void nat_ha_get_listener ( ip4_address_t addr,
u16 port,
u32 path_mtu 
)

Get HA listener/local configuration.

Definition at line 388 of file nat_ha.c.

+ Here is the caller graph for this function:

◆ nat_ha_get_resync_status()

void nat_ha_get_resync_status ( u8 in_resync,
u32 resync_ack_missed 
)

Get resync status.

Parameters
in_resync1 if resync in progress
resync_ack_missednumber of missed (not ACKed) messages

Definition at line 838 of file nat_ha.c.

+ Here is the caller graph for this function:

◆ nat_ha_init()

void nat_ha_init ( vlib_main_t vm,
u32  num_workers,
u32  num_threads 
)

Initialize NAT HA.

Definition at line 335 of file nat_ha.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_ha_resync()

int nat_ha_resync ( u32  client_index,
u32  pid,
nat_ha_resync_event_cb_t  event_callback 
)

Resync HA (resend existing sessions to new failover)

Definition at line 1142 of file nat_ha.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_ha_sadd()

void nat_ha_sadd ( ip4_address_t in_addr,
u16  in_port,
ip4_address_t out_addr,
u16  out_port,
ip4_address_t eh_addr,
u16  eh_port,
ip4_address_t ehn_addr,
u16  ehn_port,
u8  proto,
u32  fib_index,
u16  flags,
u32  thread_index,
u8  is_resync 
)

Create session add HA event.

Parameters
in_addrinside IPv4 address
in_portinside L4 port number
out_addroutside IPv4 address
out_portoutside L4 port number
eh_addrexternal host IPv4 address
eh_portexternal host L4 port number
ehn_addrexternal host IPv4 address after translation
ehn_portexternal host L4 port number after translation
protoL4 protocol
fib_indexfib index
flagssession flags
thread_indexthread index
is_resync1 if HA resync

Definition at line 692 of file nat_ha.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_ha_sdel()

void nat_ha_sdel ( ip4_address_t out_addr,
u16  out_port,
ip4_address_t eh_addr,
u16  eh_port,
u8  proto,
u32  fib_index,
u32  thread_index 
)

Create session delete HA event.

Parameters
out_addroutside IPv4 address
out_portoutside L4 port number
eh_addrexternal host IPv4 address
eh_portexternal host L4 port number
protoL4 protocol
fib_indexfib index
thread_indexthread index

Definition at line 718 of file nat_ha.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_ha_set_failover()

int nat_ha_set_failover ( ip4_address_t addr,
u16  port,
u32  session_refresh_interval 
)

Set HA failover (remote settings)

Parameters
addrfailover IP4 address
portfailvoer UDP port number
session_refresh_intervalnumber of seconds after which to send session counters refresh
Returns
0 on success, non-zero value otherwise.

Definition at line 398 of file nat_ha.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_ha_set_listener()

int nat_ha_set_listener ( ip4_address_t addr,
u16  port,
u32  path_mtu 
)

Set HA listener (local settings)

Parameters
addrlocal IP4 address
portlocal UDP port number
path_mtupath MTU between local and failover
Returns
0 on success, non-zero value otherwise.

Definition at line 355 of file nat_ha.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_ha_sref()

void nat_ha_sref ( ip4_address_t out_addr,
u16  out_port,
ip4_address_t eh_addr,
u16  eh_port,
u8  proto,
u32  fib_index,
u32  total_pkts,
u64  total_bytes,
u32  thread_index,
f64 last_refreshed,
f64  now 
)

Create session refresh HA event.

Parameters
out_addroutside IPv4 address
out_portoutside L4 port number
eh_addrexternal host IPv4 address
eh_portexternal host L4 port number
protoL4 protocol
fib_indexfib index
total_pktstotal packets processed
total_bytestotal bytes processed
thread_indexthread index
last_refreshedlast session refresh time
nowcurrent time

Definition at line 737 of file nat_ha.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: