36 u32 *sixrd_domain_index,
50 memset(d, 0,
sizeof (*d));
51 *sixrd_domain_index = d - mm->
domains;
61 if (ip4_prefix_len < 32)
62 d->
shift = 64 - ip6_prefix_len + (32 - ip4_prefix_len);
65 memset(&adj, 0,
sizeof(adj));
67 p = (
u32 *)&adj.rewrite_data[0];
68 *p = (
u32) (*sixrd_domain_index);
71 memset(&args6, 0,
sizeof(args6));
95 p = (
u32 *)&adj4->rewrite_data[0];
102 memset(&args4, 0,
sizeof(args4));
132 clib_warning(
"SIXRD domain delete: domain does not exist: %d", sixrd_domain_index);
138 memset(&adj, 0,
sizeof(adj));
142 memset(&args6, 0,
sizeof (args6));
160 u32 *p = (
u32 *)&adj4->rewrite_data[0];
163 memset(&args4, 0,
sizeof(args4));
190 u32 ip6_prefix_len=0, ip4_prefix_len=0, sixrd_domain_index;
205 else if (
unformat(line_input,
"mtu %d", &mtu))
217 &ip4_src, &sixrd_domain_index, mtu);
229 u32 sixrd_domain_index;
236 if (
unformat(line_input,
"index %d", &sixrd_domain_index))
259 "[%d] ip6-pfx %U/%d ip4-pfx %U/%d ip4-src %U mtu %d",
288 int domains = 0, domaincount = 0;
293 domains += sizeof(*d);
298 vlib_cli_output(vm,
"SIXRD domains: %d (%d bytes)\n", domaincount, domains);
314 s =
format(s,
"SIXRD domain index: %d", sixrd_domain_index);
320 .path =
"sixrd add domain",
322 "sixrd add domain ip6-pfx <ip6-pfx> ip4-pfx <ip4-pfx> ip4-src <ip4-addr>",
327 .path =
"sixrd del domain",
329 "sixrd del domain index <domain>",
334 .path =
"show sixrd domain",
339 .path =
"show sixrd stats",
371 ASSERT(ip6_lookup_node && ip4_lookup_node && ip6_sixrd_node && ip4_sixrd_node);
static vlib_node_registration_t ip4_sixrd_node
(constructor) VLIB_REGISTER_NODE (ip4_sixrd_node)
ip_lookup_next_t lookup_next_index
static clib_error_t * show_sixrd_stats_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static u8 * format_sixrd_domain(u8 *s, va_list *args)
ip_lookup_main_t lookup_main
static clib_error_t * sixrd_add_domain_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
vnet_main_t * vnet_get_main(void)
u32 ip4_lookup_next_index
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
#define clib_warning(format, args...)
u32 table_index_or_table_id
void ip6_add_del_route(ip6_main_t *im, ip6_add_del_route_args_t *args)
ip6_address_t dst_address
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static clib_error_t * show_sixrd_domain_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_error_t * vlib_plugin_register(vlib_main_t *vm, vnet_plugin_handoff_t *h, int from_early_init)
void * ip4_get_route(ip4_main_t *im, u32 fib_index_or_table_id, u32 flags, u8 *address, u32 address_length)
static clib_error_t * sixrd_del_domain_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static vlib_node_registration_t ip6_sixrd_node
(constructor) VLIB_REGISTER_NODE (ip6_sixrd_node)
#define pool_put(P, E)
Free an object E in pool P.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
int sixrd_delete_domain(u32 sixrd_domain_index)
#define IP6_ROUTE_FLAG_DEL
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define IP4_ROUTE_FLAG_DEL
vlib_node_registration_t ip6_lookup_node
(constructor) VLIB_REGISTER_NODE (ip6_lookup_node)
ip4_address_t dst_address
#define IP4_ROUTE_FLAG_ADD
static clib_error_t * sixrd_init(vlib_main_t *vm)
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
u8 * format_sixrd_trace(u8 *s, va_list *args)
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
int sixrd_create_domain(ip6_address_t *ip6_prefix, u8 ip6_prefix_len, ip4_address_t *ip4_prefix, u8 ip4_prefix_len, ip4_address_t *ip4_src, u32 *sixrd_domain_index, u16 mtu)
u32 table_index_or_table_id
ip4_main_t ip4_main
Global ip4 main structure.
#define IP6_ROUTE_FLAG_ADD
i16 explicit_fib_index
Force re-lookup in a different FIB.
#define clib_error_return(e, args...)
void ip4_add_del_route(ip4_main_t *im, ip4_add_del_route_args_t *args)
#define CLIB_CACHE_LINE_BYTES
u32 ip6_lookup_next_index
static ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
static uword pool_elts(void *v)
Number of active elements in a pool.