FD.io VPP  v16.09
Vector Packet Processing
ip4.h File Reference
+ Include dependency graph for ip4.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ip4_fib_t
 
struct  ip4_add_del_route_callback_t
 
struct  ip4_add_del_interface_address_callback_t
 
struct  ip4_main_t
 IPv4 main type. More...
 
struct  ip4_add_del_route_args_t
 

Macros

#define VNET_IP4_UNICAST_FEATURE_INIT(x, ...)
 
#define VNET_IP4_MULTICAST_FEATURE_INIT(x, ...)
 
#define IP4_ROUTE_FLAG_ADD   (0 << 0)
 
#define IP4_ROUTE_FLAG_DEL   (1 << 0)
 
#define IP4_ROUTE_FLAG_TABLE_ID   (0 << 1)
 
#define IP4_ROUTE_FLAG_FIB_INDEX   (1 << 1)
 
#define IP4_ROUTE_FLAG_KEEP_OLD_ADJACENCY   (1 << 2)
 
#define IP4_ROUTE_FLAG_NO_REDISTRIBUTE   (1 << 3)
 
#define IP4_ROUTE_FLAG_NOT_LAST_IN_GROUP   (1 << 4)
 
#define IP4_ROUTE_FLAG_NEIGHBOR   (1 << 5)
 

Typedefs

typedef struct ip4_fib_t ip4_fib_t
 
typedef void( ip4_add_del_route_function_t) (struct ip4_main_t *im, uword opaque, ip4_fib_t *fib, u32 flags, ip4_address_t *address, u32 address_length, void *old_result, void *new_result)
 
typedef void( ip4_add_del_interface_address_function_t) (struct ip4_main_t *im, uword opaque, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 if_address_index, u32 is_del)
 
typedef struct ip4_main_t ip4_main_t
 IPv4 main type. More...
 

Functions

u32 ip4_fib_lookup_with_table (ip4_main_t *im, u32 fib_index, ip4_address_t *dst, u32 disable_default_route)
 
static u32 ip4_fib_lookup_buffer (ip4_main_t *im, u32 fib_index, ip4_address_t *dst, vlib_buffer_t *b)
 
static u32 ip4_fib_lookup (ip4_main_t *im, u32 sw_if_index, ip4_address_t *dst)
 
static uword ip4_destination_matches_route (ip4_main_t *im, ip4_address_t *key, ip4_address_t *dest, uword dest_length)
 
static uword ip4_destination_matches_interface (ip4_main_t *im, ip4_address_t *key, ip_interface_address_t *ia)
 
static uword ip4_unaligned_destination_matches_route (ip4_main_t *im, ip4_address_t *key, ip4_address_t *dest, uword dest_length)
 
static int ip4_src_address_for_packet (ip4_main_t *im, vlib_buffer_t *p, ip4_address_t *src, u32 sw_if_index)
 
static ip4_address_tip4_interface_address_matching_destination (ip4_main_t *im, ip4_address_t *dst, u32 sw_if_index, ip_interface_address_t **result_ia)
 
clib_error_tip4_add_del_interface_address (vlib_main_t *vm, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 is_del)
 
int ip4_address_compare (ip4_address_t *a1, ip4_address_t *a2)
 
ip4_fib_tfind_ip4_fib_by_table_index_or_id (ip4_main_t *im, u32 table_index_or_id, u32 flags)
 Get or create an IPv4 fib. More...
 
void ip4_add_del_route (ip4_main_t *im, ip4_add_del_route_args_t *args)
 
void ip4_add_del_route_next_hop (ip4_main_t *im, u32 flags, ip4_address_t *dst_address, u32 dst_address_length, ip4_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_weight, u32 adj_index, u32 explicit_fib_index)
 
u32 ip4_route_get_next_hop_adj (ip4_main_t *im, u32 fib_index, ip4_address_t *next_hop, u32 next_hop_sw_if_index, u32 explicit_fib_index)
 
void * ip4_get_route (ip4_main_t *im, u32 fib_index_or_table_id, u32 flags, u8 *address, u32 address_length)
 
void ip4_foreach_matching_route (ip4_main_t *im, u32 table_index_or_table_id, u32 flags, ip4_address_t *address, u32 address_length, ip4_address_t **results, u8 **result_lengths)
 
void ip4_delete_matching_routes (ip4_main_t *im, u32 table_index_or_table_id, u32 flags, ip4_address_t *address, u32 address_length)
 
void ip4_maybe_remap_adjacencies (ip4_main_t *im, u32 table_index_or_table_id, u32 flags)
 
void ip4_adjacency_set_interface_route (vnet_main_t *vnm, ip_adjacency_t *adj, u32 sw_if_index, u32 if_address_index)
 
ip4_address_tip4_interface_first_address (ip4_main_t *im, u32 sw_if_index, ip_interface_address_t **result_ia)
 
clib_error_tip4_probe_neighbor (vlib_main_t *vm, ip4_address_t *dst, u32 sw_if_index)
 
clib_error_tip4_set_arp_limit (u32 arp_limit)
 
uword ip4_udp_register_listener (vlib_main_t *vm, u16 dst_port, u32 next_node_index)
 
void ip4_icmp_register_type (vlib_main_t *vm, icmp4_type_t type, u32 node_index)
 
u16 ip4_tcp_udp_compute_checksum (vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
 
void ip4_register_protocol (u32 protocol, u32 node_index)
 
int vnet_set_ip4_flow_hash (u32 table_id, u32 flow_hash_config)
 
void ip4_mtrie_init (ip4_fib_mtrie_t *m)
 
int vnet_set_ip4_classify_intfc (vlib_main_t *vm, u32 sw_if_index, u32 table_index)
 
static u32 ip4_compute_flow_hash (ip4_header_t *ip, u32 flow_hash_config)
 

Variables

ip4_main_t ip4_main
 Global ip4 main structure. More...
 
vlib_node_registration_t ip4_input_node
 Global ip4 input node. More...
 
vlib_node_registration_t ip4_lookup_node
 (constructor) VLIB_REGISTER_NODE (ip4_lookup_node) More...
 
vlib_node_registration_t ip4_rewrite_node
 (constructor) VLIB_REGISTER_NODE (ip4_rewrite_node) More...
 
vlib_node_registration_t ip4_rewrite_local_node
 (constructor) VLIB_REGISTER_NODE (ip4_rewrite_local_node) More...
 
vlib_node_registration_t ip4_arp_node
 (constructor) VLIB_REGISTER_NODE (ip4_arp_node) More...
 
serialize_function_t serialize_vnet_ip4_main
 
serialize_function_t unserialize_vnet_ip4_main
 

Macro Definition Documentation

#define IP4_ROUTE_FLAG_ADD   (0 << 0)

Definition at line 308 of file ip4.h.

#define IP4_ROUTE_FLAG_DEL   (1 << 0)

Definition at line 309 of file ip4.h.

#define IP4_ROUTE_FLAG_FIB_INDEX   (1 << 1)

Definition at line 311 of file ip4.h.

#define IP4_ROUTE_FLAG_KEEP_OLD_ADJACENCY   (1 << 2)

Definition at line 312 of file ip4.h.

#define IP4_ROUTE_FLAG_NEIGHBOR   (1 << 5)

Definition at line 317 of file ip4.h.

#define IP4_ROUTE_FLAG_NO_REDISTRIBUTE   (1 << 3)

Definition at line 313 of file ip4.h.

#define IP4_ROUTE_FLAG_NOT_LAST_IN_GROUP   (1 << 4)

Definition at line 315 of file ip4.h.

#define IP4_ROUTE_FLAG_TABLE_ID   (0 << 1)

Definition at line 310 of file ip4.h.

#define VNET_IP4_MULTICAST_FEATURE_INIT (   x,
  ... 
)
Value:
__VA_ARGS__ vnet_ip_feature_registration_t mc_##x; \
static void __vnet_add_feature_registration_mc_##x (void) \
__attribute__((__constructor__)) ; \
static void __vnet_add_feature_registration_mc_##x (void) \
{ \
mc_##x.next = im->next_mc_feature; \
im->next_mc_feature = &mc_##x; \
} \
struct ip4_main_t ip4_main_t
IPv4 main type.
vnet_ip_feature_registration_t * next_mc_feature
Definition: ip4.h:143
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1578
struct _vnet_ip_feature_registration vnet_ip_feature_registration_t

Definition at line 200 of file ip4.h.

#define VNET_IP4_UNICAST_FEATURE_INIT (   x,
  ... 
)
Value:
__VA_ARGS__ vnet_ip_feature_registration_t uc_##x; \
static void __vnet_add_feature_registration_uc_##x (void) \
__attribute__((__constructor__)) ; \
static void __vnet_add_feature_registration_uc_##x (void) \
{ \
uc_##x.next = im->next_uc_feature; \
im->next_uc_feature = &uc_##x; \
} \
vnet_ip_feature_registration_t * next_uc_feature
Feature path configuration lists.
Definition: ip4.h:142
struct ip4_main_t ip4_main_t
IPv4 main type.
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1578
struct _vnet_ip_feature_registration vnet_ip_feature_registration_t

Definition at line 188 of file ip4.h.

Typedef Documentation

typedef void( ip4_add_del_interface_address_function_t) (struct ip4_main_t *im, uword opaque, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 if_address_index, u32 is_del)

Definition at line 92 of file ip4.h.

typedef void( ip4_add_del_route_function_t) (struct ip4_main_t *im, uword opaque, ip4_fib_t *fib, u32 flags, ip4_address_t *address, u32 address_length, void *old_result, void *new_result)

Definition at line 76 of file ip4.h.

typedef struct ip4_fib_t ip4_fib_t
typedef struct ip4_main_t ip4_main_t

IPv4 main type.

State of IPv4 VPP processing including:

  • FIBs
  • Feature indices used in feature topological sort
  • Feature node run time references

Function Documentation

ip4_fib_t* find_ip4_fib_by_table_index_or_id ( ip4_main_t im,
u32  table_index_or_id,
u32  flags 
)

Get or create an IPv4 fib.

Get or create an IPv4 fib with the provided fib ID or index. The fib ID is a possibly-sparse user-defined value while the fib index defines the position of the fib in the fib vector.

Parameters
imip4_main pointer.
table_index_or_idThe table index if IP4_ROUTE_FLAG_FIB_INDEX bit is set in flags. Otherwise, when set to ~0, an arbitrary and unused fib ID is picked and can be retrieved with ret->table_id. Otherwise, the fib ID to be used to retrieve or create the desired fib.
flagsIndicates whether table_index_or_id is the fib index or ID. When the bit IP4_ROUTE_FLAG_FIB_INDEX is set, table_index_or_id is considered as the fib index, and the fib ID otherwise.
Returns
A pointer to the retrieved or created fib.
Remarks
When getting a fib with the fib index, the fib MUST already exist.

Get or create an IPv4 fib.

Parameters
imip4_main_t
table_index_or_id- overloaded parameter referring to the table or a table's index in the FIB vector
flags- used to check if table_index_or_id was a table or an index (detected by IP4_ROUTE_FLAG_FIB_INDEX)
Returns
either the existing or a new ip4_fib_t entry

Definition at line 120 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* ip4_add_del_interface_address ( vlib_main_t vm,
u32  sw_if_index,
ip4_address_t address,
u32  address_length,
u32  is_del 
)

Definition at line 1355 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ip4_add_del_route ( ip4_main_t im,
ip4_add_del_route_args_t args 
)

Definition at line 228 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ip4_add_del_route_next_hop ( ip4_main_t im,
u32  flags,
ip4_address_t dst_address,
u32  dst_address_length,
ip4_address_t next_hop,
u32  next_hop_sw_if_index,
u32  next_hop_weight,
u32  adj_index,
u32  explicit_fib_index 
)

Definition at line 385 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ip4_address_compare ( ip4_address_t a1,
ip4_address_t a2 
)

Definition at line 42 of file ip46_cli.c.

+ Here is the caller graph for this function:

void ip4_adjacency_set_interface_route ( vnet_main_t vnm,
ip_adjacency_t adj,
u32  sw_if_index,
u32  if_address_index 
)

Definition at line 1121 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 ip4_compute_flow_hash ( ip4_header_t ip,
u32  flow_hash_config 
)
inlinestatic

Definition at line 452 of file ip4.h.

+ Here is the caller graph for this function:

void ip4_delete_matching_routes ( ip4_main_t im,
u32  table_index_or_table_id,
u32  flags,
ip4_address_t address,
u32  address_length 
)

Definition at line 670 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword ip4_destination_matches_interface ( ip4_main_t im,
ip4_address_t key,
ip_interface_address_t ia 
)
inlinestatic

Definition at line 247 of file ip4.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword ip4_destination_matches_route ( ip4_main_t im,
ip4_address_t key,
ip4_address_t dest,
uword  dest_length 
)
inlinestatic

Definition at line 240 of file ip4.h.

+ Here is the caller graph for this function:

static u32 ip4_fib_lookup ( ip4_main_t im,
u32  sw_if_index,
ip4_address_t dst 
)
inlinestatic

Definition at line 232 of file ip4.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 ip4_fib_lookup_buffer ( ip4_main_t im,
u32  fib_index,
ip4_address_t dst,
vlib_buffer_t b 
)
inlinestatic

Definition at line 224 of file ip4.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 ip4_fib_lookup_with_table ( ip4_main_t im,
u32  fib_index,
ip4_address_t dst,
u32  disable_default_route 
)

Definition at line 58 of file ip4_forward.c.

+ Here is the caller graph for this function:

void ip4_foreach_matching_route ( ip4_main_t im,
u32  table_index_or_table_id,
u32  flags,
ip4_address_t address,
u32  address_length,
ip4_address_t **  results,
u8 **  result_lengths 
)

Definition at line 556 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void* ip4_get_route ( ip4_main_t im,
u32  fib_index_or_table_id,
u32  flags,
u8 address,
u32  address_length 
)

Definition at line 537 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ip4_icmp_register_type ( vlib_main_t vm,
icmp4_type_t  type,
u32  node_index 
)

Definition at line 696 of file icmp4.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ip4_address_t* ip4_interface_address_matching_destination ( ip4_main_t im,
ip4_address_t dst,
u32  sw_if_index,
ip_interface_address_t **  result_ia 
)
inlinestatic

Definition at line 277 of file ip4.h.

+ 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:

void ip4_maybe_remap_adjacencies ( ip4_main_t im,
u32  table_index_or_table_id,
u32  flags 
)

Definition at line 590 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ip4_mtrie_init ( ip4_fib_mtrie_t m)

Definition at line 353 of file ip4_mtrie.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* ip4_probe_neighbor ( vlib_main_t vm,
ip4_address_t dst,
u32  sw_if_index 
)

Definition at line 2584 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ip4_register_protocol ( u32  protocol,
u32  node_index 
)

Definition at line 2320 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 ip4_route_get_next_hop_adj ( ip4_main_t im,
u32  fib_index,
ip4_address_t next_hop,
u32  next_hop_sw_if_index,
u32  explicit_fib_index 
)

Definition at line 307 of file ip4_forward.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 int ip4_src_address_for_packet ( ip4_main_t im,
vlib_buffer_t p,
ip4_address_t src,
u32  sw_if_index 
)
inlinestatic

Definition at line 264 of file ip4.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u16 ip4_tcp_udp_compute_checksum ( vlib_main_t vm,
vlib_buffer_t p0,
ip4_header_t ip0 
)

Definition at line 1878 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword ip4_udp_register_listener ( vlib_main_t vm,
u16  dst_port,
u32  next_node_index 
)
static uword ip4_unaligned_destination_matches_route ( ip4_main_t im,
ip4_address_t key,
ip4_address_t dest,
uword  dest_length 
)
inlinestatic

Definition at line 257 of file ip4.h.

int vnet_set_ip4_classify_intfc ( vlib_main_t vm,
u32  sw_if_index,
u32  table_index 
)

Definition at line 3565 of file ip4_forward.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_set_ip4_flow_hash ( u32  table_id,
u32  flow_hash_config 
)

Definition at line 3502 of file ip4_forward.c.

+ Here is the caller graph for this function:

Variable Documentation

(constructor) VLIB_REGISTER_NODE (ip4_arp_node)

Definition at line 2542 of file ip4_forward.c.

vlib_node_registration_t ip4_input_node

Global ip4 input node.

Errors get attached to ip4 input node.

Global ip4 input node.

Definition at line 388 of file ip4_input.c.

vlib_node_registration_t ip4_lookup_node

(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)

Definition at line 1541 of file ip4_forward.c.

ip4_main_t ip4_main

Global ip4 main structure.

Definition at line 1578 of file ip4_forward.c.

vlib_node_registration_t ip4_rewrite_local_node

(constructor) VLIB_REGISTER_NODE (ip4_rewrite_local_node)

Definition at line 3105 of file ip4_forward.c.

vlib_node_registration_t ip4_rewrite_node

(constructor) VLIB_REGISTER_NODE (ip4_rewrite_node)

Definition at line 3088 of file ip4_forward.c.

serialize_function_t serialize_vnet_ip4_main

Definition at line 440 of file ip4.h.

serialize_function_t unserialize_vnet_ip4_main

Definition at line 440 of file ip4.h.