224 if (sixrd_ad ==
NULL)
226 pool_get (sixrd_adj_delegate_pool, sixrd_ad);
235 sixrd_ad - sixrd_adj_delegate_pool);
238 sixrd_ad - sixrd_adj_delegate_pool);
280 if ((ip6_prefix_len + 32 - ip4_prefix_len) > 64)
281 return VNET_API_ERROR_INVALID_VALUE;
286 ip_set (&src, ip4_src,
true);
289 .fib_index = ip4_fib_index,
296 return VNET_API_ERROR_IF_ALREADY_EXISTS;
300 memset (t, 0,
sizeof (*t));
306 t->
sixrd.ip4_prefix_len = ip4_prefix_len;
307 t->
sixrd.ip6_prefix = *ip6_prefix;
308 t->
sixrd.ip6_prefix_len = ip6_prefix_len;
309 t->
sixrd.ip6_fib_index = ip6_fib_index;
311 t->
sixrd.security_check = security_check;
313 (ip4_prefix_len < 32) ? 64 - ip6_prefix_len - (32 - ip4_prefix_len) : 0;
319 sixrd_hw_interface_class.index, t_idx);
348 .fp_len = t->
sixrd.ip6_prefix_len,
350 .ip6 = t->
sixrd.ip6_prefix,
384 clib_warning (
"SIXRD tunnel delete: tunnel does not exist: %d",
392 .fp_len = t->
sixrd.ip6_prefix_len,
394 .ip6 = t->
sixrd.ip6_prefix,
428 pool_put (sixrd_adj_delegate_pool, sixrd_ad);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
fib_protocol_t fp_proto
protocol type
void ipip_tunnel_db_remove(ipip_tunnel_t *t)
Recursive resolution source.
static sixrd_adj_delegate_t * sixrd_adj_delegate_from_fib_node(fib_node_t *node)
clib_error_t * sixrd_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
adj_delegate_adj_deleted_t adv_adj_deleted
A representation of a IPIP tunnel.
vnet_main_t * vnet_get_main(void)
struct ip_adjacency_t_::@45::@46 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
void fib_node_init(fib_node_t *node, fib_node_type_t type)
ip46_address_t tunnel_src
u32 fib_entry_child_add(fib_node_index_t fib_entry_index, fib_node_type_t child_type, fib_node_index_t child_index)
static void sixrd_fib_node_last_lock_gone(fib_node_t *node)
static u8 * sixrd_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
void ip_set(ip46_address_t *dst, void *src, u8 is_ip4)
vnet_link_t adj_get_link_type(adj_index_t ai)
Return the link type of the adjacency.
union ip_adjacency_t_::@45 sub_type
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
const dpo_id_t * fib_entry_contribute_ip_forwarding(fib_node_index_t fib_entry_index)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
void fib_entry_child_remove(fib_node_index_t fib_entry_index, u32 sibling_index)
#define STRUCT_OFFSET_OF(t, f)
static fib_node_t * sixrd_fib_node_get(fib_node_index_t index)
Function definition to get a FIB node from its index.
VNET_HW_INTERFACE_CLASS(sixrd_hw_interface_class)
#define VNET_HW_INTERFACE_FLAG_LINK_UP
void ip4_register_protocol(u32 protocol, u32 node_index)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
bool ip4_protocol_registered
static void ip6ip_tunnel_stack(adj_index_t ai, u32 fib_entry_index)
fib_node_type_t fib_node_register_new_type(const fib_node_vft_t *vft)
Create a new FIB node type and Register the function table for it.
VNET_DEVICE_CLASS(sixrd_device_class)
static_always_inline u32 sixrd_get_addr_net(const ipip_tunnel_t *t, u64 dal)
fib_node_index_t fib_table_entry_update_one_path(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Update the entry to have just one path.
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
static void sixrd_fixup(vlib_main_t *vm, ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
memset(h->entries, 0, sizeof(h->entries[0])*entries)
#define VLIB_INIT_FUNCTION(x)
static uword ipip4_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static const sixrd_adj_delegate_t * sixrd_adj_from_const_base(const adj_delegate_t *ad)
Aggregrate type for a prefix.
u32 * tunnel_index_by_sw_if_index
fib_node_index_t sixrd_fib_entry_index
ipip_transport_t transport
#define vlib_call_init_function(vm, x)
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
static sixrd_adj_delegate_t * sixrd_adj_delegate_pool
Pool of delegate structs.
static u8 * sixrd_adj_delegate_format(const adj_delegate_t *aed, u8 *s)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static fib_node_back_walk_rc_t sixrd_fib_node_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
int adj_delegate_add(ip_adjacency_t *adj, adj_delegate_type_t adt, index_t adi)
Add a delegate to an adjacency.
void ipip_tunnel_db_add(ipip_tunnel_t *t, ipip_tunnel_key_t *key)
static uword vnet_hw_interface_get_flags(vnet_main_t *vnm, u32 hw_if_index)
ipip_tunnel_t * ipip_tunnel_db_find(ipip_tunnel_key_t *key)
ipip_tunnel_t * ipip_tunnel_db_find_by_sw_if_index(u32 sw_if_index)
enum adj_delegate_type_t_ adj_delegate_type_t
A Delagate is a means to implement the Delagation design pattern; the extension of an object's functi...
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define pool_put(P, E)
Free an object E in pool P.
static adj_delegate_type_t sixrd_adj_delegate_type
Adj delegate registered type.
void lookup_dpo_add_or_lock_w_fib_index(fib_node_index_t fib_index, dpo_proto_t proto, lookup_cast_t cast, lookup_input_t input, lookup_table_t table_config, dpo_id_t *dpo)
An node in the FIB graph.
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
#define ip46_address_initializer
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
fib_node_index_t fib_table_entry_special_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags)
Add a 'special' entry to the FIB.
void fib_table_entry_delete_index(fib_node_index_t fib_entry_index, fib_source_t source)
Delete a FIB entry.
index_t ad_index
The index passed by the provider to identify its delegate instance.
#define clib_warning(format, args...)
void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite)
adj_nbr_midchain_update_rewrite
u32 fib_node_index_t
A typedef of a node index.
u32 adj_index_t
An index for adjacencies.
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
static void ip6ip_fixup(vlib_main_t *vm, ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
void fib_table_lock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Release a reference counting lock on the table.
Context passed between object during a back walk.
void adj_nbr_midchain_stack(adj_index_t adj_index, const dpo_id_t *next)
adj_nbr_midchain_stack
adj_delegate_type_t adj_delegate_register_new_type(const adj_delegate_vft_t *vft)
adj_delegate_register_new_type
adj_delegate_t * adj_delegate_get(const ip_adjacency_t *adj, adj_delegate_type_t type)
Get a delegate from an adjacency.
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
struct sixrd_adj_delegate_t_ sixrd_adj_delegate_t
Adj delegate data.
int sixrd_add_tunnel(ip6_address_t *ip6_prefix, u8 ip6_prefix_len, ip4_address_t *ip4_prefix, u8 ip4_prefix_len, ip4_address_t *ip4_src, bool security_check, u32 ip4_fib_index, u32 ip6_fib_index, u32 *sw_if_index)
vlib_node_registration_t ip4_sixrd_node
This code supports the following sixrd modes:
static void sixrd_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
static clib_error_t * sixrd_init(vlib_main_t *vm)
void adj_nbr_midchain_unstack(adj_index_t adj_index)
adj_nbr_midchain_unstack
static fib_node_type_t sixrd_fib_node_type
FIB node registered type.
static sixrd_adj_delegate_t * sixrd_adj_from_base(adj_delegate_t *ad)
void fib_table_entry_path_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_route_path_flags_t path_flags)
remove one path to an entry (aka route) in the FIB.
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
struct _vlib_node_registration vlib_node_registration_t
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
static clib_error_t * ipip_init(vlib_main_t *vm)
An ADJ delegate virtual function table.
static void sixrd_tunnel_stack(adj_index_t ai, u32 fib_index)
static void sixrd_adj_delegate_adj_deleted(adj_delegate_t *aed)
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
A FIB graph nodes virtual function table.
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
int sixrd_del_tunnel(u32 sw_if_index)
struct ipip_tunnel_t::@227::@230 sixrd
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
#define CLIB_CACHE_LINE_BYTES
static u16 ip4_header_checksum(ip4_header_t *i)
const ip46_address_t ADJ_BCAST_ADDR
The special broadcast address (to construct a broadcast adjacency.
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)