48 #ifndef included_ip_lookup_h 49 #define included_ip_lookup_h 111 #define IP4_LOOKUP_NEXT_NODES { \ 112 [IP_LOOKUP_NEXT_DROP] = "ip4-drop", \ 113 [IP_LOOKUP_NEXT_PUNT] = "ip4-punt", \ 114 [IP_LOOKUP_NEXT_LOCAL] = "ip4-local", \ 115 [IP_LOOKUP_NEXT_ARP] = "ip4-arp", \ 116 [IP_LOOKUP_NEXT_GLEAN] = "ip4-glean", \ 117 [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite", \ 118 [IP_LOOKUP_NEXT_MIDCHAIN] = "ip4-midchain", \ 119 [IP_LOOKUP_NEXT_LOAD_BALANCE] = "ip4-load-balance", \ 120 [IP_LOOKUP_NEXT_ICMP_ERROR] = "ip4-icmp-error", \ 123 #define IP6_LOOKUP_NEXT_NODES { \ 124 [IP_LOOKUP_NEXT_DROP] = "ip6-drop", \ 125 [IP_LOOKUP_NEXT_PUNT] = "ip6-punt", \ 126 [IP_LOOKUP_NEXT_LOCAL] = "ip6-local", \ 127 [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor", \ 128 [IP_LOOKUP_NEXT_GLEAN] = "ip6-glean", \ 129 [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite", \ 130 [IP_LOOKUP_NEXT_MIDCHAIN] = "ip6-midchain", \ 131 [IP_LOOKUP_NEXT_LOAD_BALANCE] = "ip6-load-balance", \ 132 [IP_LOOKUP_NEXT_ICMP_ERROR] = "ip6-icmp-error", \ 133 [IP6_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", \ 134 [IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", \ 135 [IP6_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", \ 139 #define IP_FLOW_HASH_SRC_ADDR (1<<0) 140 #define IP_FLOW_HASH_DST_ADDR (1<<1) 141 #define IP_FLOW_HASH_PROTO (1<<2) 142 #define IP_FLOW_HASH_SRC_PORT (1<<3) 143 #define IP_FLOW_HASH_DST_PORT (1<<4) 144 #define IP_FLOW_HASH_REVERSE_SRC_DST (1<<5) 147 #define IP_FLOW_HASH_DEFAULT (0x1F) 149 #define foreach_flow_hash_bit \ 150 _(src, IP_FLOW_HASH_SRC_ADDR) \ 151 _(dst, IP_FLOW_HASH_DST_ADDR) \ 152 _(sport, IP_FLOW_HASH_SRC_PORT) \ 153 _(dport, IP_FLOW_HASH_DST_PORT) \ 154 _(proto, IP_FLOW_HASH_PROTO) \ 155 _(reverse, IP_FLOW_HASH_REVERSE_SRC_DST) 286 "IP adjacency cachline 0 is not offset");
289 "IP adjacency cachline 1 is more than one cachline size offset");
315 u8 rewrite_string[64 - 1 *
sizeof (
u32) - 1 *
sizeof (
u8)];
408 u8 local_next_by_ip_protocol[256];
411 u8 builtin_protocol_by_ip_protocol[256];
424 #define ip_prefetch_adjacency(lm,adj_index,type) \ 426 ip_adjacency_t * _adj = (lm)->adjacency_heap + (adj_index); \ 427 CLIB_PREFETCH (_adj, sizeof (_adj[0]), type); \ 433 u32 n_adj,
u32 * adj_index_result);
439 u32 is_del,
u32 * result_index);
460 #define foreach_ip_interface_address(lm,a,sw_if_index,loop,body) \ 462 vnet_main_t *_vnm = vnet_get_main(); \ 463 u32 _sw_if_index = sw_if_index; \ 464 vnet_sw_interface_t *_swif; \ 465 _swif = vnet_get_sw_interface (_vnm, _sw_if_index); \ 470 if (loop && _swif->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED) \ 471 _sw_if_index = _swif->unnumbered_sw_if_index; \ 473 (vec_len((lm)->if_address_pool_index_by_sw_if_index) \ 475 ? vec_elt ((lm)->if_address_pool_index_by_sw_if_index, \ 476 (_sw_if_index)) : (u32)~0; \ 477 ip_interface_address_t * _a; \ 480 _a = pool_elt_at_index ((lm)->if_address_pool, _ia); \ 481 _ia = _a->next_this_sw_interface; \ This packets follow a load-balance.
uword * adjacency_by_id_vector
format_function_t * format_fib_result
ip_lookup_next_t
Common (IP4/IP6) next index stored in adjacency.
STATIC_ASSERT((STRUCT_OFFSET_OF(ip_adjacency_t, cacheline0)==0),"IP adjacency cachline 0 is not offset")
ip_adjacency_t * adjacency_heap
ip_multicast_rewrite_t * rewrite_heap
clib_error_t * ip_interface_address_add_del(ip_lookup_main_t *lm, u32 sw_if_index, void *address, u32 address_length, u32 is_del, u32 *result_index)
ip_interface_address_t * if_address_pool
Pool of addresses that are assigned to interfaces.
#define STRUCT_OFFSET_OF(t, f)
struct ip_adjacency_t_ ip_adjacency_t
IP unicast adjacency.
adj_midchain_fixup_t fixup_func
A function to perform the post-rewrite fixup.
u32 neighbor_probe_adj_index
mhash_t address_to_if_address_index
Hash table mapping address to index in interface address pool.
u8 mcast_feature_arc_index
Feature arc indices.
union ip_adjacency_t_::@175 sub_type
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
Adjacency to drop this packet.
ip46_address_t receive_addr
u8 output_feature_arc_index
This packets needs to go to ICMP error.
ip_adjacency_flags_t ia_flags
Flags on the adjacency.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
ip46_address_t next_hop
The recursive next-hop.
Adjacency to punt this packet.
This packet is for one of our own IP addresses.
struct ip_adjacency_t_::@175::@178 glean
IP_LOOKUP_NEXT_GLEAN.
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
#define VLIB_BUFFER_PRE_DATA_SIZE
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
dpo_id_t next_dpo
The next DPO to use.
struct ip_lookup_main_t ip_lookup_main_t
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
CLIB_CACHE_LINE_ALIGN_MARK(cacheline0)
u32 * classify_table_index_by_sw_if_index
First table index to use for this interface, ~0 => none.
u16 lookup_next_index_as_int
u32 tx_function_node
The node index of the tunnel's post rewrite/TX function.
Currently a sync walk is active.
u8 * format_ip_flow_hash_config(u8 *s, va_list *args)
An node in the FIB graph.
const ip46_address_t zero_addr
u16 mcast_group_index
Force re-lookup in a different FIB.
struct ip_adjacency_t_::@175::@176 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
static ip_interface_address_t * ip_get_interface_address(ip_lookup_main_t *lm, void *addr_fib)
ip_adjacency_t * ip_add_adjacency(ip_lookup_main_t *lm, ip_adjacency_t *adj, u32 n_adj, u32 *adj_index_result)
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
u32 * if_address_pool_index_by_sw_if_index
Head of doubly linked list of interface addresses for each software interface.
enum ip_adjacency_flags_t_ ip_adjacency_flags_t
Flags on an IP adjacency.
i32 ** adjacency_id_vector
static uword * mhash_get(mhash_t *h, const void *key)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
This packets follow a mid-chain adjacency.
u32 if_address_index
Interface address index for this local/arp adjacency.
void(* adj_midchain_fixup_t)(vlib_main_t *vm, struct ip_adjacency_t_ *adj, vlib_buffer_t *b0)
A function type for post-rewrite fixups on midchain adjacency.
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
u16 n_adj
Number of adjecencies in block.
u8 ucast_feature_arc_index
u32 fib_table_id_find_fib_index(fib_protocol_t proto, u32 table_id)
format_function_t ** special_adjacency_format_functions
Special adjacency format functions.
ip_lookup_next_t lookup_next_index
u32 is_ip6
1 for ip6; 0 for ip4.
static void * mhash_key_to_mem(mhash_t *h, uword key)
A collection of combined counters.
u16 saved_lookup_next_index
Highest possible perf subgraph arc interposition, e.g.
This packet is to be rewritten and forwarded to the next processing node.
void ip_lookup_init(ip_lookup_main_t *lm, u32 ip_lookup_node_index)
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
#define CLIB_CACHE_LINE_BYTES
vnet_declare_rewrite(VLIB_BUFFER_PRE_DATA_SIZE)
vlib buffer structure definition and a few select access methods.
vlib_combined_counter_main_t load_balance_counters
load-balance packet/byte counters indexed by LB index.
ip_adjacency_flags_t_
Flags on an IP adjacency.
ip_multicast_rewrite_string_t * rewrite_strings
static ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
u32 next_this_sw_interface
format_function_t * format_address_and_length
Either format_ip4_address_and_length or format_ip6_address_and_length.
struct ip_adjacency_t_::@175::@177 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
u32 prev_this_sw_interface