FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
ip6_mfib.c File Reference
+ Include dependency graph for ip6_mfib.c:

Go to the source code of this file.

Data Structures

struct  ip6_mfib_special_t_
 
struct  ip6_mfib_show_ctx_t_
 
struct  ip6_mfib_walk_ctx_t_
 Context when walking the IPv6 table. More...
 

Macros

#define FOR_EACH_IP6_SPECIAL(_pfx, _body)
 
#define IPV6_MFIB_GRP_LEN(_len)   (_len > 128 ? 128 : _len)
 
#define IP6_MFIB_MK_KEY(_mfib, _grp, _src, _len, _key)
 

Typedefs

typedef clib_bihash_kv_40_8_t ip6_mfib_key_t
 Key and mask for radix. More...
 
typedef enum ip6_mfib_special_type_t_ ip6_mfib_special_type_t
 
typedef struct ip6_mfib_special_t_ ip6_mfib_special_t
 
typedef struct ip6_mfib_show_ctx_t_ ip6_mfib_show_ctx_t
 
typedef struct ip6_mfib_walk_ctx_t_ ip6_mfib_walk_ctx_t
 Context when walking the IPv6 table. More...
 

Enumerations

enum  ip6_mfib_special_type_t_ { IP6_MFIB_SPECIAL_TYPE_NONE, IP6_MFIB_SPECIAL_TYPE_SOLICITED }
 

Functions

static u32 ip6_create_mfib_with_table_id (u32 table_id, mfib_source_t src)
 
void ip6_mfib_table_destroy (ip6_mfib_t *mfib)
 
void ip6_mfib_interface_enable_disable (u32 sw_if_index, int is_enable)
 Add/remove the interface from the accepting list of the special MFIB entries. More...
 
u32 ip6_mfib_table_find_or_create_and_lock (u32 table_id, mfib_source_t src)
 Get or create an IPv4 fib. More...
 
u32 ip6_mfib_table_get_index_for_sw_if_index (u32 sw_if_index)
 
fib_node_index_t ip6_mfib_table_lookup_exact_match (const ip6_mfib_t *mfib, const ip6_address_t *grp, const ip6_address_t *src, u32 len)
 
fib_node_index_t ip6_mfib_table_fwd_lookup (const ip6_mfib_t *mfib, const ip6_address_t *src, const ip6_address_t *grp)
 
fib_node_index_t ip6_mfib_table_get_less_specific (const ip6_mfib_t *mfib, const ip6_address_t *src, const ip6_address_t *grp, u32 len)
 
fib_node_index_t ip6_mfib_table_lookup (const ip6_mfib_t *mfib, const ip6_address_t *src, const ip6_address_t *grp, u32 len)
 The IPv4 Multicast-FIB. More...
 
static void compute_prefix_lengths_in_search_order (ip6_mfib_table_instance_t *table)
 
void ip6_mfib_table_entry_insert (ip6_mfib_t *mfib, const ip6_address_t *grp, const ip6_address_t *src, u32 len, fib_node_index_t mfib_entry_index)
 
void ip6_mfib_table_entry_remove (ip6_mfib_t *mfib, const ip6_address_t *grp, const ip6_address_t *src, u32 len)
 
static clib_error_tip6_mfib_module_init (vlib_main_t *vm)
 
u8format_ip6_mfib_table_memory (u8 *s, va_list *args)
 format (display) ipv6 MFIB mempry usage More...
 
static void ip6_mfib_table_show_one (ip6_mfib_t *mfib, vlib_main_t *vm, ip6_address_t *src, ip6_address_t *grp, u32 mask_len, u32 cover)
 
static int ip6_mfib_table_collect_entries (fib_node_index_t mfei, void *arg)
 
static void ip6_mfib_table_show_all (ip6_mfib_t *mfib, vlib_main_t *vm)
 
static int ip6_mfib_walk_cb (clib_bihash_kv_40_8_t *kvp, void *arg)
 
void ip6_mfib_table_walk (ip6_mfib_t *mfib, mfib_table_walk_fn_t fn, void *arg)
 Walk the IP6 mfib table. More...
 
static clib_error_tip6_show_mfib (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 

Variables

static const mfib_prefix_t all_zeros
 
static const ip6_mfib_special_t ip6_mfib_specials []
 
static vlib_cli_command_t ip6_show_fib_command
 (constructor) VLIB_CLI_COMMAND (ip6_show_fib_command) More...
 

Macro Definition Documentation

◆ FOR_EACH_IP6_SPECIAL

#define FOR_EACH_IP6_SPECIAL (   _pfx,
  _body 
)
Value:
{ \
const ip6_mfib_special_t *_spec; \
u8 _ii; \
for (_ii = 0; \
_ii++) \
{ \
_spec = &ip6_mfib_specials[_ii]; \
if (IP6_MFIB_SPECIAL_TYPE_SOLICITED == _spec->ims_type) \
{ \
ip6_set_solicited_node_multicast_address( \
&(_pfx)->fp_grp_addr.ip6, 0); \
} \
else \
{ \
ip6_set_reserved_multicast_address ( \
&(_pfx)->fp_grp_addr.ip6, \
_spec->ims_scope, \
_spec->ims_byte); \
} \
(_pfx)->fp_len = _spec->ims_len; \
do { _body; } while (0); \
} \
}
static const ip6_mfib_special_t ip6_mfib_specials[]
Definition: ip6_mfib.c:65
#define ARRAY_LEN(x)
Definition: clib.h:62

Definition at line 104 of file ip6_mfib.c.

◆ IP6_MFIB_MK_KEY

#define IP6_MFIB_MK_KEY (   _mfib,
  _grp,
  _src,
  _len,
  _key 
)
Value:
{ \
_key.key[0] = (_grp->as_u64[0] & \
ip6_main.fib_masks[IPV6_MFIB_GRP_LEN(_len)].as_u64[0]); \
_key.key[1] = (_grp->as_u64[1] & \
ip6_main.fib_masks[IPV6_MFIB_GRP_LEN(_len)].as_u64[1]); \
if (_len == 256) { \
_key.key[2] = _src->as_u64[0]; \
_key.key[3] = _src->as_u64[1]; \
} else { \
_key.key[2] = 0; \
_key.key[3] = 0; \
} \
_key.key[4] = _mfib->index; \
_key.key[4] = (_key.key[4] << 32) | len; \
}
#define IPV6_MFIB_GRP_LEN(_len)
Definition: ip6_mfib.c:300
u8 len
Definition: ip_types.api:49

Definition at line 303 of file ip6_mfib.c.

◆ IPV6_MFIB_GRP_LEN

#define IPV6_MFIB_GRP_LEN (   _len)    (_len > 128 ? 128 : _len)

Definition at line 300 of file ip6_mfib.c.

Typedef Documentation

◆ ip6_mfib_key_t

Key and mask for radix.

Definition at line 25 of file ip6_mfib.c.

◆ ip6_mfib_show_ctx_t

◆ ip6_mfib_special_t

◆ ip6_mfib_special_type_t

◆ ip6_mfib_walk_ctx_t

Context when walking the IPv6 table.

Since all VRFs are in the same hash table, we need to filter only those we need as we walk

Enumeration Type Documentation

◆ ip6_mfib_special_type_t_

Enumerator
IP6_MFIB_SPECIAL_TYPE_NONE 
IP6_MFIB_SPECIAL_TYPE_SOLICITED 

Definition at line 39 of file ip6_mfib.c.

Function Documentation

◆ compute_prefix_lengths_in_search_order()

static void compute_prefix_lengths_in_search_order ( ip6_mfib_table_instance_t table)
static

Definition at line 453 of file ip6_mfib.c.

+ Here is the caller graph for this function:

◆ format_ip6_mfib_table_memory()

u8* format_ip6_mfib_table_memory ( u8 s,
va_list *  args 
)

format (display) ipv6 MFIB mempry usage

Definition at line 522 of file ip6_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_create_mfib_with_table_id()

static u32 ip6_create_mfib_with_table_id ( u32  table_id,
mfib_source_t  src 
)
static

Definition at line 132 of file ip6_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_mfib_interface_enable_disable()

void ip6_mfib_interface_enable_disable ( u32  sw_if_index,
int  is_enable 
)

Add/remove the interface from the accepting list of the special MFIB entries.

Definition at line 232 of file ip6_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_mfib_module_init()

static clib_error_t* ip6_mfib_module_init ( vlib_main_t vm)
static

Definition at line 514 of file ip6_mfib.c.

◆ ip6_mfib_table_collect_entries()

static int ip6_mfib_table_collect_entries ( fib_node_index_t  mfei,
void *  arg 
)
static

Definition at line 561 of file ip6_mfib.c.

+ Here is the caller graph for this function:

◆ ip6_mfib_table_destroy()

void ip6_mfib_table_destroy ( ip6_mfib_t mfib)

Definition at line 191 of file ip6_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_mfib_table_entry_insert()

void ip6_mfib_table_entry_insert ( ip6_mfib_t mfib,
const ip6_address_t grp,
const ip6_address_t src,
u32  len,
fib_node_index_t  mfib_entry_index 
)

Definition at line 465 of file ip6_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_mfib_table_entry_remove()

void ip6_mfib_table_entry_remove ( ip6_mfib_t mfib,
const ip6_address_t grp,
const ip6_address_t src,
u32  len 
)

Definition at line 490 of file ip6_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_mfib_table_find_or_create_and_lock()

u32 ip6_mfib_table_find_or_create_and_lock ( u32  table_id,
mfib_source_t  src 
)

Get or create an IPv4 fib.

Get or create an IPv4 fib with the provided table ID.

Parameters
table_idWhen set to ~0, an arbitrary and unused fib ID is picked and can be retrieved with ret->table_id. Otherwise, the fib ID to be used to retrieve or create the desired fib.
Returns
A pointer to the retrieved or created fib.

Definition at line 273 of file ip6_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_mfib_table_fwd_lookup()

fib_node_index_t ip6_mfib_table_fwd_lookup ( const ip6_mfib_t mfib,
const ip6_address_t src,
const ip6_address_t grp 
)

Definition at line 350 of file ip6_mfib.c.

+ Here is the caller graph for this function:

◆ ip6_mfib_table_get_index_for_sw_if_index()

u32 ip6_mfib_table_get_index_for_sw_if_index ( u32  sw_if_index)

Definition at line 287 of file ip6_mfib.c.

+ Here is the caller graph for this function:

◆ ip6_mfib_table_get_less_specific()

fib_node_index_t ip6_mfib_table_get_less_specific ( const ip6_mfib_t mfib,
const ip6_address_t src,
const ip6_address_t grp,
u32  len 
)

Definition at line 378 of file ip6_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_mfib_table_lookup()

fib_node_index_t ip6_mfib_table_lookup ( const ip6_mfib_t fib,
const ip6_address_t src,
const ip6_address_t grp,
u32  len 
)

The IPv4 Multicast-FIB.

FIXME

This IPv4 FIB is used by the protocol independent FIB. So directly using this APIs in client code is not encouraged. However, this IPv4 FIB can be used if all the client wants is an IPv4 prefix data-base

Definition at line 415 of file ip6_mfib.c.

+ Here is the caller graph for this function:

◆ ip6_mfib_table_lookup_exact_match()

fib_node_index_t ip6_mfib_table_lookup_exact_match ( const ip6_mfib_t mfib,
const ip6_address_t grp,
const ip6_address_t src,
u32  len 
)

Definition at line 326 of file ip6_mfib.c.

+ Here is the caller graph for this function:

◆ ip6_mfib_table_show_all()

static void ip6_mfib_table_show_all ( ip6_mfib_t mfib,
vlib_main_t vm 
)
static

Definition at line 571 of file ip6_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_mfib_table_show_one()

static void ip6_mfib_table_show_one ( ip6_mfib_t mfib,
vlib_main_t vm,
ip6_address_t src,
ip6_address_t grp,
u32  mask_len,
u32  cover 
)
static

Definition at line 532 of file ip6_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_mfib_table_walk()

void ip6_mfib_table_walk ( ip6_mfib_t mfib,
mfib_table_walk_fn_t  fn,
void *  ctx 
)

Walk the IP6 mfib table.

Parameters
mfibthe table to walk
fnThe function to invoke on each entry visited
ctxA context passed in the visit function

Definition at line 621 of file ip6_mfib.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip6_mfib_walk_cb()

static int ip6_mfib_walk_cb ( clib_bihash_kv_40_8_t kvp,
void *  arg 
)
static

Definition at line 608 of file ip6_mfib.c.

+ Here is the caller graph for this function:

◆ ip6_show_mfib()

static clib_error_t* ip6_show_mfib ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 638 of file ip6_mfib.c.

+ Here is the call graph for this function:

Variable Documentation

◆ all_zeros

const mfib_prefix_t all_zeros
static
Initial value:
= {
.fp_src_addr = {
.ip6.as_u64 = {0, 0},
},
.fp_grp_addr = {
.ip6.as_u64 = {0, 0},
},
.fp_len = 0,
.fp_proto = FIB_PROTOCOL_IP6,
}

Definition at line 27 of file ip6_mfib.c.

◆ ip6_mfib_specials

const ip6_mfib_special_t ip6_mfib_specials[]
static
Initial value:
=
{
{
.ims_len = 104,
},
{
.ims_scope = IP6_MULTICAST_SCOPE_link_local,
.ims_byte = IP6_MULTICAST_GROUP_ID_all_routers,
.ims_len = 128,
},
{
.ims_scope = IP6_MULTICAST_SCOPE_link_local,
.ims_byte = IP6_MULTICAST_GROUP_ID_all_hosts,
.ims_len = 128,
},
{
.ims_len = 128,
.ims_scope = IP6_MULTICAST_SCOPE_link_local,
.ims_byte = IP6_MULTICAST_GROUP_ID_mldv2_routers,
}
}

Definition at line 65 of file ip6_mfib.c.

◆ ip6_show_fib_command

vlib_cli_command_t ip6_show_fib_command
static
Initial value:
= {
.path = "show ip6 mfib",
.short_help = "show ip mfib [summary] [table <table-id>] [index <fib-id>] [<grp-addr>[/<mask>]] [<grp-addr>] [<src-addr> <grp-addr>]",
.function = ip6_show_mfib,
}
static clib_error_t * ip6_show_mfib(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: ip6_mfib.c:638

(constructor) VLIB_CLI_COMMAND (ip6_show_fib_command)

Definition at line 770 of file ip6_mfib.c.