FD.io VPP  v17.04.2-2-ga8f93f8
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_key_t_
 Key and mask for radix. More...
 
struct  ip6_mfib_node_t_
 An object that is inserted into the radix tree. More...
 
struct  ip6_mfib_special_t_
 
struct  ip6_mfib_show_ctx_t_
 
struct  ip6_mfib_radix_walk_ctx_t_
 

Macros

#define IP6_MFIB_KEY_LEN   33
 The number of bytes in an address/ask key in the radix tree First byte is the length in bytes. More...
 
#define FOR_EACH_IP6_SPECIAL(_pfx, _body)
 
#define IP6_MFIB_MK_KEY(_grp, _src, _key)
 
#define IP6_MFIB_MK_KEY_MASK(_grp, _src, _len, _key)
 

Typedefs

typedef struct ip6_mfib_key_t_ ip6_mfib_key_t
 Key and mask for radix. More...
 
typedef struct ip6_mfib_node_t_ ip6_mfib_node_t
 An object that is inserted into the radix tree. 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_radix_walk_ctx_t_ ip6_mfib_radix_walk_ctx_t
 

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)
 
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)
 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_lookup (const ip6_mfib_t *mfib, const ip6_address_t *src, const ip6_address_t *grp, u32 len)
 The IPv4 Multicast-FIB. More...
 
fib_node_index_t ip6_mfib_table_lookup2 (const ip6_mfib_t *mfib, const ip6_address_t *src, const ip6_address_t *grp)
 Data-plane lookup function. More...
 
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)
 
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)
 
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_table_radix_walk (struct radix_node *rn, void *arg)
 
void ip6_mfib_table_walk (ip6_mfib_t *mfib, mfib_table_walk_fn_t fn, void *ctx)
 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

#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) \
{ \
&(_pfx)->fp_grp_addr.ip6, 0); \
} \
else \
{ \
&(_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:87
#define ARRAY_LEN(x)
Definition: clib.h:59
static void ip6_set_solicited_node_multicast_address(ip6_address_t *a, u32 id)
Definition: ip6_packet.h:168
unsigned char u8
Definition: types.h:56
static void ip6_set_reserved_multicast_address(ip6_address_t *a, ip6_multicast_address_scope_t scope, u16 id)
Definition: ip6_packet.h:158

Definition at line 126 of file ip6_mfib.c.

#define IP6_MFIB_KEY_LEN   33

The number of bytes in an address/ask key in the radix tree First byte is the length in bytes.

Definition at line 26 of file ip6_mfib.c.

#define IP6_MFIB_MK_KEY (   _grp,
  _src,
  _key 
)
Value:
{ \
(_key)->key[0] = 33; \
memcpy((_key)->key+1, _grp, 16); \
memcpy((_key)->key+17, _src, 16); \
}

Definition at line 325 of file ip6_mfib.c.

#define IP6_MFIB_MK_KEY_MASK (   _grp,
  _src,
  _len,
  _key 
)
Value:
{ \
IP6_MFIB_MK_KEY(_grp, _src, _key); \
\
(_key)->mask[0] = 33; \
if (_len <= 128) \
{ \
memcpy((_key)->mask+1, &ip6_main.fib_masks[_len], 16); \
memset((_key)->mask+17, 0, 16); \
} \
else \
{ \
ASSERT(_len == 256); \
memcpy((_key)->mask+1, &ip6_main.fib_masks[128], 16); \
memcpy((_key)->mask+17, &ip6_main.fib_masks[128], 16); \
} \
}
#define IP6_MFIB_MK_KEY(_grp, _src, _key)
Definition: ip6_mfib.c:325
ip6_address_t fib_masks[129]
Definition: ip6.h:160
#define ASSERT(truth)
ip6_main_t ip6_main
Definition: ip6_forward.c:2846

Definition at line 332 of file ip6_mfib.c.

Typedef Documentation

Key and mask for radix.

An object that is inserted into the radix tree.

Since it's in the tree and has pointers, it cannot realloc and so cannot come from a vlib pool.

Enumeration Type Documentation

Enumerator
IP6_MFIB_SPECIAL_TYPE_NONE 
IP6_MFIB_SPECIAL_TYPE_SOLICITED 

Definition at line 61 of file ip6_mfib.c.

Function Documentation

static u32 ip6_create_mfib_with_table_id ( u32  table_id)
static

Definition at line 154 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 258 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* ip6_mfib_module_init ( vlib_main_t vm)
static

Definition at line 465 of file ip6_mfib.c.

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

Definition at line 491 of file ip6_mfib.c.

+ Here is the caller graph for this function:

void ip6_mfib_table_destroy ( ip6_mfib_t mfib)

Definition at line 216 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 426 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 449 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 ip6_mfib_table_find_or_create_and_lock ( u32  table_id)

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 299 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 ip6_mfib_table_get_index_for_sw_if_index ( u32  sw_if_index)

Definition at line 312 of file ip6_mfib.c.

+ Here is the caller graph for this function:

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 383 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Data-plane lookup function.

Definition at line 408 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 356 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int ip6_mfib_table_radix_walk ( struct radix_node rn,
void *  arg 
)
static

Definition at line 533 of file ip6_mfib.c.

+ Here is the caller graph for this function:

static void ip6_mfib_table_show_all ( ip6_mfib_t mfib,
vlib_main_t vm 
)
static

Definition at line 501 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)
static

Definition at line 473 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 547 of file ip6_mfib.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 562 of file ip6_mfib.c.

+ Here is the call graph for this function:

Variable Documentation

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 49 of file ip6_mfib.c.

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 87 of file ip6_mfib.c.

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:562

(constructor) VLIB_CLI_COMMAND (ip6_show_fib_command)

Definition at line 688 of file ip6_mfib.c.