FD.io VPP  v20.01-48-g3e0dafb74
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_init (vlib_main_t *vm, nat_ha_sadd_cb_t sadd_cb, nat_ha_sdel_cb_t sdel_cb, nat_ha_sref_cb_t sref_cb)
 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 145 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_flush()

void nat_ha_flush ( u8  is_resync)

Flush the current HA data (for testing)

Definition at line 682 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 410 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 385 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 824 of file nat_ha.c.

+ Here is the caller graph for this function:

◆ nat_ha_init()

void nat_ha_init ( vlib_main_t vm,
nat_ha_sadd_cb_t  sadd_cb,
nat_ha_sdel_cb_t  sdel_cb,
nat_ha_sref_cb_t  sref_cb 
)

Initialize NAT HA.

Definition at line 313 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)

+ 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 689 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 715 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 395 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 352 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 734 of file nat_ha.c.

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