FD.io VPP  v18.10-34-gcce845e
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...
 
static uword udp4_punt (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 IPv4 UDP punt node. More...
 
static uword udp6_punt (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 IPv6 UDP punt node. More...
 
 VLIB_NODE_FUNCTION_MULTIARCH (udp4_punt_node, udp4_punt)
 
 VLIB_NODE_FUNCTION_MULTIARCH (udp6_punt_node, udp6_punt)
 
static punt_client_tpunt_client_get (bool is_ip4, u16 port)
 
static struct sockaddr_un * punt_socket_get (bool is_ip4, u16 port)
 
static void 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)
 
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)
 
clib_error_tpunt_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...
 

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 43 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 63 of file punt.c.

Enumeration Type Documentation

Enumerator
PUNT_N_NEXT 

Definition at line 47 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 55 of file punt.c.

Function Documentation

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

Definition at line 479 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_udp_punt_trace ( u8 s,
va_list *  args 
)

Definition at line 295 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_cli ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 748 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 241 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 845 of file punt.c.

+ Here is the call graph for this function:

clib_error_t* punt_init ( vlib_main_t vm)

Definition at line 824 of file punt.c.

+ Here is the call graph for this function:

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

Definition at line 255 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 613 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 265 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller 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 585 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 491 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 283 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 91 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 311 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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 165 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller 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 436 of file punt.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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 193 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 443 of file punt.c.

+ Here is the call graph for this function:

VLIB_NODE_FUNCTION_MULTIARCH ( udp4_punt_node  ,
udp4_punt   
)

+ Here is the caller graph for this function:

VLIB_NODE_FUNCTION_MULTIARCH ( udp6_punt_node  ,
udp6_punt   
)
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 689 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 74 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 626 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 659 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:748

(constructor) VLIB_CLI_COMMAND (punt_command)

Definition at line 816 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 137 of file punt.c.

punt_main_t punt_main

Definition at line 71 of file punt.c.

static vlib_node_registration_t punt_socket_rx_node
static
Initial value:
=
{
.function = punt_socket_rx,.name = "punt-socket-rx",.type =
VLIB_NODE_TYPE_INPUT,.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",
[PUNT_SOCKET_RX_NEXT_IP6_LOOKUP] = "ip6-lookup",},.format_trace =
static uword punt_socket_rx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: punt.c:585
static u8 * format_punt_trace(u8 *s, va_list *va)
Definition: punt.c:479
static char * punt_error_strings[]
Definition: punt.c:137

(constructor) VLIB_REGISTER_NODE (punt_socket_rx_node)

Definition at line 69 of file punt.c.

vlib_node_registration_t udp4_punt_node
Initial value:
= {
.function = udp4_punt,
.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)
},
}
static uword udp4_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
IPv4 UDP punt node.
Definition: punt.c:165
unsigned int u32
Definition: types.h:88
static char * punt_error_strings[]
Definition: punt.c:137
#define foreach_punt_next
Definition: punt.c:43

(constructor) VLIB_REGISTER_NODE (udp4_punt_node)

Definition at line 65 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:436
static char * punt_error_strings[]
Definition: punt.c:137
u8 * format_udp_punt_trace(u8 *s, va_list *args)
Definition: punt.c:295
#define VLIB_NODE_FLAG_IS_DROP
Definition: node.h:305

(constructor) VLIB_REGISTER_NODE (udp4_punt_socket_node)

Definition at line 67 of file punt.c.

vlib_node_registration_t udp6_punt_node
Initial value:
= {
.function = udp6_punt,
.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)
},
}
static uword udp6_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
IPv6 UDP punt node.
Definition: punt.c:193
unsigned int u32
Definition: types.h:88
static char * punt_error_strings[]
Definition: punt.c:137
#define foreach_punt_next
Definition: punt.c:43

(constructor) VLIB_REGISTER_NODE (udp6_punt_node)

Definition at line 66 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,
}
static uword udp6_punt_socket(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: punt.c:443
unsigned int u32
Definition: types.h:88
static char * punt_error_strings[]
Definition: punt.c:137
u8 * format_udp_punt_trace(u8 *s, va_list *args)
Definition: punt.c:295
#define VLIB_NODE_FLAG_IS_DROP
Definition: node.h:305

(constructor) VLIB_REGISTER_NODE (udp6_punt_socket_node)

Definition at line 68 of file punt.c.