48 #ifndef included_ip_lookup_h 49 #define included_ip_lookup_h 108 #define IP4_LOOKUP_NEXT_NODES { \ 109 [IP_LOOKUP_NEXT_DROP] = "ip4-drop", \ 110 [IP_LOOKUP_NEXT_PUNT] = "ip4-punt", \ 111 [IP_LOOKUP_NEXT_LOCAL] = "ip4-local", \ 112 [IP_LOOKUP_NEXT_ARP] = "ip4-arp", \ 113 [IP_LOOKUP_NEXT_GLEAN] = "ip4-glean", \ 114 [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite-transit", \ 115 [IP_LOOKUP_NEXT_MIDCHAIN] = "ip4-midchain", \ 116 [IP_LOOKUP_NEXT_LOAD_BALANCE] = "ip4-load-balance", \ 117 [IP_LOOKUP_NEXT_ICMP_ERROR] = "ip4-icmp-error", \ 120 #define IP6_LOOKUP_NEXT_NODES { \ 121 [IP_LOOKUP_NEXT_DROP] = "ip6-drop", \ 122 [IP_LOOKUP_NEXT_PUNT] = "ip6-punt", \ 123 [IP_LOOKUP_NEXT_LOCAL] = "ip6-local", \ 124 [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor", \ 125 [IP_LOOKUP_NEXT_GLEAN] = "ip6-glean", \ 126 [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite", \ 127 [IP_LOOKUP_NEXT_MIDCHAIN] = "ip6-midchain", \ 128 [IP_LOOKUP_NEXT_LOAD_BALANCE] = "ip6-load-balance", \ 129 [IP_LOOKUP_NEXT_ICMP_ERROR] = "ip6-icmp-error", \ 130 [IP6_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", \ 131 [IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", \ 132 [IP6_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", \ 136 #define IP_FLOW_HASH_SRC_ADDR (1<<0) 137 #define IP_FLOW_HASH_DST_ADDR (1<<1) 138 #define IP_FLOW_HASH_PROTO (1<<2) 139 #define IP_FLOW_HASH_SRC_PORT (1<<3) 140 #define IP_FLOW_HASH_DST_PORT (1<<4) 141 #define IP_FLOW_HASH_REVERSE_SRC_DST (1<<5) 144 #define IP_FLOW_HASH_DEFAULT (0x1F) 146 #define foreach_flow_hash_bit \ 147 _(src, IP_FLOW_HASH_SRC_ADDR) \ 148 _(dst, IP_FLOW_HASH_DST_ADDR) \ 149 _(sport, IP_FLOW_HASH_SRC_PORT) \ 150 _(dport, IP_FLOW_HASH_DST_PORT) \ 151 _(proto, IP_FLOW_HASH_PROTO) \ 152 _(reverse, IP_FLOW_HASH_REVERSE_SRC_DST) 260 "IP adjacency cachline 0 is not offset");
263 "IP adjacency cachline 1 is more than one cachline size offset");
286 u8 rewrite_string[64 - 1*
sizeof(
u32) - 1*
sizeof(
u8)];
378 u8 local_next_by_ip_protocol[256];
381 u8 builtin_protocol_by_ip_protocol[256];
395 #define ip_prefetch_adjacency(lm,adj_index,type) \ 397 ip_adjacency_t * _adj = (lm)->adjacency_heap + (adj_index); \ 398 CLIB_PREFETCH (_adj, sizeof (_adj[0]), type); \ 406 u32 * adj_index_result);
434 #define foreach_ip_interface_address(lm,a,sw_if_index,loop,body) \ 436 vnet_main_t *_vnm = vnet_get_main(); \ 437 u32 _sw_if_index = sw_if_index; \ 438 vnet_sw_interface_t *_swif; \ 439 _swif = vnet_get_sw_interface (_vnm, _sw_if_index); \ 444 if (loop && _swif->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED) \ 445 _sw_if_index = _swif->unnumbered_sw_if_index; \ 447 (vec_len((lm)->if_address_pool_index_by_sw_if_index) \ 449 ? vec_elt ((lm)->if_address_pool_index_by_sw_if_index, \ 450 (_sw_if_index)) : (u32)~0; \ 451 ip_interface_address_t * _a; \ 454 _a = pool_elt_at_index ((lm)->if_address_pool, _ia); \ 455 _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.
uword * tx_sw_if_has_ip_output_features
any-tx-feature-enabled interface bitmap
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.
struct ip_adjacency_t_::@164::@165 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
#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.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
Adjacency to drop this packet.
ip46_address_t receive_addr
This packets needs to go to ICMP error.
#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.
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.
i16 * tx_feature_count_by_sw_if_index
count of enabled features, per sw_if_index, to maintain bitmap
u8 * format_ip_flow_hash_config(u8 *s, va_list *args)
An node in the FIB graph.
union ip_adjacency_t_::@164 sub_type
const ip46_address_t zero_addr
u16 mcast_group_index
Force re-lookup in a different FIB.
static ip_interface_address_t * ip_get_interface_address(ip_lookup_main_t *lm, void *addr_fib)
static uword * mhash_get(mhash_t *h, void *key)
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.
i32 ** adjacency_id_vector
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.
struct ip_adjacency_t_::@164::@167 glean
IP_LOOKUP_NEXT_GLEAN.
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.
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.
struct ip_adjacency_t_::@164::@166 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
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.
u32 prev_this_sw_interface