FreeBSD kernel IPv4 code
SCTP NAT State Machine

Macros

#define SN_ID   0x0000
 
#define SN_INi   0x0010
 
#define SN_INa   0x0020
 
#define SN_UP   0x0100
 
#define SN_CL   0x1000
 
#define SN_RM   0x2000
 

Functions

static int ProcessSctpMsg (struct libalias *la, int direction, struct sctp_nat_msg *sm, struct sctp_nat_assoc *assoc)
 Process SCTP message. More...
 
static int ID_process (struct libalias *la, int direction, struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm)
 Process SCTP message while in the Idle state. More...
 
static int INi_process (struct libalias *la, int direction, struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm)
 Process SCTP message while waiting for an INIT-ACK message. More...
 
static int INa_process (struct libalias *la, int direction, struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm)
 Process SCTP message while waiting for an AddIp-ACK message. More...
 
static int UP_process (struct libalias *la, int direction, struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm)
 Process SCTP messages while association is UP redirecting packets. More...
 
static int CL_process (struct libalias *la, int direction, struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm)
 Process SCTP message while association is in the process of closing. More...
 

Detailed Description

Defines the various states an association can be within the NAT

The SCTP NAT State Machine functions will:

Macro Definition Documentation

◆ SN_CL

#define SN_CL   0x1000

Closing state

Definition at line 257 of file alias_sctp.c.

◆ SN_ID

#define SN_ID   0x0000

Idle state

Definition at line 253 of file alias_sctp.c.

◆ SN_INa

#define SN_INa   0x0020

Initialising, waiting for AddIpAck state

Definition at line 255 of file alias_sctp.c.

◆ SN_INi

#define SN_INi   0x0010

Initialising, waiting for InitAck state

Definition at line 254 of file alias_sctp.c.

◆ SN_RM

#define SN_RM   0x2000

Removing state

Definition at line 258 of file alias_sctp.c.

◆ SN_UP

#define SN_UP   0x0100

Association in UP state

Definition at line 256 of file alias_sctp.c.

Function Documentation

◆ CL_process()

static int CL_process ( struct libalias la,
int  direction,
struct sctp_nat_assoc assoc,
struct sctp_nat_msg sm 
)
static

Process SCTP message while association is in the process of closing.

This function waits for a SHUT-COMP to close the association. Depending on the setting of sysctl_holddown_timer it may not remove the association immediately, but leave it up until SN_X_T(la). Only SHUT-COMP, SHUT-ACK, and ABORT packets are permitted in this state. All other packets are dropped.

Parameters
laPointer to the relevant libalias instance
directionSN_TO_LOCAL | SN_TO_GLOBAL
smPointer to sctp message information
assocPointer to the association this SCTP Message belongs to
Returns
SN_NAT_PKT | SN_DROP_PKT

Definition at line 1985 of file alias_sctp.c.

Referenced by ProcessSctpMsg().

Here is the caller graph for this function:

◆ ID_process()

static int ID_process ( struct libalias la,
int  direction,
struct sctp_nat_assoc assoc,
struct sctp_nat_msg sm 
)
static

Process SCTP message while in the Idle state.

This function looks for an Incoming INIT or AddIP message.

All other SCTP messages are invalid when in SN_ID, and are dropped.

Parameters
laPointer to the relevant libalias instance
directionSN_TO_LOCAL | SN_TO_GLOBAL
smPointer to sctp message information
assocPointer to the association this SCTP Message belongs to
Returns
SN_NAT_PKT | SN_DROP_PKT | SN_REPLY_ABORT | SN_REPLY_ERROR

Definition at line 1772 of file alias_sctp.c.

Referenced by ProcessSctpMsg().

Here is the caller graph for this function:

◆ INa_process()

static int INa_process ( struct libalias la,
int  direction,
struct sctp_nat_assoc assoc,
struct sctp_nat_msg sm 
)
static

Process SCTP message while waiting for an AddIp-ACK message.

Only an AddIP-ACK, resent AddIP, or an ABORT message are valid, all other SCTP packets are dropped

Parameters
laPointer to the relevant libalias instance
directionSN_TO_LOCAL | SN_TO_GLOBAL
smPointer to sctp message information
assocPointer to the association this SCTP Message belongs to
Returns
SN_NAT_PKT | SN_DROP_PKT

Definition at line 1893 of file alias_sctp.c.

Referenced by ProcessSctpMsg().

Here is the caller graph for this function:

◆ INi_process()

static int INi_process ( struct libalias la,
int  direction,
struct sctp_nat_assoc assoc,
struct sctp_nat_msg sm 
)
static

Process SCTP message while waiting for an INIT-ACK message.

Only an INIT-ACK, resent INIT, or an ABORT SCTP packet are valid in this state, all other packets are dropped.

Parameters
laPointer to the relevant libalias instance
directionSN_TO_LOCAL | SN_TO_GLOBAL
smPointer to sctp message information
assocPointer to the association this SCTP Message belongs to
Returns
SN_NAT_PKT | SN_DROP_PKT | SN_REPLY_ABORT

Definition at line 1841 of file alias_sctp.c.

Referenced by ProcessSctpMsg().

Here is the caller graph for this function:

◆ ProcessSctpMsg()

static int ProcessSctpMsg ( struct libalias la,
int  direction,
struct sctp_nat_msg sm,
struct sctp_nat_assoc assoc 
)
static

Process SCTP message.

This function is the base state machine. It calls the processing engine for each state.

Parameters
laPointer to the relevant libalias instance
directionSN_TO_LOCAL | SN_TO_GLOBAL
smPointer to sctp message information
assocPointer to the association this SCTP Message belongs to
Returns
SN_DROP_PKT | SN_NAT_PKT | SN_REPLY_ABORT | SN_REPLY_ERROR | SN_PROCESSING_ERROR

Definition at line 1734 of file alias_sctp.c.

References CL_process(), ID_process(), INa_process(), INi_process(), SN_CL, SN_ID, SN_INa, SN_INi, SN_NAT_PKT, SN_RM, SN_UP, sctp_nat_assoc::state, and UP_process().

Here is the call graph for this function:

◆ UP_process()

static int UP_process ( struct libalias la,
int  direction,
struct sctp_nat_assoc assoc,
struct sctp_nat_msg sm 
)
static

Process SCTP messages while association is UP redirecting packets.

While in the SN_UP state, all packets for the particular association are passed. Only a SHUT-ACK or an ABORT will cause a change of state.

Parameters
laPointer to the relevant libalias instance
directionSN_TO_LOCAL | SN_TO_GLOBAL
smPointer to sctp message information
assocPointer to the association this SCTP Message belongs to
Returns
SN_NAT_PKT | SN_DROP_PKT

Definition at line 1941 of file alias_sctp.c.

Referenced by ProcessSctpMsg().

Here is the caller graph for this function: