FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
client.c File Reference
+ Include dependency graph for client.c:

Go to the source code of this file.

Macros

#define DHCP_DBG(...)   vlib_log_debug (dhcp_logger, __VA_ARGS__)
 
#define DHCP_INFO(...)   vlib_log_notice (dhcp_logger, __VA_ARGS__)
 
#define foreach_dhcp_sent_packet_stat
 
#define foreach_dhcp_error_counter
 

Enumerations

enum  sample_error_t { SAMPLE_N_ERROR, DHCP_STAT_UNKNOWN, DHCP_STAT_N_STAT }
 

Functions

static u8format_dhcp_client_state (u8 *s, va_list *va)
 
static u8format_dhcp_client (u8 *s, va_list *va)
 
static void dhcp_client_acquire_address (dhcp_client_main_t *dcm, dhcp_client_t *c)
 
static void dhcp_client_release_address (dhcp_client_main_t *dcm, dhcp_client_t *c)
 
static void dhcp_client_proc_callback (uword *client_index)
 
static void dhcp_client_addr_callback (u32 *cindex)
 
static void dhcp_client_reset (dhcp_client_main_t *dcm, dhcp_client_t *c)
 
int dhcp_client_for_us (u32 bi, vlib_buffer_t *b, ip4_header_t *ip, udp_header_t *udp, dhcp_header_t *dhcp)
 
static void send_dhcp_pkt (dhcp_client_main_t *dcm, dhcp_client_t *c, dhcp_packet_type_t type, int is_broadcast)
 
static int dhcp_discover_state (dhcp_client_main_t *dcm, dhcp_client_t *c, f64 now)
 
static int dhcp_request_state (dhcp_client_main_t *dcm, dhcp_client_t *c, f64 now)
 
static int dhcp_bound_state (dhcp_client_main_t *dcm, dhcp_client_t *c, f64 now)
 
static f64 dhcp_client_sm (f64 now, f64 timeout, uword pool_index)
 
static uword dhcp_client_process (vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
 
static clib_error_tshow_dhcp_client_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
int dhcp_client_add_del (dhcp_client_add_del_args_t *a)
 
int dhcp_client_config (u32 is_add, u32 client_index, vlib_main_t *vm, u32 sw_if_index, u8 *hostname, u8 *client_id, dhcp_event_cb_t event_callback, u8 set_broadcast_flag, ip_dscp_t dscp, u32 pid)
 Add/Delete DHCP clients. More...
 
void dhcp_client_walk (dhcp_client_walk_cb_t cb, void *ctx)
 Walk (visit each) DHCP client configuration. More...
 
static clib_error_tdhcp_client_set_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tdhcp_client_init (vlib_main_t *vm)
 

Variables

vlib_log_class_t dhcp_logger
 
dhcp_client_main_t dhcp_client_main
 
static vlib_node_registration_t dhcp_client_process_node
 (constructor) VLIB_REGISTER_NODE (dhcp_client_process_node) More...
 
static char * dhcp_client_process_stat_strings []
 
static vlib_cli_command_t show_dhcp_client_command
 (constructor) VLIB_CLI_COMMAND (show_dhcp_client_command) More...
 
static vlib_cli_command_t dhcp_client_set_command
 (constructor) VLIB_CLI_COMMAND (dhcp_client_set_command) More...
 

Macro Definition Documentation

◆ DHCP_DBG

#define DHCP_DBG (   ...)    vlib_log_debug (dhcp_logger, __VA_ARGS__)

Definition at line 27 of file client.c.

◆ DHCP_INFO

#define DHCP_INFO (   ...)    vlib_log_notice (dhcp_logger, __VA_ARGS__)

Definition at line 30 of file client.c.

◆ foreach_dhcp_error_counter

#define foreach_dhcp_error_counter
Value:
_(NOT_FOR_US, "DHCP packets for other hosts, dropped") \
_(NAK, "DHCP nak packets received") \
_(NON_OFFER_DISCOVER, "DHCP non-offer packets in discover state") \
_(ODDBALL, "DHCP non-ack, non-offer packets received") \
_(BOUND, "DHCP bind success")

Definition at line 39 of file client.c.

◆ foreach_dhcp_sent_packet_stat

#define foreach_dhcp_sent_packet_stat
Value:
_(DISCOVER, "DHCP discover packets sent") \
_(OFFER, "DHCP offer packets sent") \
_(REQUEST, "DHCP request packets sent") \
_(ACK, "DHCP ack packets sent")

Definition at line 33 of file client.c.

Enumeration Type Documentation

◆ sample_error_t

Enumerator
SAMPLE_N_ERROR 
DHCP_STAT_UNKNOWN 
DHCP_STAT_N_STAT 

Definition at line 46 of file client.c.

Function Documentation

◆ dhcp_bound_state()

static int dhcp_bound_state ( dhcp_client_main_t dcm,
dhcp_client_t c,
f64  now 
)
static

Definition at line 751 of file client.c.

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

◆ dhcp_client_acquire_address()

static void dhcp_client_acquire_address ( dhcp_client_main_t dcm,
dhcp_client_t c 
)
static

Definition at line 131 of file client.c.

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

◆ dhcp_client_add_del()

int dhcp_client_add_del ( dhcp_client_add_del_args_t a)

Definition at line 968 of file client.c.

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

◆ dhcp_client_addr_callback()

static void dhcp_client_addr_callback ( u32 cindex)
static

Definition at line 217 of file client.c.

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

◆ dhcp_client_config()

int dhcp_client_config ( u32  is_add,
u32  client_index,
vlib_main_t vm,
u32  sw_if_index,
u8 hostname,
u8 client_id,
dhcp_event_cb_t  event_callback,
u8  set_broadcast_flag,
ip_dscp_t  dscp,
u32  pid 
)

Add/Delete DHCP clients.

Definition at line 1031 of file client.c.

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

◆ dhcp_client_for_us()

int dhcp_client_for_us ( u32  bi,
vlib_buffer_t b,
ip4_header_t ip,
udp_header_t udp,
dhcp_header_t dhcp 
)

Definition at line 276 of file client.c.

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

◆ dhcp_client_init()

static clib_error_t* dhcp_client_init ( vlib_main_t vm)
static

Definition at line 1241 of file client.c.

+ Here is the call graph for this function:

◆ dhcp_client_proc_callback()

static void dhcp_client_proc_callback ( uword client_index)
static

Definition at line 208 of file client.c.

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

◆ dhcp_client_process()

static uword dhcp_client_process ( vlib_main_t vm,
vlib_node_runtime_t rt,
vlib_frame_t f 
)
static

Definition at line 843 of file client.c.

+ Here is the call graph for this function:

◆ dhcp_client_release_address()

static void dhcp_client_release_address ( dhcp_client_main_t dcm,
dhcp_client_t c 
)
static

Definition at line 172 of file client.c.

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

◆ dhcp_client_reset()

static void dhcp_client_reset ( dhcp_client_main_t dcm,
dhcp_client_t c 
)
static

Definition at line 247 of file client.c.

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

◆ dhcp_client_set_command_fn()

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

Definition at line 1132 of file client.c.

+ Here is the call graph for this function:

◆ dhcp_client_sm()

static f64 dhcp_client_sm ( f64  now,
f64  timeout,
uword  pool_index 
)
static

Definition at line 798 of file client.c.

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

◆ dhcp_client_walk()

void dhcp_client_walk ( dhcp_client_walk_cb_t  cb,
void *  ctx 
)

Walk (visit each) DHCP client configuration.

Parameters
cbThe callback function invoked as each client is visited
ctxContext data passed back to the client in the invocation of the callback.

Definition at line 1116 of file client.c.

+ Here is the caller graph for this function:

◆ dhcp_discover_state()

static int dhcp_discover_state ( dhcp_client_main_t dcm,
dhcp_client_t c,
f64  now 
)
static

Definition at line 691 of file client.c.

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

◆ dhcp_request_state()

static int dhcp_request_state ( dhcp_client_main_t dcm,
dhcp_client_t c,
f64  now 
)
static

Definition at line 727 of file client.c.

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

◆ format_dhcp_client()

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

Definition at line 85 of file client.c.

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

◆ format_dhcp_client_state()

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

Definition at line 63 of file client.c.

+ Here is the caller graph for this function:

◆ send_dhcp_pkt()

static void send_dhcp_pkt ( dhcp_client_main_t dcm,
dhcp_client_t c,
dhcp_packet_type_t  type,
int  is_broadcast 
)
static

Definition at line 462 of file client.c.

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

◆ show_dhcp_client_command_fn()

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

Definition at line 915 of file client.c.

+ Here is the call graph for this function:

Variable Documentation

◆ dhcp_client_main

dhcp_client_main_t dhcp_client_main

Definition at line 24 of file client.c.

◆ dhcp_client_process_node

static vlib_node_registration_t dhcp_client_process_node
static
Initial value:
= {
.function = dhcp_client_process,
.name = "dhcp-client-process",
.process_log2_n_stack_bytes = 16,
}

(constructor) VLIB_REGISTER_NODE (dhcp_client_process_node)

Definition at line 25 of file client.c.

◆ dhcp_client_process_stat_strings

char* dhcp_client_process_stat_strings[]
static
Initial value:
= {
#define _(sym,string)
"DHCP unknown packets sent",
}

Definition at line 55 of file client.c.

◆ dhcp_client_set_command

vlib_cli_command_t dhcp_client_set_command
static
Initial value:
= {
.path = "set dhcp client",
.short_help = "set dhcp client [del] intfc <interface> [hostname <name>]",
}

(constructor) VLIB_CLI_COMMAND (dhcp_client_set_command)

Definition at line 1233 of file client.c.

◆ dhcp_logger

vlib_log_class_t dhcp_logger

Definition at line 22 of file client.c.

◆ show_dhcp_client_command

vlib_cli_command_t show_dhcp_client_command
static
Initial value:
= {
.path = "show dhcp client",
.short_help = "show dhcp client [intfc <intfc>][verbose]",
}

(constructor) VLIB_CLI_COMMAND (show_dhcp_client_command)

Definition at line 959 of file client.c.

dhcp_client_set_command_fn
static clib_error_t * dhcp_client_set_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: client.c:1132
show_dhcp_client_command_fn
static clib_error_t * show_dhcp_client_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: client.c:915
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
foreach_dhcp_error_counter
#define foreach_dhcp_error_counter
Definition: client.c:39
VLIB_NODE_TYPE_PROCESS
@ VLIB_NODE_TYPE_PROCESS
Definition: node.h:84
dhcp_client_process_stat_strings
static char * dhcp_client_process_stat_strings[]
Definition: client.c:55
dhcp_client_process
static uword dhcp_client_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
Definition: client.c:843
foreach_dhcp_sent_packet_stat
#define foreach_dhcp_sent_packet_stat
Definition: client.c:33