FD.io VPP  v20.05.1-6-gf53edbc3b
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_interface_t_
 Per-interface ARP configuration and state. More...
 
struct  ethernet_arp_main_t
 
struct  ethernet_arp_input_trace_t
 
struct  pg_ethernet_arp_header_t
 

Macros

#define foreach_arp_disabled_error   _ (DISABLED, "ARP Disabled on this interface") \
 

Typedefs

typedef struct ethernet_arp_interface_t_ ethernet_arp_interface_t
 Per-interface ARP configuration and state. More...
 
typedef enum arp_input_next_t_ arp_input_next_t
 
typedef enum arp_disabled_next_t_ arp_disabled_next_t
 

Enumerations

enum  arp_input_next_t_ { ARP_INPUT_NEXT_DROP, ARP_INPUT_NEXT_DISABLED, ARP_INPUT_N_NEXT }
 
enum  arp_disabled_next_t_ { ARP_DISABLED_NEXT_DROP, ARP_DISABLED_N_NEXT }
 
enum  arp_disabled_error_t { ARP_DISABLED_N_ERROR }
 
enum  arp_dst_fib_type { ARP_DST_FIB_NONE, ARP_DST_FIB_ADJ, ARP_DST_FIB_CONN }
 

Functions

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_input_trace (u8 *s, va_list *va)
 
static int arp_is_enabled (ethernet_arp_main_t *am, u32 sw_if_index)
 
static void arp_enable (ethernet_arp_main_t *am, u32 sw_if_index)
 
static void arp_disable (ethernet_arp_main_t *am, u32 sw_if_index)
 
static int arp_unnumbered (vlib_buffer_t *p0, u32 input_sw_if_index, u32 conn_sw_if_index)
 
static u32 arp_learn (u32 sw_if_index, const ethernet_arp_ip4_over_ethernet_address_t *addr)
 
static uword arp_input (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static uword arp_disabled (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static enum arp_dst_fib_type arp_dst_fib_check (const fib_node_index_t fei, fib_entry_flag_t *flags)
 
static uword arp_reply (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 VNET_FEATURE_ARC_INIT (arp_feat, static)
 
 VNET_FEATURE_INIT (arp_reply_feat_node, static)
 
 VNET_FEATURE_INIT (arp_proxy_feat_node, static)
 
 VNET_FEATURE_INIT (arp_disabled_feat_node, static)
 
 VNET_FEATURE_INIT (arp_drop_feat_node, static)
 
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)
 
static void arp_enable_disable_interface (ip4_main_t *im, uword opaque, u32 sw_if_index, u32 is_enable)
 
static clib_error_tvnet_arp_add_del_sw_interface (vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
 
 VNET_SW_INTERFACE_ADD_DEL_FUNCTION (vnet_arp_add_del_sw_interface)
 
static clib_error_tethernet_arp_init (vlib_main_t *vm)
 

Variables

static ethernet_arp_main_t ethernet_arp_main
 
static const u8 vrrp_prefix [] = { 0x00, 0x00, 0x5E, 0x00, 0x01 }
 
static char * arp_disabled_error_strings []
 
static char * ethernet_arp_error_strings []
 
static vlib_node_registration_t arp_input_node
 (constructor) VLIB_REGISTER_NODE (arp_input_node) More...
 
static vlib_node_registration_t arp_disabled_node
 (constructor) VLIB_REGISTER_NODE (arp_disabled_node) More...
 
static vlib_node_registration_t arp_reply_node
 (constructor) VLIB_REGISTER_NODE (arp_reply_node) More...
 
static const ip_neighbor_vft_t arp_vft
 

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

◆ foreach_arp_disabled_error

#define foreach_arp_disabled_error   _ (DISABLED, "ARP Disabled on this interface") \

Definition at line 287 of file arp.c.

Typedef Documentation

◆ arp_disabled_next_t

◆ arp_input_next_t

◆ ethernet_arp_interface_t

Per-interface ARP configuration and state.

Enumeration Type Documentation

◆ arp_disabled_error_t

Enumerator
ARP_DISABLED_N_ERROR 

Definition at line 290 of file arp.c.

◆ arp_disabled_next_t_

Enumerator
ARP_DISABLED_NEXT_DROP 
ARP_DISABLED_N_NEXT 

Definition at line 281 of file arp.c.

◆ arp_dst_fib_type

Enumerator
ARP_DST_FIB_NONE 
ARP_DST_FIB_ADJ 
ARP_DST_FIB_CONN 

Definition at line 351 of file arp.c.

◆ arp_input_next_t_

Enumerator
ARP_INPUT_NEXT_DROP 
ARP_INPUT_NEXT_DISABLED 
ARP_INPUT_N_NEXT 

Definition at line 204 of file arp.c.

Function Documentation

◆ arp_disable()

static void arp_disable ( ethernet_arp_main_t am,
u32  sw_if_index 
)
static

Definition at line 151 of file arp.c.

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

◆ arp_disabled()

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

Definition at line 305 of file arp.c.

+ Here is the call graph for this function:

◆ arp_dst_fib_check()

static enum arp_dst_fib_type arp_dst_fib_check ( const fib_node_index_t  fei,
fib_entry_flag_t flags 
)
static

Definition at line 364 of file arp.c.

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

◆ arp_enable()

static void arp_enable ( ethernet_arp_main_t am,
u32  sw_if_index 
)
static

Definition at line 136 of file arp.c.

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

◆ arp_enable_disable_interface()

static void arp_enable_disable_interface ( ip4_main_t im,
uword  opaque,
u32  sw_if_index,
u32  is_enable 
)
static

Definition at line 837 of file arp.c.

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

◆ arp_input()

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

Definition at line 212 of file arp.c.

+ Here is the call graph for this function:

◆ arp_is_enabled()

static int arp_is_enabled ( ethernet_arp_main_t am,
u32  sw_if_index 
)
static

Definition at line 127 of file arp.c.

+ Here is the caller graph for this function:

◆ arp_learn()

static u32 arp_learn ( u32  sw_if_index,
const ethernet_arp_ip4_over_ethernet_address_t *  addr 
)
inlinestatic

Definition at line 189 of file arp.c.

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

◆ arp_reply()

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

Definition at line 384 of file arp.c.

+ Here is the call graph for this function:

◆ arp_unnumbered()

static int arp_unnumbered ( vlib_buffer_t p0,
u32  input_sw_if_index,
u32  conn_sw_if_index 
)
static

Definition at line 164 of file arp.c.

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

◆ ethernet_arp_init()

static clib_error_t* ethernet_arp_init ( vlib_main_t vm)
static

Definition at line 879 of file arp.c.

+ Here is the call graph for this function:

◆ format_ethernet_arp_input_trace()

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

Definition at line 113 of file arp.c.

+ Here is the call graph for this function:

◆ pg_ethernet_arp_header_init()

static void pg_ethernet_arp_header_init ( pg_ethernet_arp_header_t p)
inlinestatic

Definition at line 781 of file arp.c.

+ Here is the caller graph for this function:

◆ unformat_ethernet_arp_opcode_host_byte_order()

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

Definition at line 67 of file arp.c.

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

◆ unformat_ethernet_arp_opcode_net_byte_order()

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

Definition at line 95 of file arp.c.

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

◆ unformat_pg_arp_header()

uword unformat_pg_arp_header ( unformat_input_t input,
va_list *  args 
)

Definition at line 798 of file arp.c.

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

◆ vnet_arp_add_del_sw_interface()

static clib_error_t* vnet_arp_add_del_sw_interface ( vnet_main_t vnm,
u32  sw_if_index,
u32  is_add 
)
static

Definition at line 852 of file arp.c.

+ Here is the call graph for this function:

◆ VNET_FEATURE_ARC_INIT()

VNET_FEATURE_ARC_INIT ( arp_feat  ,
static   
)

◆ VNET_FEATURE_INIT() [1/4]

VNET_FEATURE_INIT ( arp_reply_feat_node  ,
static   
)

◆ VNET_FEATURE_INIT() [2/4]

VNET_FEATURE_INIT ( arp_proxy_feat_node  ,
static   
)

◆ VNET_FEATURE_INIT() [3/4]

VNET_FEATURE_INIT ( arp_disabled_feat_node  ,
static   
)

◆ VNET_FEATURE_INIT() [4/4]

VNET_FEATURE_INIT ( arp_drop_feat_node  ,
static   
)

◆ VNET_SW_INTERFACE_ADD_DEL_FUNCTION()

VNET_SW_INTERFACE_ADD_DEL_FUNCTION ( vnet_arp_add_del_sw_interface  )
+ Here is the caller graph for this function:

Variable Documentation

◆ arp_disabled_error_strings

char* arp_disabled_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_arp_disabled_error
Definition: arp.c:287

Definition at line 298 of file arp.c.

◆ arp_disabled_node

vlib_node_registration_t arp_disabled_node
static
Initial value:
=
{
.function = arp_disabled,
.name = "arp-disabled",
.vector_size = sizeof (u32),
.n_errors = ARP_DISABLED_N_ERROR,
.error_strings = arp_disabled_error_strings,
.n_next_nodes = ARP_DISABLED_N_NEXT,
.next_nodes = {
[ARP_INPUT_NEXT_DROP] = "error-drop",
},
.format_buffer = format_ethernet_arp_header,
}
static uword arp_disabled(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: arp.c:305
static u8 * format_ethernet_arp_input_trace(u8 *s, va_list *va)
Definition: arp.c:113
unsigned int u32
Definition: types.h:88
static char * arp_disabled_error_strings[]
Definition: arp.c:298
u8 * format_ethernet_arp_header(u8 *s, va_list *va)
Definition: arp_packet.c:59

(constructor) VLIB_REGISTER_NODE (arp_disabled_node)

Definition at line 697 of file arp.c.

◆ arp_input_node

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_DISABLED] = "arp-disabled",
},
.format_buffer = format_ethernet_arp_header,
}
static uword arp_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: arp.c:212
static u8 * format_ethernet_arp_input_trace(u8 *s, va_list *va)
Definition: arp.c:113
unsigned int u32
Definition: types.h:88
static char * ethernet_arp_error_strings[]
Definition: arp.c:673
u8 * format_ethernet_arp_header(u8 *s, va_list *va)
Definition: arp_packet.c:59

(constructor) VLIB_REGISTER_NODE (arp_input_node)

Definition at line 681 of file arp.c.

◆ arp_reply_node

vlib_node_registration_t arp_reply_node
static
Initial value:
=
{
.function = arp_reply,
.name = "arp-reply",
.vector_size = sizeof (u32),
.n_errors = ETHERNET_ARP_N_ERROR,
.error_strings = ethernet_arp_error_strings,
.n_next_nodes = ARP_REPLY_N_NEXT,
.next_nodes = {
[ARP_REPLY_NEXT_DROP] = "error-drop",
[ARP_REPLY_NEXT_REPLY_TX] = "interface-output",
},
.format_buffer = format_ethernet_arp_header,
}
static uword arp_reply(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: arp.c:384
static u8 * format_ethernet_arp_input_trace(u8 *s, va_list *va)
Definition: arp.c:113
unsigned int u32
Definition: types.h:88
static char * ethernet_arp_error_strings[]
Definition: arp.c:673
u8 * format_ethernet_arp_header(u8 *s, va_list *va)
Definition: arp_packet.c:59

(constructor) VLIB_REGISTER_NODE (arp_reply_node)

Definition at line 712 of file arp.c.

◆ arp_vft

const ip_neighbor_vft_t arp_vft
static
Initial value:
= {
.inv_proxy4_add = arp_proxy_add,
.inv_proxy4_del = arp_proxy_del,
.inv_proxy4_enable = arp_proxy_disable,
.inv_proxy4_disable = arp_proxy_disable,
}
int arp_proxy_del(u32 fib_index, const ip4_address_t *lo_addr, const ip4_address_t *hi_addr)
Definition: arp_proxy.c:134
int arp_proxy_add(u32 fib_index, const ip4_address_t *lo_addr, const ip4_address_t *hi_addr)
Definition: arp_proxy.c:127
int arp_proxy_disable(u32 sw_if_index)
Definition: arp_proxy.c:55

Definition at line 871 of file arp.c.

◆ ethernet_arp_error_strings

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

Definition at line 673 of file arp.c.

◆ ethernet_arp_main

ethernet_arp_main_t ethernet_arp_main
static

Definition at line 62 of file arp.c.

◆ vrrp_prefix

const u8 vrrp_prefix[] = { 0x00, 0x00, 0x5E, 0x00, 0x01 }
static

Definition at line 64 of file arp.c.