48 #ifndef included_ip_lookup_h 49 #define included_ip_lookup_h 114 #define IP4_LOOKUP_NEXT_NODES { \ 115 [IP_LOOKUP_NEXT_DROP] = "ip4-drop", \ 116 [IP_LOOKUP_NEXT_PUNT] = "ip4-punt", \ 117 [IP_LOOKUP_NEXT_LOCAL] = "ip4-local", \ 118 [IP_LOOKUP_NEXT_ARP] = "ip4-arp", \ 119 [IP_LOOKUP_NEXT_GLEAN] = "ip4-glean", \ 120 [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite", \ 121 [IP_LOOKUP_NEXT_MCAST] = "ip4-rewrite-mcast", \ 122 [IP_LOOKUP_NEXT_MIDCHAIN] = "ip4-midchain", \ 123 [IP_LOOKUP_NEXT_LOAD_BALANCE] = "ip4-load-balance", \ 124 [IP_LOOKUP_NEXT_ICMP_ERROR] = "ip4-icmp-error", \ 127 #define IP6_LOOKUP_NEXT_NODES { \ 128 [IP_LOOKUP_NEXT_DROP] = "ip6-drop", \ 129 [IP_LOOKUP_NEXT_PUNT] = "ip6-punt", \ 130 [IP_LOOKUP_NEXT_LOCAL] = "ip6-local", \ 131 [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor", \ 132 [IP_LOOKUP_NEXT_GLEAN] = "ip6-glean", \ 133 [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite", \ 134 [IP_LOOKUP_NEXT_MCAST] = "ip6-rewrite-mcast", \ 135 [IP_LOOKUP_NEXT_MIDCHAIN] = "ip6-midchain", \ 136 [IP_LOOKUP_NEXT_LOAD_BALANCE] = "ip6-load-balance", \ 137 [IP_LOOKUP_NEXT_ICMP_ERROR] = "ip6-icmp-error", \ 138 [IP6_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", \ 139 [IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", \ 140 [IP6_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", \ 144 #define IP_FLOW_HASH_SRC_ADDR (1<<0) 145 #define IP_FLOW_HASH_DST_ADDR (1<<1) 146 #define IP_FLOW_HASH_PROTO (1<<2) 147 #define IP_FLOW_HASH_SRC_PORT (1<<3) 148 #define IP_FLOW_HASH_DST_PORT (1<<4) 149 #define IP_FLOW_HASH_REVERSE_SRC_DST (1<<5) 152 #define IP_FLOW_HASH_DEFAULT (0x1F) 154 #define foreach_flow_hash_bit \ 155 _(src, IP_FLOW_HASH_SRC_ADDR) \ 156 _(dst, IP_FLOW_HASH_DST_ADDR) \ 157 _(sport, IP_FLOW_HASH_SRC_PORT) \ 158 _(dport, IP_FLOW_HASH_DST_PORT) \ 159 _(proto, IP_FLOW_HASH_PROTO) \ 160 _(reverse, IP_FLOW_HASH_REVERSE_SRC_DST) 285 "IP adjacency cachline 0 is not offset");
288 "IP adjacency cachline 1 is more than one cachline size offset");
370 u8 local_next_by_ip_protocol[256];
373 u8 builtin_protocol_by_ip_protocol[256];
386 #define ip_prefetch_adjacency(lm,adj_index,type) \ 388 ip_adjacency_t * _adj = (lm)->adjacency_heap + (adj_index); \ 389 CLIB_PREFETCH (_adj, sizeof (_adj[0]), type); \ 396 u32 is_del,
u32 * result_index);
417 #define foreach_ip_interface_address(lm,a,sw_if_index,loop,body) \ 419 vnet_main_t *_vnm = vnet_get_main(); \ 420 u32 _sw_if_index = sw_if_index; \ 421 vnet_sw_interface_t *_swif; \ 422 _swif = vnet_get_sw_interface (_vnm, _sw_if_index); \ 427 if (_swif->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED) \ 430 _sw_if_index = _swif->unnumbered_sw_if_index; \ 436 u32 _ia = ((vec_len((lm)->if_address_pool_index_by_sw_if_index) \ 437 > (_sw_if_index)) ? \ 438 vec_elt ((lm)->if_address_pool_index_by_sw_if_index, \ 441 ip_interface_address_t * _a; \ 444 _a = pool_elt_at_index ((lm)->if_address_pool, _ia); \ 445 _ia = _a->next_this_sw_interface; \ This packets follow a load-balance.
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
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_::@138::@139 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
#define VLIB_BUFFER_PRE_DATA_SIZE
#define STRUCT_OFFSET_OF(t, f)
union ip_adjacency_t_::@138 sub_type
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.
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.
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
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
static ip_interface_address_t * ip_get_interface_address(ip_lookup_main_t *lm, void *addr_fib)
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.
vlib buffer structure definition and a few select access methods.
enum ip_adjacency_flags_t_ ip_adjacency_flags_t
Flags on an IP adjacency.
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.
struct ip_adjacency_t_::@138::@140 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
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.
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_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.
static ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
struct ip_adjacency_t_::@138::@141 glean
IP_LOOKUP_NEXT_GLEAN.
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