34 #define ADJ_NBR_SET_KEY(_key, _lt, _nh) \ 36 ip46_address_copy(&(_key).ank_ip, (_nh)); \ 37 _key.ank_linkt = (_lt); \ 40 #define ADJ_NBR_ITF_OK(_proto, _itf) \ 41 (((_itf) < vec_len(adj_nbr_tables[_proto])) && \ 42 (NULL != adj_nbr_tables[_proto][sw_if_index])) 158 sw_if_index = adj->rewrite_header.sw_if_index;
162 if (feature_count > 0)
200 &adj->rewrite_header);
224 adj_index =
adj_nbr_find(nh_proto, link_type, nh_addr, sw_if_index);
232 adj =
adj_nbr_alloc(nh_proto, link_type, nh_addr, sw_if_index);
244 &adj->rewrite_header);
271 adj_index =
adj_nbr_find(nh_proto, link_type, nh_addr, sw_if_index);
277 adj =
adj_nbr_alloc(nh_proto, link_type, nh_addr, sw_if_index);
320 adj->rewrite_header.sw_if_index),
329 adj->rewrite_header.sw_if_index),
368 adj->rewrite_header.sw_if_index);
433 old_next != adj_next_index &&
481 sizeof(adj->rewrite_data),
489 sizeof(adj->rewrite_data));
594 ip46_address_t
nh = {
615 const ip6_address_t *
addr,
622 ip46_address_t
nh = {
644 const ip46_address_t *
nh,
651 switch (adj_nh_proto)
902 else if (
unformat (input,
"%d", &ai))
915 else if (~0 != sw_if_index)
967 .path =
"show adj nbr",
968 .short_help =
"show adj nbr [<adj_index>] [interface]",
981 s =
format (s,
": via %U",
986 vnm, adj->rewrite_header.sw_if_index);
999 s =
format (s,
" via %U ",
1004 &adj->rewrite_header, sizeof (adj->rewrite_data), 0);
1085 "ip6-discover-neighbor",
1090 "mpls-adj-incomplete",
1108 &adj_nbr_incompl_dpo_vft,
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
dpo_lock_fn_t dv_lock
A reference counting lock function.
void adj_nbr_walk_nh(u32 sw_if_index, fib_protocol_t adj_nh_proto, const ip46_address_t *nh, adj_walk_cb_t cb, void *ctx)
Walk adjacencies on a link with a given next-hop.
static clib_error_t * adj_nbr_hw_interface_state_change(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Registered callback for HW interface state changes.
#define vec_foreach_index(var, v)
Iterate over vector indices.
adj_flags_t ia_flags
Flags on the adjacency 1-bytes.
ip_adjacency_t * adj_pool
The global adjacency pool.
A virtual function table regisitered for a DPO type.
enum adj_nbr_interface_flags_t_ adj_nbr_interface_flags_t
Flags associated with the interface state walks.
u8 * format_adj_nbr(u8 *s, va_list *ap)
Format a neigbour (REWRITE) adjacency.
void adj_lock(adj_index_t adj_index)
Take a reference counting lock on the adjacency.
An indication that the rewrite is complete, i.e.
vnet_main_t * vnet_get_main(void)
static const char *const nbr_ethernet_nodes[]
static uword ** adj_nbr_tables[FIB_PROTOCOL_IP_MAX]
static const char *const nbr_incomplete_ip6_nodes[]
void adj_delegate_adj_created(ip_adjacency_t *adj)
static adj_walk_rc_t adj_nbr_interface_state_change_one(adj_index_t ai, void *arg)
void vnet_hw_interface_walk_sw(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_sw_interface_walk_t fn, void *ctx)
Walk the SW interfaces on a HW interface - this is the super interface and any sub-interfaces.
Context for the state change walk of the DB.
#define FIB_PROTOCOL_IP_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements...
u32 * config_index_by_sw_if_index
This packet is to be rewritten and forwarded to the next processing node.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
ip_lookup_main_t lookup_main
void adj_nbr_walk_nh4(u32 sw_if_index, const ip4_address_t *addr, adj_walk_cb_t cb, void *ctx)
Walk adjacencies on a link with a given v4 next-hop.
union ip_adjacency_t_::@137 sub_type
unformat_function_t unformat_vnet_sw_interface
u8 * format_adj_nbr_incomplete(u8 *s, va_list *ap)
Format aa incomplete neigbour (ARP) adjacency.
static const char *const nbr_incomplete_mpls_nodes[]
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
u32 adj_dpo_get_urpf(const dpo_id_t *dpo)
adj_index_t adj_nbr_add_or_lock_w_rewrite(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index, u8 *rewrite)
Add (and lock) a new or lock an existing neighbour adjacency.
format_function_t format_vnet_sw_if_index_name
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
ip_lookup_next_t
An adjacency is a representation of an attached L3 peer.
#define pool_len(p)
Number of elements in pool vector.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
#define vlib_worker_thread_barrier_sync(X)
vnet_link_t ia_link
link/ether-type 1 bytes
static void adj_nbr_insert(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index, adj_index_t adj_index)
enum walk_rc_t_ walk_rc_t
Walk return code.
u8 output_feature_arc_index
static clib_error_t * adj_nbr_sw_interface_state_change(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
Registered function for SW interface state changes.
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
vlib_node_registration_t ip6_discover_neighbor_node
(constructor) VLIB_REGISTER_NODE (ip6_discover_neighbor_node)
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION_PRIO(adj_nbr_sw_interface_state_change, VNET_ITF_FUNC_PRIORITY_HIGH)
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
vl_api_interface_index_t sw_if_index
void fib_walk_sync(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_back_walk_ctx_t *ctx)
Back walk all the children of a FIB node.
static void vnet_rewrite_clear_data_internal(vnet_rewrite_header_t *rw, int max_size)
static const char *const nbr_incomplete_ip4_nodes[]
enum adj_walk_rc_t_ adj_walk_rc_t
return codes from a adjacency walker callback function
static walk_rc_t adj_nbr_hw_sw_interface_state_change(vnet_main_t *vnm, u32 sw_if_index, void *arg)
Invoked on each SW interface of a HW interface when the HW interface state changes.
static clib_error_t * adj_nbr_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static const char *const nbr_mpls_nodes[]
static void adj_dpo_lock(dpo_id_t *dpo)
void fib_show_memory_usage(const char *name, u32 in_use_elts, u32 allocd_elts, size_t size_elt)
Show the memory usage for a type.
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
void vnet_update_adjacency_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
static const char *const nbr_ip6_nodes[]
static void adj_nbr_evaluate_feature(adj_index_t ai)
Check and set feature flags if o/p interface has any o/p features.
format_function_t format_vnet_rewrite
u8 output_feature_arc_index
u32 adj_nbr_db_size(void)
Return the size of the adjacency database.
vlib_node_registration_t ip4_arp_node
(constructor) VLIB_REGISTER_NODE (ip4_arp_node)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
fib_node_bw_reason_flag_t fnbw_reason
The reason/trigger for the backwalk.
#define hash_create_mem(elts, key_bytes, value_bytes)
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
void adj_nbr_remove(adj_index_t ai, fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
static u8 ip46_address_is_zero(const ip46_address_t *ip46)
static adj_index_t adj_get_index(const ip_adjacency_t *adj)
Get a pointer to an adjacency object from its index.
void adj_delegate_adj_modified(ip_adjacency_t *adj)
static clib_error_t * adj_nbr_interface_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
adj_nbr_interface_add_del
u32 ia_node_index
The VLIB node in which this adj is used to forward packets.
void adj_nbr_module_init(void)
Module initialisation.
#define hash_foreach_mem(key_var, value_var, h, body)
static u8 ip46_address_is_equal(const ip46_address_t *ip46_1, const ip46_address_t *ip46_2)
format_function_t format_ip46_address
#define ADJ_NBR_SET_KEY(_key, _lt, _nh)
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
void vnet_rewrite_init(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t linkt, u32 this_node, u32 next_node, vnet_rewrite_header_t *rw)
#define vec_free(V)
Free vector's memory (no header).
static adj_walk_rc_t adj_nbr_show_one(adj_index_t ai, void *arg)
Force the walk to be synchronous.
u32 vnet_tx_node_index_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static void vnet_rewrite_set_data_internal(vnet_rewrite_header_t *rw, int max_size, void *data, int data_bytes)
adj_walk_rc_t(* adj_walk_cb_t)(adj_index_t ai, void *ctx)
Call back function when walking adjacencies.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
u32 adj_index_t
An index for adjacencies.
static void adj_mem_show(void)
static ip_adjacency_t * adj_nbr_alloc(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
void adj_nbr_walk(u32 sw_if_index, fib_protocol_t adj_nh_proto, adj_walk_cb_t cb, void *ctx)
Walk all adjacencies on a link for a given next-hop protocol.
i16 ** feature_count_by_sw_if_index
feature reference counts by interface
#define FOR_EACH_VNET_LINK(_link)
Context passed between object during a back walk.
#define VLIB_CLI_COMMAND(x,...)
VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION_PRIO(adj_nbr_hw_interface_state_change, VNET_ITF_FUNC_PRIORITY_HIGH)
adj_nbr_interface_flags_t flags
Flags on the interface.
static uword hash_elts(void *v)
struct ip_adjacency_t_::@137::@138 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
ip_lookup_main_t lookup_main
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
u32 ia_cfg_index
feature [arc] config index
static void hash_unset_mem_free(uword **h, const void *key)
struct adj_nbr_key_t_ adj_nbr_key_t
static const char *const nbr_ip4_nodes[]
The per-protocol VLIB graph nodes that are assigned to an adjacency object.
static const char *const *const nbr_nodes[DPO_PROTO_NUM]
static u32 adj_get_rewrite_node(vnet_link_t linkt)
static u32 adj_get_nd_node(fib_protocol_t proto)
static vlib_main_t * vlib_get_main(void)
#define vec_elt(v, i)
Get vector value at index i.
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
static const char *const *const nbr_incomplete_nodes[DPO_PROTO_NUM]
index_t dpoi_index
the index of objects of that type
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
void adj_nbr_update_rewrite_internal(ip_adjacency_t *adj, ip_lookup_next_t adj_next_index, u32 this_node, u32 next_node, u8 *rewrite)
adj_nbr_update_rewrite_internal
enum adj_nbr_rewrite_flag_t_ adj_nbr_rewrite_flag_t
When adding a rewrite to an adjacency these are flags that apply to that rewrite. ...
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
ip_adjacency_t * adj_alloc(fib_protocol_t proto)
static adj_walk_rc_t adj_nbr_interface_delete_one(adj_index_t ai, void *arg)
#define hash_get_mem(h, key)
adj_nbr_interface_flags_t_
Flags associated with the interface state walks.
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
ip4_main_t ip4_main
Global ip4 main structure.
adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Neighbour Adjacency sub-type.
#define vec_foreach(var, vec)
Vector iterator.
vnet_link_t fib_proto_to_link(fib_protocol_t proto)
Convert from a protocol to a link type.
u8 * format_vnet_link(u8 *s, va_list *ap)
static void hash_set_mem_alloc(uword **h, const void *key, uword v)
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(adj_nbr_interface_add_del)
static void adj_dpo_unlock(dpo_id_t *dpo)
vnet_feature_config_main_t * feature_config_mains
feature config main objects
#define ADJ_NBR_ITF_OK(_proto, _itf)
This adjacency/interface has output features configured.
void vnet_rewrite_update_mtu(vnet_main_t *vnm, vnet_link_t linkt, vnet_rewrite_header_t *rw)
vnet_feature_main_t feature_main
void adj_nbr_update_rewrite(adj_index_t adj_index, adj_nbr_rewrite_flag_t flags, u8 *rewrite)
adj_nbr_update_rewrite
const ip46_address_t ADJ_BCAST_ADDR
The special broadcast address (to construct a broadcast adjacency.
struct adj_nbr_interface_state_change_ctx_t_ adj_nbr_interface_state_change_ctx_t
Context for the state change walk of the DB.
#define ip46_address_initializer
static ip46_type_t adj_proto_to_46(fib_protocol_t proto)
adj_index_t adj_nbr_find(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Lookup neighbor adjancency.
void adj_nbr_walk_nh6(u32 sw_if_index, const ip6_address_t *addr, adj_walk_cb_t cb, void *ctx)
Walk adjacencies on a link with a given v6 next-hop.
static uword pool_elts(void *v)
Number of active elements in a pool.