|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
39 if (ni == (
uword) ~ 0)
60 cm->publisher_et = event_type;
109 clib_warning (
"Could not find source address to send DHCPv6 packet");
126 b->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
134 ip->ip_version_traffic_class_and_flow_label =
135 clib_host_to_net_u32 (0x6 << 28);
136 ip->payload_length = 0;
137 ip->protocol = IP_PROTOCOL_UDP;
149 void *d = (
void *) dhcp->
data;
150 dhcpv6_option_t *duid;
151 dhcpv6_elapsed_t *elapsed;
152 dhcpv6_ia_header_t *ia_hdr;
153 dhcpv6_ia_opt_pd_t *opt_pd;
158 duid = (dhcpv6_option_t *) d;
159 duid->option = clib_host_to_net_u16 (DHCPV6_OPTION_CLIENTID);
169 duid = (dhcpv6_option_t *) d;
170 duid->option = clib_host_to_net_u16 (DHCPV6_OPTION_SERVERID);
171 duid->length = clib_host_to_net_u16 (se->
len);
173 d +=
sizeof (*duid) + se->
len;
176 elapsed = (dhcpv6_elapsed_t *) d;
177 elapsed->opt.option = clib_host_to_net_u16 (DHCPV6_OPTION_ELAPSED_TIME);
178 elapsed->opt.length =
179 clib_host_to_net_u16 (
sizeof (*elapsed) -
sizeof (elapsed->opt));
180 elapsed->elapsed_10ms = 0;
182 (
char *) &elapsed->elapsed_10ms -
184 d +=
sizeof (*elapsed);
186 ia_hdr = (dhcpv6_ia_header_t *) d;
187 ia_hdr->opt.option = clib_host_to_net_u16 (DHCPV6_OPTION_IA_PD);
189 ia_hdr->t1 = clib_host_to_net_u32 (client_state->
params.
T1);
190 ia_hdr->t2 = clib_host_to_net_u32 (client_state->
params.
T2);
191 d +=
sizeof (*ia_hdr);
196 clib_host_to_net_u16 (
sizeof (*ia_hdr) +
197 n_prefixes *
sizeof (*opt_pd) -
198 sizeof (ia_hdr->opt));
200 for (
i = 0;
i < n_prefixes;
i++)
204 opt_pd = (dhcpv6_ia_opt_pd_t *) d;
205 opt_pd->opt.option = clib_host_to_net_u16 (DHCPV6_OPTION_IAPREFIX);
207 clib_host_to_net_u16 (
sizeof (*opt_pd) -
sizeof (opt_pd->opt));
208 opt_pd->addr = pref->
prefix;
210 opt_pd->valid = clib_host_to_net_u32 (pref->
valid_lt);
211 opt_pd->preferred = clib_host_to_net_u32 (pref->
preferred_lt);
212 d +=
sizeof (*opt_pd);
220 dhcp_opt_len = ((
u8 *) d) - dhcp->
data;
222 clib_host_to_net_u16 (
sizeof (*udp) +
sizeof (*dhcp) + dhcp_opt_len);
225 sizeof (*ip) +
sizeof (*udp) +
sizeof (*dhcp) + dhcp_opt_len;
235 f64 current_time,
f64 * due_time)
245 int bogus_length = 0;
254 params = &client_state->
params;
256 if (client_state->
due_time > current_time)
262 p0 = client_state->
buffer;
277 clib_host_to_net_u16 ((
u16)
290 if (params->
mrc != 0 && --client_state->
n_left == 0)
319 uword *event_data = 0;
320 f64 sleep_time = 1e9;
335 due_time = current_time + 1e9;
336 for (
i = 0;
i <
vec_len (
cm->client_state_by_sw_if_index);
i++)
338 client_state = &
cm->client_state_by_sw_if_index[
i];
342 (
vm, client_state, current_time, &dt) && (dt < due_time))
347 while (due_time < current_time);
349 sleep_time = due_time - current_time;
359 .name =
"send-dhcp6-pd-client-message-process",
377 client_state = &
cm->client_state_by_sw_if_index[
sw_if_index];
390 client_state->
params = *params;
414 cm->publisher_node = ~0;
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
static void stop_sending_client_message(vlib_main_t *vm, dhcp6_pd_client_state_t *client_state)
void dhcp6_pd_send_client_message(vlib_main_t *vm, u32 sw_if_index, u8 stop, dhcp6_pd_send_client_message_params_t *params)
static vlib_node_registration_t send_dhcp6_pd_client_message_process_node
(constructor) VLIB_REGISTER_NODE (send_dhcp6_pd_client_message_process_node)
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
static vlib_buffer_t * vlib_buffer_copy(vlib_main_t *vm, vlib_buffer_t *b)
#define clib_memcpy(d, s, n)
nat44_ei_hairpin_src_next_t next_index
dhcp6_pd_send_client_message_params_prefix_t * prefixes
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
adj_index_t adj_mcast_add_or_lock(fib_protocol_t proto, vnet_link_t link_type, u32 sw_if_index)
Mcast Adjacency.
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
#define DHCPV6_CLIENT_PORT
vlib_combined_counter_main_t * ccm
vnet_hw_if_output_node_runtime_t * r
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static clib_error_t * dhcp6_pd_client_init(vlib_main_t *vm)
static u8 check_pd_send_client_message(vlib_main_t *vm, dhcp6_pd_client_state_t *client_state, f64 current_time, f64 *due_time)
static u32 random_u32(u32 *seed)
32-bit random number generator
dhcp6_pd_client_public_main_t dhcp6_pd_client_public_main
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,...
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword send_dhcp6_pd_client_message_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f0)
#define CLIENT_DUID_LENGTH
static __clib_warn_unused_result u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
#define vec_dup(V)
Return copy of vector (no header, no alignment)
const ip6_address_t * ip6_get_link_local_address(u32 sw_if_index)
vnet_main_t * vnet_get_main(void)
vl_api_mac_address_t src_addr
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
vlib_node_registration_t ip6_rewrite_mcast_node
(constructor) VLIB_REGISTER_NODE (ip6_rewrite_mcast_node)
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
sll srl srl sll sra u16x4 i
static void * vlib_process_signal_event_data(vlib_main_t *vm, uword node_index, uword type_opaque, uword n_data_elts, uword n_data_elt_bytes)
vnet_feature_config_main_t * cm
void dhcp6_pd_set_publisher_node(uword node_index, uword event_type)
struct _vlib_node_registration vlib_node_registration_t
u16 current_length
Nbytes between current data and the end of this buffer.
#define vec_free(V)
Free vector's memory (no header).
u8 keep_sending_client_message
static const ip6_address_t all_dhcp6_relay_agents_and_servers
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...
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
#define VLIB_INIT_FUNCTION(x)
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
dhcp6_pd_send_client_message_params_t params
dhcpv6_duid_ll_string_t client_duid
#define DHCPV6_SERVER_PORT
int dhcp6_pd_publish_report(prefix_report_t *r)
static vlib_main_t * vlib_get_main(void)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vnet_interface_output_runtime_t * rt
#define DHCPV6_CLIENT_IAID
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static_always_inline f64 random_f64_from_to(f64 from, f64 to)
#define clib_warning(format, args...)
dhcp6_pd_client_main_t dhcp6_pd_client_main
static f64 vlib_time_now(vlib_main_t *vm)
dhcp6_client_common_main_t dhcp6_client_common_main
static u64 clib_cpu_time_now(void)
static vlib_buffer_t * create_buffer_for_client_message(vlib_main_t *vm, u32 sw_if_index, dhcp6_pd_client_state_t *client_state, u32 type)
vl_api_interface_index_t sw_if_index
vl_api_fib_path_type_t type
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
static void signal_report(prefix_report_t *r)