FD.io VPP  v19.04.1-1-ge4a0f9f
Vector Packet Processing
punt.c File Reference

Local TCP/IP stack punt infrastructure. More...

+ Include dependency graph for punt.c:

Go to the source code of this file.

Data Structures

struct  udp_punt_trace_t
 
struct  punt_trace_t
 

Macros

#define foreach_punt_next
 
#define punt_next_punt(is_ip4)   (is_ip4 ? PUNT_NEXT_PUNT4 : PUNT_NEXT_PUNT6)
 
#define punt_error(n, s)   s,
 

Enumerations

enum  punt_next_t { PUNT_N_NEXT }
 
enum  punt_socket_rx_next_e { PUNT_SOCKET_RX_NEXT_INTERFACE_OUTPUT, PUNT_SOCKET_RX_NEXT_IP4_LOOKUP, PUNT_SOCKET_RX_NEXT_IP6_LOOKUP, PUNT_SOCKET_RX_N_NEXT }
 

Functions

char * vnet_punt_get_server_pathname (void)
 
static uword udp46_punt_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, int is_ip4)
 IPv4/IPv6 UDP punt node main loop. More...
 
VLIB_NODE_FN() udp4_punt_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 IPv4 UDP punt node. More...
 
VLIB_NODE_FN() udp6_punt_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 IPv6 UDP punt node. More...
 
static punt_client_tpunt_client_get (bool is_ip4, u16 port)
 
static struct sockaddr_un * punt_socket_get (bool is_ip4, u16 port)
 
static int punt_socket_register (bool is_ip4, u8 protocol, u16 port, char *client_pathname)
 
static void punt_socket_unregister (bool is_ip4, u8 protocol, u16 port)
 
static u8format_udp_punt_trace (u8 *s, va_list *args)
 
static uword udp46_punt_socket_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, bool is_ip4)
 
static uword udp4_punt_socket (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 
static uword udp6_punt_socket (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 
static u8format_punt_trace (u8 *s, va_list *va)
 
static uword punt_socket_rx_fd (vlib_main_t *vm, vlib_node_runtime_t *node, u32 fd)
 
static uword punt_socket_rx (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static clib_error_tpunt_socket_read_ready (clib_file_t *uf)
 
clib_error_tvnet_punt_socket_add (vlib_main_t *vm, u32 header_version, bool is_ip4, u8 protocol, u16 port, char *client_pathname)
 
clib_error_tvnet_punt_socket_del (vlib_main_t *vm, bool is_ip4, u8 l4_protocol, u16 port)
 
clib_error_tvnet_punt_add_del (vlib_main_t *vm, u8 ipv, u8 protocol, u16 port, bool is_add)
 Request IP traffic punt to the local TCP/IP stack. More...
 
static clib_error_tpunt_cli (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tpunt_socket_register_cmd (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tpunt_socket_deregister_cmd (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
punt_socket_detail_tpunt_socket_entries (u8 ipv)
 
u8format_punt_socket (u8 *s, va_list *args)
 
static clib_error_tpunt_socket_show_cmd (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
clib_error_tip_punt_init (vlib_main_t *vm)
 
static clib_error_tpunt_config (vlib_main_t *vm, unformat_input_t *input)
 

Variables

vlib_node_registration_t udp4_punt_node
 (constructor) VLIB_REGISTER_NODE (udp4_punt_node) More...
 
vlib_node_registration_t udp6_punt_node
 (constructor) VLIB_REGISTER_NODE (udp6_punt_node) More...
 
vlib_node_registration_t udp4_punt_socket_node
 (constructor) VLIB_REGISTER_NODE (udp4_punt_socket_node) More...
 
vlib_node_registration_t udp6_punt_socket_node
 (constructor) VLIB_REGISTER_NODE (udp6_punt_socket_node) More...
 
static vlib_node_registration_t punt_socket_rx_node
 (constructor) VLIB_REGISTER_NODE (punt_socket_rx_node) More...
 
punt_main_t punt_main
 
static char * punt_error_strings []
 
static vlib_cli_command_t punt_command
 (constructor) VLIB_CLI_COMMAND (punt_command) More...
 
static vlib_cli_command_t punt_socket_register_command
 (constructor) VLIB_CLI_COMMAND (punt_socket_register_command) More...
 
static vlib_cli_command_t punt_socket_deregister_command
 (constructor) VLIB_CLI_COMMAND (punt_socket_deregister_command) More...
 
static vlib_cli_command_t show_punt_socket_registration_command
 (constructor) VLIB_CLI_COMMAND (show_punt_socket_registration_command) More...
 

Detailed Description

Local TCP/IP stack punt infrastructure.

Provides a set of VPP nodes together with the relevant APIs and CLI commands in order to adjust and dispatch packets from the VPP data plane to the local TCP/IP stack

Definition in file punt.c.

Macro Definition Documentation

#define foreach_punt_next
Value:
_ (PUNT4, "ip4-punt") \
_ (PUNT6, "ip6-punt")

Definition at line 41 of file punt.c.

#define punt_error (   n,
 
)    s,
#define punt_next_punt (   is_ip4)    (is_ip4 ? PUNT_NEXT_PUNT4 : PUNT_NEXT_PUNT6)

Definition at line 61 of file punt.c.

Enumeration Type Documentation

Enumerator
PUNT_N_NEXT 

Definition at line 45 of file punt.c.

Enumerator
PUNT_SOCKET_RX_NEXT_INTERFACE_OUTPUT 
PUNT_SOCKET_RX_NEXT_IP4_LOOKUP 
PUNT_SOCKET_RX_NEXT_IP6_LOOKUP 
PUNT_SOCKET_RX_N_NEXT 

Definition at line 53 of file punt.c.

Function Documentation

u8* format_punt_socket ( u8 s,
va_list *  args 
)

Definition at line 988 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 486 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 299 of file punt.c.

+ Here is the call graph for this function:

clib_error_t* ip_punt_init ( vlib_main_t vm)

Definition at line 1062 of file punt.c.

+ Here is the call graph for this function:

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

Definition at line 779 of file punt.c.

+ Here is the call graph for this function:

static punt_client_t* punt_client_get ( bool  is_ip4,
u16  port 
)
static

Definition at line 237 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* punt_config ( vlib_main_t vm,
unformat_input_t input 
)
static

Definition at line 1084 of file punt.c.

+ Here is the call graph for this function:

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

Definition at line 902 of file punt.c.

+ Here is the call graph for this function:

punt_socket_detail_t* punt_socket_entries ( u8  ipv)

Definition at line 952 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static struct sockaddr_un* punt_socket_get ( bool  is_ip4,
u16  port 
)
static

Definition at line 251 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* punt_socket_read_ready ( clib_file_t uf)
static

Schedule the rx node

Definition at line 628 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int punt_socket_register ( bool  is_ip4,
u8  protocol,
u16  port,
char *  client_pathname 
)
static

Definition at line 262 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 848 of file punt.c.

+ Here is the call graph for this function:

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

Definition at line 592 of file punt.c.

+ Here is the call graph for this function:

static uword punt_socket_rx_fd ( vlib_main_t vm,
vlib_node_runtime_t node,
u32  fd 
)
static

Definition at line 498 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1017 of file punt.c.

+ Here is the call graph for this function:

static void punt_socket_unregister ( bool  is_ip4,
u8  protocol,
u16  port 
)
static

Definition at line 286 of file punt.c.

+ Here is the caller graph for this function:

static uword udp46_punt_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame,
int  is_ip4 
)
inlinestatic

IPv4/IPv6 UDP punt node main loop.

This is the main loop inline function for IPv4/IPv6 UDP punt transition node.

Parameters
vmvlib_main_t corresponding to the current thread
nodevlib_node_runtime_t
framevlib_frame_t whose contents should be dispatched
is_ipv4indicates if called for IPv4 or IPv6 node

Definition at line 93 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword udp46_punt_socket_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
bool  is_ip4 
)
inlinestatic

VLIB buffer chain -> Unix iovec(s).

Definition at line 315 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VLIB_NODE_FN() udp4_punt_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)

IPv4 UDP punt node.

Node Identifier:
ip4-udp-punt

This is the IPv4 UDP punt transition node. It is registered as a next node for the "ip4-udp-lookup" handling UDP port(s) requested for punt. The buffer's current data pointer is adjusted to the original packet IPv4 header. All buffers are dispatched to "error-punt".

Parameters
vmvlib_main_t corresponding to the current thread
nodevlib_node_runtime_t
framevlib_frame_t whose contents should be dispatched
Graph mechanics: next index usage

Sets:

Next Index:

  • Dispatches the packet to the "error-punt" node

Definition at line 166 of file punt.c.

+ Here is the call graph for this function:

static uword udp4_punt_socket ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)
static

Definition at line 443 of file punt.c.

+ Here is the call graph for this function:

VLIB_NODE_FN() udp6_punt_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)

IPv6 UDP punt node.

Node Identifier:
ip6-udp-punt

This is the IPv6 UDP punt transition node. It is registered as a next node for the "ip6-udp-lookup" handling UDP port(s) requested for punt. The buffer's current data pointer is adjusted to the original packet IPv6 header. All buffers are dispatched to "error-punt".

Parameters
vmvlib_main_t corresponding to the current thread
nodevlib_node_runtime_t
framevlib_frame_t whose contents should be dispatched
Graph mechanics: next index usage

Sets:

Next Index:

  • Dispatches the packet to the "error-punt" node

Definition at line 194 of file punt.c.

+ Here is the call graph for this function:

static uword udp6_punt_socket ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)
static

Definition at line 450 of file punt.c.

+ Here is the call graph for this function:

clib_error_t* vnet_punt_add_del ( vlib_main_t vm,
u8  ipv,
u8  protocol,
u16  port,
bool  is_add 
)

Request IP traffic punt to the local TCP/IP stack.

Note

  • UDP and TCP are the only protocols supported in the current implementation
Parameters
vmvlib_main_t corresponding to the current thread
ipvIP protcol version. 4 - IPv4, 6 - IPv6, ~0 for both IPv6 and IPv4
protocol8-bits L4 protocol value UDP is 17 TCP is 1
port16-bits L4 (TCP/IP) port number when applicable (UDP only)
Returns
0 on success, non-zero value otherwise

Definition at line 708 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char* vnet_punt_get_server_pathname ( void  )

Definition at line 75 of file punt.c.

+ Here is the caller graph for this function:

clib_error_t* vnet_punt_socket_add ( vlib_main_t vm,
u32  header_version,
bool  is_ip4,
u8  protocol,
u16  port,
char *  client_pathname 
)

Definition at line 642 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* vnet_punt_socket_del ( vlib_main_t vm,
bool  is_ip4,
u8  l4_protocol,
u16  port 
)

Definition at line 678 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

vlib_cli_command_t punt_command
static
Initial value:
= {
.path = "set punt",
.short_help = "set punt [udp|tcp] [del] <all | port-num1 [port-num2 ...]>",
.function = punt_cli,
}
static clib_error_t * punt_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: punt.c:779

(constructor) VLIB_CLI_COMMAND (punt_command)

Definition at line 839 of file punt.c.

char* punt_error_strings[]
static
Initial value:
= {
#define punt_error(n,s)
punt_error (NONE, "no error")
punt_error (UDP_PORT, "udp port punt")
punt_error (SOCKET_RX, "Socket RX")
punt_error (SOCKET_TX, "Socket TX")
punt_error (SOCKET_RX_ERROR, "Socket RX error")
punt_error (SOCKET_TX_ERROR, "Socket TX error")
punt_error (NOBUFFER, "buffer allocation failure")
punt_error (READV, "socket read failure")
punt_error (ACTION, "invalid packet descriptor")
}
#define punt_error(n, s)

Definition at line 139 of file punt.c.

punt_main_t punt_main

Definition at line 72 of file punt.c.

vlib_cli_command_t punt_socket_deregister_command
static
Initial value:
=
{
.path = "punt socket deregister",
.short_help = "punt socket deregister [ipv4|ipv6] [udp|tcp]> <all | port-num1 [port-num2 ...]>",
.is_mp_safe = 1,
}
static clib_error_t * punt_socket_deregister_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: punt.c:902

(constructor) VLIB_CLI_COMMAND (punt_socket_deregister_command)

Definition at line 942 of file punt.c.

vlib_cli_command_t punt_socket_register_command
static
Initial value:
=
{
.path = "punt socket register",
.short_help = "punt socket register [ipv4|ipv6] [udp|tcp]> <all | port-num1 [port-num2 ...]> <socket>",
.is_mp_safe = 1,
}
static clib_error_t * punt_socket_register_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: punt.c:848

(constructor) VLIB_CLI_COMMAND (punt_socket_register_command)

Definition at line 892 of file punt.c.

static vlib_node_registration_t punt_socket_rx_node
static
Initial value:
=
{
.function = punt_socket_rx,
.name = "punt-socket-rx",
.state = VLIB_NODE_STATE_INTERRUPT,
.vector_size = 1,
.n_errors = PUNT_N_ERROR,
.error_strings = punt_error_strings,
.n_next_nodes = PUNT_SOCKET_RX_N_NEXT,
.next_nodes = {
[PUNT_SOCKET_RX_NEXT_INTERFACE_OUTPUT] = "interface-output",
},
.format_trace = format_punt_trace,
}
static uword punt_socket_rx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: punt.c:592
static u8 * format_punt_trace(u8 *s, va_list *va)
Definition: punt.c:486
static char * punt_error_strings[]
Definition: punt.c:139

(constructor) VLIB_REGISTER_NODE (punt_socket_rx_node)

Definition at line 67 of file punt.c.

vlib_cli_command_t show_punt_socket_registration_command
static
Initial value:
=
{
.path = "show punt socket registrations",
.function = punt_socket_show_cmd,
.short_help = "show punt socket registrations [ipv4|ipv6]",
.is_mp_safe = 1,
}
static clib_error_t * punt_socket_show_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: punt.c:1017

(constructor) VLIB_CLI_COMMAND (show_punt_socket_registration_command)

Definition at line 1052 of file punt.c.

vlib_node_registration_t udp4_punt_node
Initial value:
= {
.name = "ip4-udp-punt",
.vector_size = sizeof (u32),
.n_errors = PUNT_N_ERROR,
.error_strings = punt_error_strings,
.n_next_nodes = PUNT_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}
#define foreach_punt_next
Definition: punt.c:41
unsigned int u32
Definition: types.h:88
static char * punt_error_strings[]
Definition: punt.c:139

(constructor) VLIB_REGISTER_NODE (udp4_punt_node)

Definition at line 202 of file punt.c.

vlib_node_registration_t udp4_punt_socket_node
Initial value:
= {
.function = udp4_punt_socket,
.name = "ip4-udp-punt-socket",
.format_trace = format_udp_punt_trace,
.vector_size = sizeof (u32),
.n_errors = PUNT_N_ERROR,
.error_strings = punt_error_strings,
}
unsigned int u32
Definition: types.h:88
static uword udp4_punt_socket(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: punt.c:443
static u8 * format_udp_punt_trace(u8 *s, va_list *args)
Definition: punt.c:299
#define VLIB_NODE_FLAG_IS_DROP
Definition: node.h:296
static char * punt_error_strings[]
Definition: punt.c:139

(constructor) VLIB_REGISTER_NODE (udp4_punt_socket_node)

Definition at line 458 of file punt.c.

vlib_node_registration_t udp6_punt_node
Initial value:
= {
.name = "ip6-udp-punt",
.vector_size = sizeof (u32),
.n_errors = PUNT_N_ERROR,
.error_strings = punt_error_strings,
.n_next_nodes = PUNT_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}
#define foreach_punt_next
Definition: punt.c:41
unsigned int u32
Definition: types.h:88
static char * punt_error_strings[]
Definition: punt.c:139

(constructor) VLIB_REGISTER_NODE (udp6_punt_node)

Definition at line 218 of file punt.c.

vlib_node_registration_t udp6_punt_socket_node
Initial value:
= {
.function = udp6_punt_socket,
.name = "ip6-udp-punt-socket",
.format_trace = format_udp_punt_trace,
.vector_size = sizeof (u32),
.n_errors = PUNT_N_ERROR,
.error_strings = punt_error_strings,
}
unsigned int u32
Definition: types.h:88
static uword udp6_punt_socket(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: punt.c:450
static u8 * format_udp_punt_trace(u8 *s, va_list *args)
Definition: punt.c:299
#define VLIB_NODE_FLAG_IS_DROP
Definition: node.h:296
static char * punt_error_strings[]
Definition: punt.c:139

(constructor) VLIB_REGISTER_NODE (udp6_punt_socket_node)

Definition at line 468 of file punt.c.