|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
110 if (prefix_group_index >=
122 static const u32 empty = ~0;
124 ASSERT (prefix_group_index != ~0);
126 if (prefix_index == ~0
127 && prefix_group_index >=
132 prefix_group_index, empty);
206 i32 diff_time = client_state->
T2 - current_time;
209 params.
mrd = diff_time;
219 params.
mrd = diff_time;
229 if (
vec_len (prefix_list) != 0)
236 pref->preferred_lt =
prefix->preferred_lt;
237 pref->prefix =
prefix->prefix;
238 pref->prefix_length =
prefix->prefix_length;
254 if (prefix1->as_u64[0] != prefix2->as_u64[0])
258 return clib_net_to_host_u64 (prefix1->as_u64[1]) >> (128 -
len) ==
259 clib_net_to_host_u64 (prefix2->as_u64[1]) >> (128 -
len);
261 return clib_net_to_host_u64 (prefix1->as_u64[0]) >> (64 -
len) ==
262 clib_net_to_host_u64 (prefix2->as_u64[0]) >> (64 -
len);
276 u32 inner_status_code;
312 (
"Advertise message arrived with NoPrefixAvail status code");
318 for (
i = 0;
i < n_prefixes;
i++)
324 prefix_info = &prefix_list[
i];
343 clib_warning (
"Reply message arrived with Server ID different "
344 "from that in Request or Renew message");
350 clib_warning (
"Reply message arrived with NoPrefixAvail status code");
354 (
"Invalid Reply message arrived: It contains NoPrefixAvail "
355 "status code but also contains prefixes");
362 clib_warning (
"Reply message arrived with UnspecFail status code");
381 for (
i = 0;
i < n_prefixes;
i++)
404 u8 address_prefix_present = 0;
417 address_prefix_present = 1;
422 if (address_prefix_present)
464 client_state->
T1 = ntohl (mp->
T1);
465 client_state->
T2 = ntohl (mp->
T2);
466 if (client_state->
T1 != 0)
468 if (client_state->
T2 != 0)
491 clib_memcpy (&prefix_list[pos], prefix_info,
sizeof (*prefix_info));
509 f64 sleep_time = 1e9;
513 uword *event_data = 0;
532 due_time = current_time + 1e9;
538 if (prefix_info->
due_time > current_time)
540 if (prefix_info->
due_time < due_time)
603 while (due_time < current_time);
605 sleep_time = due_time - current_time;
615 .name =
"dhcp6-pd-client-cp-process",
654 ip6_address_t * r_addr)
660 addr0 = clib_net_to_host_u64 (address_info->
address.as_u64[0]);
662 if (
prefix->prefix_length > 64)
669 pref = clib_host_to_net_u64 (
prefix->prefix.as_u64[0]);
672 r_addr->as_u64[0] = clib_host_to_net_u64 (addr0);
673 r_addr->as_u64[1] = address_info->
address.as_u64[1];
695 if (prefix_index != ~0)
748 if (prefix_index == ~0)
764 "but active prefix index is not set");
785 u32 ignore_prefix_index)
794 prefix_info - pm->
prefix_pool != ignore_prefix_index)
841 clib_warning (
"Advertise prefix %U valid lt %u preferred lt %u",
855 u32 new_prefix_index;
856 u32 prefix_group_index;
860 prefix_group_index =
prefix->prefix_group_index;
865 (prefix_group_index) == ~0)
868 (prefix_group_index, prefix_index);
886 (prefix_group_index) == prefix_index)
899 (prefix_group_index, ~0);
903 if (new_prefix_index != ~0)
906 (prefix_group_index, new_prefix_index);
936 (
const char *)
name))
941 name_dup = (
u8 *) strdup ((
const char *)
name);
942 if (free_index != ~0)
963 u32 prefix_group_index;
969 return VNET_API_ERROR_INVALID_VALUE;
972 if (prefix_group != 0 && prefix_group[0] !=
'\0')
974 if (strnlen ((
const char *) prefix_group, 64) == 64)
975 return VNET_API_ERROR_INVALID_VALUE;
980 prefix_group_index = ~0;
992 return VNET_API_ERROR_DUPLICATE_IF_ADDRESS;
1001 return VNET_API_ERROR_ADDRESS_NOT_FOUND_FOR_INTERFACE;
1022 u8 *prefix_group = 0;
1036 else if (
unformat (line_input,
"prefix group %s", &prefix_group));
1041 else if (
unformat (line_input,
"del"))
1056 else if (address_set == 0)
1085 .path =
"set ip6 address",
1086 .short_help =
"set ip6 address <interface> [prefix group <string>] "
1100 const u8 *prefix_group;
1108 prefix_group = (
const u8 *)
"NONE";
1113 "sw_if_index: %u, prefix_group: %s, address: %U/%d",
1124 .path =
"show ip6 addresses",
1125 .short_help =
"show ip6 addresses",
1138 const u8 *prefix_group;
1147 "preferred lifetime: %u, valid lifetime: %u "
1153 prefix_info->
due_time - current_time);
1162 .path =
"show ip6 prefixes",
1163 .short_help =
"show ip6 prefixes",
1178 const u8 *prefix_group;
1181 const char *rebinding;
1193 buf1 =
format (buf1,
"%u remaining",
1197 buf1 =
format (buf1,
"timeout");
1199 buf2 =
format (buf2,
"%u remaining",
1202 buf2 =
format (buf2,
"timeout");
1204 rebinding =
", REBINDING";
1211 "sw_if_index: %u, prefix group: %s, T1: %u (%v), "
1212 "T2: %u (%v), server index: %d%s",
i,
1213 prefix_group, cs->
T1, buf1, cs->
T2, buf2,
1217 prefix_group, rebinding);
1229 .path =
"show ip6 pd clients",
1230 .short_help =
"show ip6 pd clients",
1239 const u8 * prefix_group,
u8 enable)
1250 u32 prefix_group_index;
1255 return VNET_API_ERROR_INVALID_VALUE;
1266 if (strnlen ((
const char *) prefix_group, 64) == 64
1267 || prefix_group[0] ==
'\0')
1268 return VNET_API_ERROR_INVALID_VALUE;
1269 prefix_group_index =
1273 return VNET_API_ERROR_INVALID_VALUE;
1276 if (!old_enabled && enable)
1294 else if (old_enabled && !enable)
1317 prefix_list[0] = *prefix_info;
1332 clib_memset (client_state, 0,
sizeof (*client_state));
1347 u8 *prefix_group = 0;
1360 else if (
unformat (line_input,
"prefix group %s", &prefix_group));
1361 else if (
unformat (line_input,
"disable"))
1371 if (prefix_group == 0 && enable)
1403 .path =
"dhcp6 pd client",
1404 .short_help =
"dhcp6 pd client <interface> (prefix group <string> | disable)",
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
VNET_DHCP6_PD_REPLY_EVENT_FUNCTION(dhcp6_pd_reply_event_handler)
u8 configured_in_data_plane
int ip6_ra_prefix(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *prefix_addr, u8 prefix_len, u8 use_default, u32 val_lifetime, u32 pref_lifetime, u8 no_advertise, u8 off_link, u8 no_autoconfig, u8 no_onlink, u8 is_no)
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
vnet_interface_main_t * im
prefix_info_t * prefix_pool
vl_api_dhcp6_pd_prefix_info_t prefixes[n_prefixes]
static void cp_ip6_address_prefix_add_del_handler(u32 prefix_index, u8 is_add)
static void cp_ip6_address_add_del_now(ip6_address_info_t *address_info, u8 is_add)
void dhcp6_pd_send_client_message(vlib_main_t *vm, u32 sw_if_index, u8 stop, dhcp6_pd_send_client_message_params_t *params)
#define clib_memcpy(d, s, n)
dhcp6_pd_send_client_message_params_prefix_t * prefixes
static vlib_cli_command_t ip6_pd_clients_show_command
(constructor) VLIB_CLI_COMMAND (ip6_pd_clients_show_command)
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
int dhcp6_cp_ip6_address_add_del(u32 sw_if_index, const u8 *prefix_group, ip6_address_t address, u8 prefix_length, u8 is_add)
vlib_main_t vlib_node_runtime_t * node
@ DHCPV6_STATUS_NOPREFIX_AVAIL
#define clib_error_return(e, args...)
client_state_t * client_state_by_sw_if_index
vlib_node_main_t node_main
static void interrupt_process(void)
#define pool_put(P, E)
Free an object E in pool P.
static clib_error_t * dhcp_pd_client_cp_init(vlib_main_t *vm)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static_always_inline void active_prefix_index_by_prefix_group_index_set(u32 prefix_group_index, u32 prefix_index)
static u32 cp_ip6_address_find_new_active_prefix(u32 prefix_group_index, u32 ignore_prefix_index)
static vlib_cli_command_t dhcp6_pd_client_enable_disable_command
(constructor) VLIB_CLI_COMMAND (dhcp6_pd_client_enable_disable_command)
const u8 ** prefix_group_name_by_index
static void send_client_message_start_stop(u32 sw_if_index, u32 server_index, u8 msg_type, prefix_info_t *prefix_list, u8 start)
static_always_inline void set_is_dhcpv6_pd_prefix(prefix_info_t *prefix_info, u8 value)
static u32 prefix_group_find_or_create(const u8 *name, u8 create)
static u32 cp_ip6_construct_address(ip6_address_info_t *address_info, u32 prefix_index, ip6_address_t *r_addr)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
void vlib_start_process(vlib_main_t *vm, uword process_index)
vlib_node_registration_t dhcp6_pd_client_cp_process_node
(constructor) VLIB_REGISTER_NODE (dhcp6_pd_client_cp_process_node)
u32 * active_prefix_index_by_prefix_group_index
__clib_export u8 * format_clib_error(u8 *s, va_list *va)
static uword vnet_sw_interface_is_api_valid(vnet_main_t *vnm, u32 sw_if_index)
#define vec_elt(v, i)
Get vector value at index i.
static clib_error_t * cp_ip6_prefixes_show_command_function(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type,...
static ip6_prefix_main_t ip6_prefix_main
static void notify_prefix_add_del(u32 prefix_index, u8 is_add)
#define pool_foreach(VAR, POOL)
Iterate through pool.
static prefix_info_t * create_prefix_list(u32 sw_if_index)
clib_error_t * ip6_add_del_interface_address(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *address, u32 address_length, u32 is_del)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
static vlib_cli_command_t ip6_address_add_del_command
(constructor) VLIB_CLI_COMMAND (ip6_address_add_del_command)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static ip6_address_with_prefix_main_t ip6_address_with_prefix_main
vnet_main_t * vnet_get_main(void)
static clib_error_t * dhcp6_pd_reply_event_handler(vl_api_dhcp6_pd_reply_event_t *mp)
int dhcp6_pd_client_enable_disable(u32 sw_if_index, const u8 *prefix_group, u8 enable)
static void cp_ip6_advertise_prefix(prefix_info_t *prefix_info, ip6_address_info_t *address_info, int enable)
@ DHCPV6_PD_EVENT_INTERRUPT
#define static_always_inline
static vlib_cli_command_t ip6_prefixes_show_command
(constructor) VLIB_CLI_COMMAND (ip6_prefixes_show_command)
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
static api_main_t * vlibapi_get_main(void)
clib_bitmap_t * prefix_ownership_bitmap
vl_api_dhcpv6_msg_type_t msg_type
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
manual_print typedef address
#define VLIB_CLI_COMMAND(x,...)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
vl_api_interface_index_t sw_if_index
struct _vlib_node_registration vlib_node_registration_t
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static_always_inline u32 active_prefix_index_by_prefix_group_index_get(u32 prefix_group_index)
static void disable_process(void)
API main structure, used by both vpp and binary API clients.
ip6_address_info_t * addresses
#define vec_free(V)
Free vector's memory (no header).
void ip6_ra_update_secondary_radv_info(ip6_address_t *address, u8 prefix_len, u32 primary_sw_if_index, u32 valid_time, u32 preferred_time)
static clib_error_t * cp_ip6_addresses_show_command_function(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
description fragment has unexpected format
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
Tell client about a DHCPv6 PD server reply event.
static clib_error_t * ip6_pd_clients_show_command_function(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_INIT_FUNCTION(x)
void dhcp6_clients_enable_disable(u8 enable)
#define vec_foreach(var, vec)
Vector iterator.
@ DHCPV6_PD_EVENT_DISABLE
static u8 ip6_prefixes_equal(ip6_address_t *prefix1, ip6_address_t *prefix2, u8 len)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static clib_error_t * dhcp6_pd_client_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t() *input, vlib_cli_command_t *cmd)
static vlib_main_t * vlib_get_main(void)
vnet_interface_output_runtime_t * rt
@ DHCPV6_STATUS_UNSPEC_FAIL
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static vlib_cli_command_t ip6_addresses_show_command
(constructor) VLIB_CLI_COMMAND (ip6_addresses_show_command)
#define clib_warning(format, args...)
@ DHCPV6_MSG_API_ADVERTISE
static uword dhcp6_pd_client_cp_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static f64 vlib_time_now(vlib_main_t *vm)
static void enable_process(void)
int ip6_link_enable(u32 sw_if_index, const ip6_address_t *link_local_addr)
IPv6 Configuration on an interface.
vl_api_interface_index_t sw_if_index
static clib_error_t * cp_ip6_address_add_del_command_function(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_REGISTER_NODE(x,...)
static dhcp6_pd_client_cp_main_t dhcp6_pd_client_cp_main
static_always_inline u8 is_dhcpv6_pd_prefix(prefix_info_t *prefix_info)