40 #ifndef included_ip_ip4_h 41 #define included_ip_ip4_h 188 #define VNET_IP4_UNICAST_FEATURE_INIT(x,...) \ 189 __VA_ARGS__ vnet_ip_feature_registration_t uc_##x; \ 190 static void __vnet_add_feature_registration_uc_##x (void) \ 191 __attribute__((__constructor__)) ; \ 192 static void __vnet_add_feature_registration_uc_##x (void) \ 194 ip4_main_t * im = &ip4_main; \ 195 uc_##x.next = im->next_uc_feature; \ 196 im->next_uc_feature = &uc_##x; \ 198 __VA_ARGS__ vnet_ip_feature_registration_t uc_##x 200 #define VNET_IP4_MULTICAST_FEATURE_INIT(x,...) \ 201 __VA_ARGS__ vnet_ip_feature_registration_t mc_##x; \ 202 static void __vnet_add_feature_registration_mc_##x (void) \ 203 __attribute__((__constructor__)) ; \ 204 static void __vnet_add_feature_registration_mc_##x (void) \ 206 ip4_main_t * im = &ip4_main; \ 207 mc_##x.next = im->next_mc_feature; \ 208 im->next_mc_feature = &mc_##x; \ 210 __VA_ARGS__ vnet_ip_feature_registration_t mc_##x 221 u32 disable_default_route);
295 *result_ia = result ? ia : 0;
308 #define IP4_ROUTE_FLAG_ADD (0 << 0) 309 #define IP4_ROUTE_FLAG_DEL (1 << 0) 310 #define IP4_ROUTE_FLAG_TABLE_ID (0 << 1) 311 #define IP4_ROUTE_FLAG_FIB_INDEX (1 << 1) 312 #define IP4_ROUTE_FLAG_KEEP_OLD_ADJACENCY (1 << 2) 313 #define IP4_ROUTE_FLAG_NO_REDISTRIBUTE (1 << 3) 315 #define IP4_ROUTE_FLAG_NOT_LAST_IN_GROUP (1 << 4) 317 #define IP4_ROUTE_FLAG_NEIGHBOR (1 << 5) 372 u32 dst_address_length,
374 u32 next_hop_sw_if_index,
375 u32 next_hop_weight,
u32 adj_index,
376 u32 explicit_fib_index);
382 u32 next_hop_sw_if_index,
383 u32 explicit_fib_index);
387 u32 fib_index_or_table_id,
394 u32 table_index_or_table_id,
399 u8 ** result_lengths);
402 u32 table_index_or_table_id,
408 u32 table_index_or_table_id,
414 u32 if_address_index);
430 u32 next_node_index);
457 || ip->
protocol == IP_PROTOCOL_UDP);
468 t1 = is_tcp_udp ? tcp->
ports.
src : 0;
469 t2 = is_tcp_udp ? tcp->
ports.
dst : 0;
475 (t1<<16) | t2 : (t2<<16) | t1;
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
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.
static ip_interface_address_t * ip_interface_address_for_packet(ip_lookup_main_t *lm, vlib_buffer_t *b, u32 sw_if_index)
u8 pad[3]
log2 (size of the packing page block)
u32 ip4_multicast_rx_feature_vpath
Built-in multicast feature path indices.
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)
ip4_add_del_interface_address_callback_t * add_del_interface_address_callbacks
Functions to call when interface address changes.
u32 ip4_unicast_rx_feature_source_reachable_via_any
Built-in unicast feature path indice, see ip_feature_init_cast()
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)
#define IP_FLOW_HASH_SRC_PORT
uword * interface_route_adj_index_by_sw_if_index
Hash table mapping interface route rewrite adjacency index by sw if index.
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
serialize_function_t serialize_vnet_ip4_main
static uword ip4_destination_matches_route(ip4_main_t *im, ip4_address_t *key, ip4_address_t *dest, uword dest_length)
Definitions for all things IP (v4|v6) unicast and multicast lookup related.
ip4_address_t * ip4_interface_first_address(ip4_main_t *im, u32 sw_if_index, ip_interface_address_t **result_ia)
#define IP_FLOW_HASH_REVERSE_SRC_DST
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)
struct _vlib_node_registration vlib_node_registration_t
#define IP_FLOW_HASH_DST_PORT
ip_lookup_main_t lookup_main
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
static uword ip4_unaligned_destination_matches_route(ip4_main_t *im, ip4_address_t *key, ip4_address_t *dest, uword dest_length)
void ip4_maybe_remap_adjacencies(ip4_main_t *im, u32 table_index_or_table_id, u32 flags)
void ip4_register_protocol(u32 protocol, u32 node_index)
uword ip4_udp_register_listener(vlib_main_t *vm, u16 dst_port, u32 next_node_index)
struct ip4_fib_t ip4_fib_t
#define hash_v3_mix32(a, b, c)
static u32 ip4_fib_lookup_buffer(ip4_main_t *im, u32 fib_index, ip4_address_t *dst, vlib_buffer_t *b)
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
u32 fwd_classify_table_index
u32 ip4_unicast_rx_feature_policer_classify
Built-in unicast feature path indice, see ip_feature_init_cast()
u32 ip4_unicast_rx_feature_ipsec
Built-in unicast feature path indice, see ip_feature_init_cast()
#define IP_FLOW_HASH_DST_ADDR
u32 ip4_fib_lookup_with_table(ip4_main_t *im, u32 fib_index, ip4_address_t *dst, u32 disable_default_route)
u32 rev_classify_table_index
int vnet_set_ip4_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
u32 ip4_unicast_rx_feature_check_access
Built-in unicast feature path indice, see ip_feature_init_cast()
void ip4_icmp_register_type(vlib_main_t *vm, icmp4_type_t type, u32 node_index)
void ip4_adjacency_set_interface_route(vnet_main_t *vnm, ip_adjacency_t *adj, u32 sw_if_index, u32 if_address_index)
vlib_node_registration_t ip4_arp_node
(constructor) VLIB_REGISTER_NODE (ip4_arp_node)
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)
clib_error_t * ip4_probe_neighbor(vlib_main_t *vm, ip4_address_t *dst, u32 sw_if_index)
int vnet_set_ip4_flow_hash(u32 table_id, u32 flow_hash_config)
uword * fib_index_by_table_id
Hash table mapping table id to fib index.
vlib_node_registration_t ip4_input_node
Global ip4 input node.
void * ip4_get_route(ip4_main_t *im, u32 fib_index_or_table_id, u32 flags, u8 *address, u32 address_length)
u32 ip4_multicast_rx_feature_lookup
Built-in multicast feature path indices.
vlib_node_registration_t ip4_rewrite_node
(constructor) VLIB_REGISTER_NODE (ip4_rewrite_node)
void ip4_mtrie_init(ip4_fib_mtrie_t *m)
int ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
clib_error_t * ip4_set_arp_limit(u32 arp_limit)
vnet_ip_feature_registration_t * next_uc_feature
Feature path configuration lists.
serialize_function_t unserialize_vnet_ip4_main
u32 ip4_unicast_rx_feature_source_reachable_via_rx
Built-in unicast feature path indice, see ip_feature_init_cast()
u32 ip4_unicast_rx_feature_lookup
Built-in unicast feature path indice, see ip_feature_init_cast()
static u32 ip4_fib_lookup(ip4_main_t *im, u32 sw_if_index, ip4_address_t *dst)
vlib_packet_template_t ip4_arp_request_packet_template
Template used to generate IP4 ARP packets.
static int ip4_src_address_for_packet(ip4_main_t *im, vlib_buffer_t *p, ip4_address_t *src, u32 sw_if_index)
#define IP_FLOW_HASH_SRC_ADDR
Flow hash configuration.
void ip4_delete_matching_routes(ip4_main_t *im, u32 table_index_or_table_id, u32 flags, ip4_address_t *address, u32 address_length)
ip4_fib_t * fibs
Vector of FIBs.
ip4_address_t dst_address
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)
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
#define hash_v3_finalize32(a, b, c)
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)
#define vec_elt(v, i)
Get vector value at index i.
struct ip4_main_t ip4_main_t
IPv4 main type.
void( serialize_function_t)(serialize_main_t *m, va_list *va)
vlib_node_registration_t ip4_rewrite_local_node
(constructor) VLIB_REGISTER_NODE (ip4_rewrite_local_node)
u32 table_index_or_table_id
#define clib_mem_unaligned(pointer, type)
static u32 ip4_compute_flow_hash(ip4_header_t *ip, u32 flow_hash_config)
static uword ip4_destination_matches_interface(ip4_main_t *im, ip4_address_t *key, ip_interface_address_t *ia)
vnet_ip_feature_registration_t * next_mc_feature
ip4_main_t ip4_main
Global ip4 main structure.
u32 ip4_unicast_rx_feature_vpath
Built-in unicast feature path indice, see ip_feature_init_cast()
u32 ip4_unicast_rx_feature_source_and_port_range_check
Built-in unicast feature path indice, see ip_feature_init_cast()
#define IP_FLOW_HASH_PROTO
ip4_add_del_route_callback_t * add_del_route_callbacks
Vector of functions to call when routes are added/deleted.
uword * adj_index_by_dst_address[33]
u32 flow_hash_seed
Seed for Jenkins hash used to compute ip4 flow hash.
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
void ip4_add_del_route(ip4_main_t *im, ip4_add_del_route_args_t *args)
u8 ttl
TTL to use for host generated packets.
u8 tos
TOS byte to use for host generated packets.
struct _vnet_ip_feature_registration vnet_ip_feature_registration_t
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)