52 #define FOREACH_IP6_LINK_DELEGATE(_ild, _il, body) \ 55 vec_foreach (_ild, _il->il_delegates) { \ 56 if (ip6_link_delegate_is_init(_ild)) \ 62 #define FOREACH_IP6_LINK_DELEGATE_ID(_id) \ 63 for (_id = 0; _id < il_delegate_id; _id++) 80 #define IP6_LINK_DBG(...) \ 81 vlib_log_debug (ip6_link_logger, __VA_ARGS__); 83 #define IP6_LINK_INFO(...) \ 84 vlib_log_notice (ip6_link_logger, __VA_ARGS__); 101 ip->as_u64[0] = clib_host_to_net_u64 (0xFE80000000000000ULL);
103 ip->as_u8[8] = mac[0] ^ (1 << 1);
104 ip->as_u8[9] = mac[1];
105 ip->as_u8[10] = mac[2];
106 ip->as_u8[11] = 0xFF;
107 ip->as_u8[12] = 0xFE;
108 ip->as_u8[13] = mac[3];
109 ip->as_u8[14] = mac[4];
110 ip->as_u8[15] = mac[5];
117 mac[0] = ip->as_u8[8] ^ (1 << 1);
118 mac[1] = ip->as_u8[9];
119 mac[2] = ip->as_u8[10];
120 mac[3] = ip->as_u8[13];
121 mac[4] = ip->as_u8[14];
122 mac[5] = ip->as_u8[15];
130 if (sw_if_index >=
vec_len (ip6_links))
170 rv = VNET_API_ERROR_UNSUPPORTED;
178 rv = VNET_API_ERROR_UNSUPPORTED;
190 if (NULL != link_local_addr)
197 clib_host_to_net_u64 (0xFE80000000000000ULL);
230 if (NULL != il_delegate_vfts[
id].ildv_enable)
238 rv = VNET_API_ERROR_VALUE_EXIST;
304 return (VNET_API_ERROR_IP6_NOT_ENABLED);
314 const ip6_address_t *
338 const ip6_address_t *
dst, ip6_address_t *
src)
358 ip6_address_t *if_ip =
417 il_delegate_vfts[rc] = *vft;
473 &ip6_link_delegate_uninit,
485 u32 if_address_index,
u32 is_delete)
495 (is_delete ?
"del" :
"add"),
511 address, address_length);
517 address, address_length);
569 ip6_address_t _a, *
a = &_a;
597 .path =
"test ip6 link",
599 .short_help =
"test ip6 link <mac-address>",
609 for (i = 0; i <
vec_len (addrs); i++)
615 s =
format (s,
"%U%U/%d\n",
633 s =
format (s,
"%U is admin %s\n",
640 u32 *link_scope = 0, *global_scope = 0;
641 u32 *local_scope = 0, *unknown_scope = 0;
649 while (ai != (
u32) ~ 0)
682 s =
format (s,
"%UGlobal unicast address(es):\n",
781 .path =
"show ip6 interface",
783 .short_help =
"show ip6 interface <interface>",
821 .path =
"enable ip6 interface",
823 .short_help =
"enable ip6 interface <interface>",
861 .path =
"disable ip6 interface",
863 .short_help =
"disable ip6 interface <interface>",
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
ip6_link_delegate_t * il_delegates
list of delegates
int ip6_link_enable(u32 sw_if_index, const ip6_address_t *link_local_addr)
IPv6 Configuration on an interface.
ip_interface_address_t * if_address_pool
Pool of addresses that are assigned to interfaces.
vnet_main_t * vnet_get_main(void)
int ip6_link_set_local_address(u32 sw_if_index, const ip6_address_t *address)
struct ip6_link_delegate_t_ ip6_link_delegate_t
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
static void ip6_link_unlock(ip6_link_t *il)
struct ip6_link_t_ ip6_link_t
static u8 * ip6_print_addrs(u8 *s, u32 *addrs)
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).
static u64 clib_cpu_time_now(void)
static bool ip6_link_is_enabled_i(const ip6_link_t *il)
int ip6_link_disable(u32 sw_if_index)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
unformat_function_t unformat_vnet_sw_interface
static uword ip6_address_is_local_unicast(const ip6_address_t *a)
static u64 random_u64(u64 *seed)
64-bit random number generator Again, constants courtesy of Donald Knuth.
adj_index_t ip6_link_get_mcast_adj(u32 sw_if_index)
format_function_t format_vnet_sw_if_index_name
adj_index_t il_mcast_adj
multicast adjacency for this link
static clib_error_t * test_ip6_link_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ip6_link_address_change_fn_t ildv_addr_add
#define clib_memcpy(d, s, n)
static u64 il_randomizer
Randomizer.
ethernet_main_t ethernet_main
static void ip6_mac_address_from_link_local(u8 *mac, const ip6_address_t *ip)
u8 * format_ethernet_address(u8 *s, va_list *args)
vl_api_interface_index_t sw_if_index
#define VLIB_INIT_FUNCTION(x)
static vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define clib_error_return(e, args...)
int ip6_src_address_for_packet(u32 sw_if_index, const ip6_address_t *dst, ip6_address_t *src)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
static clib_error_t * disable_ip6_interface_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ip6_address_t il_ll_addr
link-local address - if unset that IP6 is disabled
static void ip6_link_delegate_flush(ip6_link_t *il)
#define FOREACH_IP6_LINK_DELEGATE_ID(_id)
format_function_t format_vnet_sw_interface_name
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static ip6_link_t * ip6_link_get(u32 sw_if_index)
static ip6_link_t * ip6_links
Per interface configs.
static clib_error_t * ip6_link_init(vlib_main_t *vm)
static ip6_link_delegate_vft_t * il_delegate_vfts
VFT registered per-delegate type.
ip6_link_address_change_fn_t ildv_addr_del
#define IP6_LINK_DBG(...)
static vlib_log_class_t ip6_link_logger
Logging.
ip6_add_del_interface_address_callback_t * add_del_interface_address_callbacks
ip6_link_delegate_id_t ip6_link_delegate_register(const ip6_link_delegate_vft_t *vft)
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.
#define IP6_LINK_INFO(...)
static void ip6_address_set_zero(ip6_address_t *a)
static uword ip6_address_is_zero(const ip6_address_t *a)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
static void ip6_link_last_lock_gone(ip6_link_t *il)
u32 adj_index_t
An index for adjacencies.
index_t ip6_link_delegate_get(u32 sw_if_index, ip6_link_delegate_id_t id)
ip6_address_t ilp_addr
the IP6 address
static u8 * format_ip6_link(u8 *s, va_list *arg)
#define VLIB_CLI_COMMAND(x,...)
u32 * if_address_pool_index_by_sw_if_index
Head of doubly linked list of interface addresses for each software interface.
ip6_add_del_interface_address_function_t * function
static clib_error_t * ip6_link_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
u32 ip6_link_delegate_id_t
static clib_error_t * enable_ip6_interface_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
format_function_t * ildv_format
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
manual_print typedef address
ip_lookup_main_t lookup_main
static clib_error_t * ip6_link_interface_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
Aggregate type for a prefix in the IPv6 Link-local table.
#define FOREACH_IP6_LINK_DELEGATE(_ild, _il, body)
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(ip6_link_interface_add_del)
u32 il_sw_if_index
interface ip6 is enabled on
static uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
ip6_link_disable_fn_t ildv_disable
static uword ip6_address_is_global_unicast(const ip6_address_t *a)
ethernet_interface_t * ethernet_get_interface(ethernet_main_t *em, u32 hw_if_index)
static bool ip6_link_delegate_is_init(const ip6_link_delegate_t *ild)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
const ip6_address_t * ip6_get_link_local_address(u32 sw_if_index)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
void ip6_ll_table_entry_delete(const ip6_ll_prefix_t *ilp)
Delete a IP6 link-local entry.
static void ip6_address_copy(ip6_address_t *dst, const ip6_address_t *src)
bool ip6_link_is_enabled(u32 sw_if_index)
static ip6_link_delegate_id_t il_delegate_id
last used delegate ID
vnet_sw_interface_type_t type
u32 il_locks
number of references to IP6 enabled on this link
static void ip6_link_add_del_address(ip6_main_t *im, uword opaque, u32 sw_if_index, ip6_address_t *address, u32 address_length, u32 if_address_index, u32 is_delete)
adj_index_t adj_mcast_add_or_lock(fib_protocol_t proto, vnet_link_t link_type, u32 sw_if_index)
Mcast Adjacency.
#define vec_foreach(var, vec)
Vector iterator.
ip6_link_enable_fn_t ildv_enable
#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)
fib_node_index_t ip6_ll_table_entry_update(const ip6_ll_prefix_t *ilp, fib_route_path_flags_t flags)
Update an entry in the table.
void ip6_link_delegate_remove(u32 sw_if_index, ip6_link_delegate_id_t id, index_t ii)
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
bool ip6_link_delegate_update(u32 sw_if_index, ip6_link_delegate_id_t id, index_t ii)
u32 next_this_sw_interface
static void ip6_link_local_address_from_mac(ip6_address_t *ip, const u8 *mac)
ip6_link_delegate_id_t ild_type
ip6_link_ll_change_fn_t ildv_ll_change