FD.io VPP  v16.09
Vector Packet Processing
arp.c File Reference

IPv4 ARP. More...

+ Include dependency graph for arp.c:

Go to the source code of this file.

Data Structures

struct  ethernet_arp_ip4_key_t
 
struct  ethernet_arp_ip4_entry_t
 
struct  ethernet_proxy_arp_t
 
struct  pending_resolution_t
 
struct  ethernet_arp_main_t
 
struct  ethernet_arp_input_trace_t
 
struct  vnet_arp_set_ip4_over_ethernet_rpc_args_t
 
struct  pg_ethernet_arp_header_t
 

Macros

#define ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC   (1 << 0)
 
#define ETHERNET_ARP_IP4_ENTRY_FLAG_GLEAN   (2 << 0)
 
#define foreach_ethernet_arp_error
 

Enumerations

enum  arp_input_next_t { ARP_INPUT_NEXT_DROP, ARP_INPUT_NEXT_REPLY_TX, ARP_INPUT_N_NEXT }
 
enum  ethernet_arp_input_error_t { ETHERNET_ARP_N_ERROR }
 
enum  arp_term_next_t { ARP_TERM_NEXT_L2_OUTPUT, ARP_TERM_NEXT_DROP, ARP_TERM_N_NEXT }
 

Functions

void vl_api_rpc_call_main_thread (void *fp, u8 *data, u32 data_length)
 
static u8format_ethernet_arp_hardware_type (u8 *s, va_list *va)
 
static u8format_ethernet_arp_opcode (u8 *s, va_list *va)
 
static uword unformat_ethernet_arp_opcode_host_byte_order (unformat_input_t *input, va_list *args)
 
static uword unformat_ethernet_arp_opcode_net_byte_order (unformat_input_t *input, va_list *args)
 
static u8format_ethernet_arp_header (u8 *s, va_list *va)
 
static u8format_ethernet_arp_ip4_entry (u8 *s, va_list *va)
 
static u8format_ethernet_arp_input_trace (u8 *s, va_list *va)
 
clib_error_tethernet_arp_sw_interface_up_down (vnet_main_t *vnm, u32 sw_if_index, u32 flags)
 
 VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION (ethernet_arp_sw_interface_up_down)
 
static int vnet_arp_set_ip4_over_ethernet_internal (vnet_main_t *vnm, u32 sw_if_index, u32 fib_index, void *a_arg, int is_static)
 
static int vnet_arp_unset_ip4_over_ethernet_internal (vnet_main_t *vnm, u32 sw_if_index, u32 fib_index, void *a_arg)
 
static void set_ip4_over_ethernet_rpc_callback (vnet_arp_set_ip4_over_ethernet_rpc_args_t *a)
 
int vnet_arp_set_ip4_over_ethernet (vnet_main_t *vnm, u32 sw_if_index, u32 fib_index, void *a_arg, int is_static)
 
void vnet_register_ip4_arp_resolution_event (vnet_main_t *vnm, void *address_arg, uword node_index, uword type_opaque, uword data)
 
int vnet_add_del_ip4_arp_change_event (vnet_main_t *vnm, void *data_callback, u32 pid, void *address_arg, uword node_index, uword type_opaque, uword data, int is_add)
 
ip4_address_tip4_interface_first_address (ip4_main_t *im, u32 sw_if_index, ip_interface_address_t **result_ia)
 
static void unset_random_arp_entry (void)
 
static void arp_unnumbered (vlib_buffer_t *p0, u32 pi0, ethernet_header_t *eth0, ip_interface_address_t *ifa0)
 
static uword arp_input (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static int ip4_arp_entry_sort (void *a1, void *a2)
 
static clib_error_tshow_ip4_arp (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static void pg_ethernet_arp_header_init (pg_ethernet_arp_header_t *p)
 
uword unformat_pg_arp_header (unformat_input_t *input, va_list *args)
 
clib_error_tip4_set_arp_limit (u32 arp_limit)
 
static void arp_ip4_entry_del_adj (ethernet_arp_ip4_entry_t *e, u32 adj_index)
 
static void arp_ip4_entry_add_adj (ethernet_arp_ip4_entry_t *e, u32 adj_index)
 
static void arp_add_del_adj_cb (struct ip_lookup_main_t *lm, u32 adj_index, ip_adjacency_t *adj, u32 is_del)
 
static clib_error_tethernet_arp_init (vlib_main_t *vm)
 
int vnet_arp_unset_ip4_over_ethernet (vnet_main_t *vnm, u32 sw_if_index, u32 fib_index, void *a_arg)
 
static void increment_ip4_and_mac_address (ethernet_arp_ip4_over_ethernet_address_t *a)
 
int vnet_proxy_arp_add_del (ip4_address_t *lo_addr, ip4_address_t *hi_addr, u32 fib_index, int is_del)
 
int vnet_proxy_arp_fib_reset (u32 fib_id)
 
u32 vnet_arp_glean_add (u32 fib_index, void *next_hop_arg)
 
static clib_error_tip_arp_add_del_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tset_int_proxy_arp_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static uword arp_term_l2bd (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
clib_error_tarp_term_init (vlib_main_t *vm)
 

Variables

static ethernet_arp_main_t ethernet_arp_main
 
static char * ethernet_arp_error_strings []
 
static vlib_node_registration_t arp_input_node
 (constructor) VLIB_REGISTER_NODE (arp_input_node) More...
 
static vlib_cli_command_t show_ip4_arp_command
 (constructor) VLIB_CLI_COMMAND (show_ip4_arp_command) More...
 
static vlib_cli_command_t ip_arp_add_del_command
 (constructor) VLIB_CLI_COMMAND (ip_arp_add_del_command) More...
 
static vlib_cli_command_t set_int_proxy_enable_command
 (constructor) VLIB_CLI_COMMAND (set_int_proxy_enable_command) More...
 
u32 arp_term_next_node_index [32]
 
static vlib_node_registration_t arp_term_l2bd_node
 (constructor) VLIB_REGISTER_NODE (arp_term_l2bd_node) More...
 

Detailed Description

IPv4 ARP.

This file contains code to manage the IPv4 ARP tables (IP Address to MAC Address lookup).

Definition in file arp.c.

Macro Definition Documentation

#define ETHERNET_ARP_IP4_ENTRY_FLAG_GLEAN   (2 << 0)

Definition at line 49 of file arp.c.

#define ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC   (1 << 0)

Definition at line 48 of file arp.c.

#define foreach_ethernet_arp_error
Value:
_ (replies_sent, "ARP replies sent") \
_ (l2_type_not_ethernet, "L2 type not ethernet") \
_ (l3_type_not_ip4, "L3 type not IP4") \
_ (l3_src_address_not_local, "IP4 source address not local to subnet") \
_ (l3_dst_address_not_local, "IP4 destination address not local to subnet") \
_ (l3_src_address_is_local, "IP4 source address matches local interface") \
_ (l3_src_address_learned, "ARP request IP4 source address learned") \
_ (replies_received, "ARP replies received") \
_ (opcode_not_request, "ARP opcode not request") \
_ (proxy_arp_replies_sent, "Proxy ARP replies sent") \
_ (l2_address_mismatch, "ARP hw addr does not match L2 frame src addr") \
_ (missing_interface_address, "ARP missing interface address") \
_ (gratuitous_arp, "ARP probe or announcement dropped") \

Definition at line 659 of file arp.c.

Enumeration Type Documentation

Enumerator
ARP_INPUT_NEXT_DROP 
ARP_INPUT_NEXT_REPLY_TX 
ARP_INPUT_N_NEXT 

Definition at line 652 of file arp.c.

Enumerator
ARP_TERM_NEXT_L2_OUTPUT 
ARP_TERM_NEXT_DROP 
ARP_TERM_N_NEXT 

Definition at line 1903 of file arp.c.

Enumerator
ETHERNET_ARP_N_ERROR 

Definition at line 674 of file arp.c.

Function Documentation

static void arp_add_del_adj_cb ( struct ip_lookup_main_t lm,
u32  adj_index,
ip_adjacency_t adj,
u32  is_del 
)
static

Definition at line 1360 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 884 of file arp.c.

+ Here is the call graph for this function:

static void arp_ip4_entry_add_adj ( ethernet_arp_ip4_entry_t e,
u32  adj_index 
)
static

Definition at line 1350 of file arp.c.

+ Here is the caller graph for this function:

static void arp_ip4_entry_del_adj ( ethernet_arp_ip4_entry_t e,
u32  adj_index 
)
static

Definition at line 1332 of file arp.c.

+ Here is the caller graph for this function:

clib_error_t* arp_term_init ( vlib_main_t vm)

Definition at line 2126 of file arp.c.

+ Here is the call graph for this function:

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

Definition at line 1913 of file arp.c.

+ Here is the call graph for this function:

static void arp_unnumbered ( vlib_buffer_t p0,
u32  pi0,
ethernet_header_t eth0,
ip_interface_address_t ifa0 
)
static

Definition at line 739 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* ethernet_arp_init ( vlib_main_t vm)
static

Definition at line 1409 of file arp.c.

+ Here is the call graph for this function:

clib_error_t* ethernet_arp_sw_interface_up_down ( vnet_main_t vnm,
u32  sw_if_index,
u32  flags 
)

Definition at line 280 of file arp.c.

+ Here is the call graph for this function:

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

Definition at line 102 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 179 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 266 of file arp.c.

+ Here is the call graph for this function:

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

Definition at line 226 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 120 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void increment_ip4_and_mac_address ( ethernet_arp_ip4_over_ethernet_address_t *  a)
static

Definition at line 1548 of file arp.c.

+ Here is the caller graph for this function:

static int ip4_arp_entry_sort ( void *  a1,
void *  a2 
)
static

Definition at line 1169 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ip4_address_t* ip4_interface_first_address ( ip4_main_t im,
u32  sw_if_index,
ip_interface_address_t **  result_ia 
)

Definition at line 684 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* ip4_set_arp_limit ( u32  arp_limit)

Definition at line 1323 of file arp.c.

+ Here is the caller graph for this function:

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

Definition at line 1697 of file arp.c.

+ Here is the call graph for this function:

static void pg_ethernet_arp_header_init ( pg_ethernet_arp_header_t p)
inlinestatic

Definition at line 1270 of file arp.c.

+ Here is the caller graph for this function:

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

Definition at line 1832 of file arp.c.

+ Here is the call graph for this function:

static void set_ip4_over_ethernet_rpc_callback ( vnet_arp_set_ip4_over_ethernet_rpc_args_t a)
static

Definition at line 346 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1185 of file arp.c.

+ Here is the call graph for this function:

static uword unformat_ethernet_arp_opcode_host_byte_order ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 138 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword unformat_ethernet_arp_opcode_net_byte_order ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 166 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword unformat_pg_arp_header ( unformat_input_t input,
va_list *  args 
)

Definition at line 1287 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void unset_random_arp_entry ( void  )
static

Definition at line 707 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vl_api_rpc_call_main_thread ( void *  fp,
u8 data,
u32  data_length 
)

Definition at line 1321 of file memory_vlib.c.

+ Here is the caller graph for this function:

int vnet_add_del_ip4_arp_change_event ( vnet_main_t vnm,
void *  data_callback,
u32  pid,
void *  address_arg,
uword  node_index,
uword  type_opaque,
uword  data,
int  is_add 
)

Definition at line 570 of file arp.c.

+ Here is the caller graph for this function:

u32 vnet_arp_glean_add ( u32  fib_index,
void *  next_hop_arg 
)

Definition at line 1646 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_arp_set_ip4_over_ethernet ( vnet_main_t vnm,
u32  sw_if_index,
u32  fib_index,
void *  a_arg,
int  is_static 
)

Definition at line 363 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_arp_set_ip4_over_ethernet_internal ( vnet_main_t vnm,
u32  sw_if_index,
u32  fib_index,
void *  a_arg,
int  is_static 
)
static

Definition at line 382 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_arp_unset_ip4_over_ethernet ( vnet_main_t vnm,
u32  sw_if_index,
u32  fib_index,
void *  a_arg 
)

Definition at line 1461 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int vnet_arp_unset_ip4_over_ethernet_internal ( vnet_main_t vnm,
u32  sw_if_index,
u32  fib_index,
void *  a_arg 
)
inlinestatic

Definition at line 1478 of file arp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_proxy_arp_add_del ( ip4_address_t lo_addr,
ip4_address_t hi_addr,
u32  fib_index,
int  is_del 
)

Definition at line 1571 of file arp.c.

+ Here is the caller graph for this function:

int vnet_proxy_arp_fib_reset ( u32  fib_id)

Definition at line 1612 of file arp.c.

+ Here is the caller graph for this function:

void vnet_register_ip4_arp_resolution_event ( vnet_main_t vnm,
void *  address_arg,
uword  node_index,
uword  type_opaque,
uword  data 
)

Definition at line 539 of file arp.c.

+ Here is the caller graph for this function:

VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION ( ethernet_arp_sw_interface_up_down  )

+ Here is the caller graph for this function:

Variable Documentation

vlib_node_registration_t arp_input_node
static
Initial value:
=
{
.function = arp_input,
.name = "arp-input",
.vector_size = sizeof (u32),
.n_errors = ETHERNET_ARP_N_ERROR,
.error_strings = ethernet_arp_error_strings,
.n_next_nodes = ARP_INPUT_N_NEXT,
.next_nodes = {
[ARP_INPUT_NEXT_DROP] = "error-drop",
[ARP_INPUT_NEXT_REPLY_TX] = "interface-output",
},
.format_buffer = format_ethernet_arp_header,
}
static u8 * format_ethernet_arp_header(u8 *s, va_list *va)
Definition: arp.c:179
static uword arp_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: arp.c:884
static u8 * format_ethernet_arp_input_trace(u8 *s, va_list *va)
Definition: arp.c:266
static char * ethernet_arp_error_strings[]
Definition: arp.c:1144
unsigned int u32
Definition: types.h:88

(constructor) VLIB_REGISTER_NODE (arp_input_node)

Definition at line 1151 of file arp.c.

vlib_node_registration_t arp_term_l2bd_node
static
Initial value:
= {
.function = arp_term_l2bd,
.name = "arp-term-l2bd",
.vector_size = sizeof (u32),
.n_errors = ETHERNET_ARP_N_ERROR,
.error_strings = ethernet_arp_error_strings,
.n_next_nodes = ARP_TERM_N_NEXT,
.next_nodes = {
[ARP_TERM_NEXT_L2_OUTPUT] = "l2-output",
[ARP_TERM_NEXT_DROP] = "error-drop",
},
.format_buffer = format_ethernet_arp_header,
}
static uword arp_term_l2bd(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: arp.c:1913
static u8 * format_ethernet_arp_header(u8 *s, va_list *va)
Definition: arp.c:179
static u8 * format_ethernet_arp_input_trace(u8 *s, va_list *va)
Definition: arp.c:266
static char * ethernet_arp_error_strings[]
Definition: arp.c:1144
unsigned int u32
Definition: types.h:88

(constructor) VLIB_REGISTER_NODE (arp_term_l2bd_node)

Definition at line 2109 of file arp.c.

u32 arp_term_next_node_index[32]

Definition at line 1910 of file arp.c.

char* ethernet_arp_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_ethernet_arp_error
Definition: arp.c:659

Definition at line 1144 of file arp.c.

ethernet_arp_main_t ethernet_arp_main
static

Definition at line 99 of file arp.c.

vlib_cli_command_t ip_arp_add_del_command
static
Initial value:
= {
.path = "set ip arp",
.short_help =
"set ip arp [del] <intfc> <ip-address> <mac-address> [static] [count <count>] [fib-id <fib-id>] [proxy <lo-addr> - <hi-addr>]",
}
static clib_error_t * ip_arp_add_del_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: arp.c:1697

(constructor) VLIB_CLI_COMMAND (ip_arp_add_del_command)

Definition at line 1823 of file arp.c.

vlib_cli_command_t set_int_proxy_enable_command
static
Initial value:
= {
.path = "set interface proxy-arp",
.short_help =
"set interface proxy-arp <intfc> [enable|disable]",
}
static clib_error_t * set_int_proxy_arp_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: arp.c:1832

(constructor) VLIB_CLI_COMMAND (set_int_proxy_enable_command)

Definition at line 1890 of file arp.c.

vlib_cli_command_t show_ip4_arp_command
static
Initial value:
= {
.path = "show ip arp",
.function = show_ip4_arp,
.short_help = "show ip arp",
}
static clib_error_t * show_ip4_arp(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: arp.c:1185

(constructor) VLIB_CLI_COMMAND (show_ip4_arp_command)

Definition at line 1250 of file arp.c.