FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
ip4_source_and_port_range_check.c File Reference

IPv4 Source and Port Range Checking. More...

+ Include dependency graph for ip4_source_and_port_range_check.c:

Go to the source code of this file.

Data Structures

struct  ip4_source_and_port_range_check_trace_t
 

Macros

#define foreach_ip4_source_and_port_range_check_error
 

Enumerations

enum  ip4_source_and_port_range_check_error_t { IP4_SOURCE_AND_PORT_RANGE_CHECK_N_ERROR }
 
enum  ip4_source_and_port_range_check_next_t { IP4_SOURCE_AND_PORT_RANGE_CHECK_NEXT_DROP, IP4_SOURCE_AND_PORT_RANGE_CHECK_N_NEXT }
 

Functions

static u8format_ip4_source_and_port_range_check_trace (u8 *s, va_list *va)
 
static u32 check_adj_port_range_x1 (const protocol_port_range_dpo_t *ppr_dpo, u16 dst_port, u32 next)
 
static protocol_port_range_dpo_tprotocol_port_range_dpo_get (index_t index)
 
static uword ip4_source_and_port_range_check_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_tx)
 
static uword ip4_source_and_port_range_check_rx (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static uword ip4_source_and_port_range_check_tx (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
int set_ip_source_and_port_range_check (vlib_main_t *vm, u32 *fib_index, u32 sw_if_index, u32 is_add)
 
static clib_error_tset_ip_source_and_port_range_check_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static u8format_ppr_dpo (u8 *s, va_list *args)
 
static void ppr_dpo_lock (dpo_id_t *dpo)
 
static void ppr_dpo_unlock (dpo_id_t *dpo)
 
clib_error_tip4_source_and_port_range_check_init (vlib_main_t *vm)
 
protocol_port_range_dpo_tprotocol_port_range_dpo_alloc (void)
 
static int add_port_range_adjacency (u32 fib_index, ip4_address_t *address, u32 length, u16 *low_ports, u16 *high_ports)
 
static int remove_port_range_adjacency (u32 fib_index, ip4_address_t *address, u32 length, u16 *low_ports, u16 *high_ports)
 
int ip6_source_and_port_range_check_add_del (ip6_address_t *address, u32 length, u32 vrf_id, u16 *low_ports, u16 *high_ports, int is_add)
 
int ip4_source_and_port_range_check_add_del (ip4_address_t *address, u32 length, u32 vrf_id, u16 *low_ports, u16 *high_ports, int is_add)
 
static clib_error_tip_source_and_port_range_check_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tshow_source_and_port_range_check_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 

Variables

source_range_check_main_t source_range_check_main
 
static protocol_port_range_dpo_tppr_dpo_pool
 The pool of range chack DPOs. More...
 
static dpo_type_t ppr_dpo_type
 Dynamically registered DPO type. More...
 
vlib_node_registration_t ip4_source_port_and_range_check_rx
 (constructor) VLIB_REGISTER_NODE (ip4_source_port_and_range_check_rx) More...
 
vlib_node_registration_t ip4_source_port_and_range_check_tx
 (constructor) VLIB_REGISTER_NODE (ip4_source_port_and_range_check_tx) More...
 
static char * ip4_source_and_port_range_check_error_strings []
 
static vlib_cli_command_t set_interface_ip_source_and_port_range_check_command
 (constructor) VLIB_CLI_COMMAND (set_interface_ip_source_and_port_range_check_command) More...
 
const static dpo_vft_t ppr_vft
 
const static char *const ppr_ip4_nodes []
 
const static char *const *const ppr_nodes [DPO_PROTO_NUM]
 
static vlib_cli_command_t ip_source_and_port_range_check_command
 (constructor) VLIB_CLI_COMMAND (ip_source_and_port_range_check_command) More...
 
static vlib_cli_command_t show_source_and_port_range_check
 (constructor) VLIB_CLI_COMMAND (show_source_and_port_range_check) More...
 

Detailed Description

IPv4 Source and Port Range Checking.

This file contains the source code for IPv4 source and port range checking.

Definition in file ip4_source_and_port_range_check.c.

Macro Definition Documentation

◆ foreach_ip4_source_and_port_range_check_error

#define foreach_ip4_source_and_port_range_check_error
Value:
_(CHECK_FAIL, "ip4 source and port range check bad packets") \
_(CHECK_OK, "ip4 source and port range check good packets")

Definition at line 45 of file ip4_source_and_port_range_check.c.

Enumeration Type Documentation

◆ ip4_source_and_port_range_check_error_t

Enumerator
IP4_SOURCE_AND_PORT_RANGE_CHECK_N_ERROR 

Definition at line 49 of file ip4_source_and_port_range_check.c.

◆ ip4_source_and_port_range_check_next_t

Enumerator
IP4_SOURCE_AND_PORT_RANGE_CHECK_NEXT_DROP 
IP4_SOURCE_AND_PORT_RANGE_CHECK_N_NEXT 

Definition at line 91 of file ip4_source_and_port_range_check.c.

Function Documentation

◆ add_port_range_adjacency()

static int add_port_range_adjacency ( u32  fib_index,
ip4_address_t address,
u32  length,
u16 low_ports,
u16 high_ports 
)
static

Definition at line 915 of file ip4_source_and_port_range_check.c.

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

◆ check_adj_port_range_x1()

static u32 check_adj_port_range_x1 ( const protocol_port_range_dpo_t ppr_dpo,
u16  dst_port,
u32  next 
)
inlinestatic

Definition at line 99 of file ip4_source_and_port_range_check.c.

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

◆ format_ip4_source_and_port_range_check_trace()

static u8* format_ip4_source_and_port_range_check_trace ( u8 s,
va_list *  va 
)
static

Definition at line 74 of file ip4_source_and_port_range_check.c.

◆ format_ppr_dpo()

static u8* format_ppr_dpo ( u8 s,
va_list *  args 
)
static

Definition at line 825 of file ip4_source_and_port_range_check.c.

+ Here is the call graph for this function:

◆ ip4_source_and_port_range_check_add_del()

int ip4_source_and_port_range_check_add_del ( ip4_address_t address,
u32  length,
u32  vrf_id,
u16 low_ports,
u16 high_ports,
int  is_add 
)

Definition at line 1141 of file ip4_source_and_port_range_check.c.

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

◆ ip4_source_and_port_range_check_init()

clib_error_t* ip4_source_and_port_range_check_init ( vlib_main_t vm)

Definition at line 886 of file ip4_source_and_port_range_check.c.

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

◆ ip4_source_and_port_range_check_inline()

static uword ip4_source_and_port_range_check_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
int  is_tx 
)
inlinestatic

Definition at line 154 of file ip4_source_and_port_range_check.c.

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

◆ ip4_source_and_port_range_check_rx()

static uword ip4_source_and_port_range_check_rx ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 561 of file ip4_source_and_port_range_check.c.

+ Here is the call graph for this function:

◆ ip4_source_and_port_range_check_tx()

static uword ip4_source_and_port_range_check_tx ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 570 of file ip4_source_and_port_range_check.c.

+ Here is the call graph for this function:

◆ ip6_source_and_port_range_check_add_del()

int ip6_source_and_port_range_check_add_del ( ip6_address_t *  address,
u32  length,
u32  vrf_id,
u16 low_ports,
u16 high_ports,
int  is_add 
)

Definition at line 1123 of file ip4_source_and_port_range_check.c.

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

◆ ip_source_and_port_range_check_command_fn()

static clib_error_t* ip_source_and_port_range_check_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1167 of file ip4_source_and_port_range_check.c.

+ Here is the call graph for this function:

◆ ppr_dpo_lock()

static void ppr_dpo_lock ( dpo_id_t dpo)
static

Definition at line 861 of file ip4_source_and_port_range_check.c.

◆ ppr_dpo_unlock()

static void ppr_dpo_unlock ( dpo_id_t dpo)
static

Definition at line 866 of file ip4_source_and_port_range_check.c.

◆ protocol_port_range_dpo_alloc()

protocol_port_range_dpo_t* protocol_port_range_dpo_alloc ( void  )

Definition at line 901 of file ip4_source_and_port_range_check.c.

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

◆ protocol_port_range_dpo_get()

static protocol_port_range_dpo_t* protocol_port_range_dpo_get ( index_t  index)
inlinestatic

Definition at line 148 of file ip4_source_and_port_range_check.c.

+ Here is the caller graph for this function:

◆ remove_port_range_adjacency()

static int remove_port_range_adjacency ( u32  fib_index,
ip4_address_t address,
u32  length,
u16 low_ports,
u16 high_ports 
)
static

Definition at line 1019 of file ip4_source_and_port_range_check.c.

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

◆ set_ip_source_and_port_range_check()

int set_ip_source_and_port_range_check ( vlib_main_t vm,
u32 fib_index,
u32  sw_if_index,
u32  is_add 
)

Definition at line 622 of file ip4_source_and_port_range_check.c.

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

◆ set_ip_source_and_port_range_check_fn()

static clib_error_t* set_ip_source_and_port_range_check_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 658 of file ip4_source_and_port_range_check.c.

+ Here is the call graph for this function:

◆ show_source_and_port_range_check_fn()

static clib_error_t* show_source_and_port_range_check_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1294 of file ip4_source_and_port_range_check.c.

+ Here is the call graph for this function:

Variable Documentation

◆ ip4_source_and_port_range_check_error_strings

char* ip4_source_and_port_range_check_error_strings[]
static
Initial value:

Definition at line 57 of file ip4_source_and_port_range_check.c.

◆ ip4_source_port_and_range_check_rx

vlib_node_registration_t ip4_source_port_and_range_check_rx
Initial value:
= {
.name = "ip4-source-and-port-range-check-rx",
.vector_size = sizeof (u32),
.next_nodes = {
},
.format_buffer = format_ip4_header,
}

(constructor) VLIB_REGISTER_NODE (ip4_source_port_and_range_check_rx)

Definition at line 42 of file ip4_source_and_port_range_check.c.

◆ ip4_source_port_and_range_check_tx

vlib_node_registration_t ip4_source_port_and_range_check_tx
Initial value:
= {
.name = "ip4-source-and-port-range-check-tx",
.vector_size = sizeof (u32),
.next_nodes = {
},
.format_buffer = format_ip4_header,
}

(constructor) VLIB_REGISTER_NODE (ip4_source_port_and_range_check_tx)

Definition at line 43 of file ip4_source_and_port_range_check.c.

◆ ip_source_and_port_range_check_command

vlib_cli_command_t ip_source_and_port_range_check_command
static
Initial value:
= {
.path = "set ip source-and-port-range-check",
.short_help =
"set ip source-and-port-range-check vrf <table-id> <ip-addr>/<mask> {port nn | range <nn> - <nn>} [del]",
}

(constructor) VLIB_CLI_COMMAND (ip_source_and_port_range_check_command)

Definition at line 1284 of file ip4_source_and_port_range_check.c.

◆ ppr_dpo_pool

protocol_port_range_dpo_t* ppr_dpo_pool
static

The pool of range chack DPOs.

Definition at line 35 of file ip4_source_and_port_range_check.c.

◆ ppr_dpo_type

dpo_type_t ppr_dpo_type
static

Dynamically registered DPO type.

Definition at line 40 of file ip4_source_and_port_range_check.c.

◆ ppr_ip4_nodes

const static char* const ppr_ip4_nodes[]
static
Initial value:
= {
"ip4-source-and-port-range-check-rx",
NULL,
}

Definition at line 876 of file ip4_source_and_port_range_check.c.

◆ ppr_nodes

const static char* const * const ppr_nodes[DPO_PROTO_NUM]
static
Initial value:

Definition at line 881 of file ip4_source_and_port_range_check.c.

◆ ppr_vft

const static dpo_vft_t ppr_vft
static
Initial value:
= {
.dv_lock = ppr_dpo_lock,
.dv_unlock = ppr_dpo_unlock,
.dv_format = format_ppr_dpo,
}

Definition at line 870 of file ip4_source_and_port_range_check.c.

◆ set_interface_ip_source_and_port_range_check_command

vlib_cli_command_t set_interface_ip_source_and_port_range_check_command
static
Initial value:
= {
.path = "set interface ip source-and-port-range-check",
.short_help = "set interface ip source-and-port-range-check <interface> [tcp-out-vrf <table-id>] [udp-out-vrf <table-id>] [tcp-in-vrf <table-id>] [udp-in-vrf <table-id>] [del]",
}

(constructor) VLIB_CLI_COMMAND (set_interface_ip_source_and_port_range_check_command)

Definition at line 817 of file ip4_source_and_port_range_check.c.

◆ show_source_and_port_range_check

vlib_cli_command_t show_source_and_port_range_check
static
Initial value:
= {
.path = "show ip source-and-port-range-check",
.short_help =
"show ip source-and-port-range-check vrf <table-id> <ip-addr> [port <n>]",
}

(constructor) VLIB_CLI_COMMAND (show_source_and_port_range_check)

Definition at line 1410 of file ip4_source_and_port_range_check.c.

◆ source_range_check_main

source_range_check_main_t source_range_check_main

Definition at line 21 of file ip4_source_and_port_range_check.c.

IP4_SOURCE_AND_PORT_RANGE_CHECK_N_NEXT
@ IP4_SOURCE_AND_PORT_RANGE_CHECK_N_NEXT
Definition: ip4_source_and_port_range_check.c:94
ip4_source_and_port_range_check_error_strings
static char * ip4_source_and_port_range_check_error_strings[]
Definition: ip4_source_and_port_range_check.c:57
ppr_dpo_unlock
static void ppr_dpo_unlock(dpo_id_t *dpo)
Definition: ip4_source_and_port_range_check.c:866
set_ip_source_and_port_range_check_fn
static clib_error_t * set_ip_source_and_port_range_check_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: ip4_source_and_port_range_check.c:658
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
show_source_and_port_range_check_fn
static clib_error_t * show_source_and_port_range_check_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: ip4_source_and_port_range_check.c:1294
format_ip4_source_and_port_range_check_trace
static u8 * format_ip4_source_and_port_range_check_trace(u8 *s, va_list *va)
Definition: ip4_source_and_port_range_check.c:74
IP4_SOURCE_AND_PORT_RANGE_CHECK_NEXT_DROP
@ IP4_SOURCE_AND_PORT_RANGE_CHECK_NEXT_DROP
Definition: ip4_source_and_port_range_check.c:93
u32
unsigned int u32
Definition: types.h:88
format_ip4_header
format_function_t format_ip4_header
Definition: format.h:81
foreach_ip4_source_and_port_range_check_error
#define foreach_ip4_source_and_port_range_check_error
Definition: ip4_source_and_port_range_check.c:45
format_ppr_dpo
static u8 * format_ppr_dpo(u8 *s, va_list *args)
Definition: ip4_source_and_port_range_check.c:825
ppr_ip4_nodes
const static char *const ppr_ip4_nodes[]
Definition: ip4_source_and_port_range_check.c:876
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
ip4_source_and_port_range_check_rx
static uword ip4_source_and_port_range_check_rx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: ip4_source_and_port_range_check.c:561
ppr_dpo_lock
static void ppr_dpo_lock(dpo_id_t *dpo)
Definition: ip4_source_and_port_range_check.c:861
ip4_source_and_port_range_check_tx
static uword ip4_source_and_port_range_check_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: ip4_source_and_port_range_check.c:570
ip_source_and_port_range_check_command_fn
static clib_error_t * ip_source_and_port_range_check_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: ip4_source_and_port_range_check.c:1167