{
u32 s[2];
} *ed;
- ed = ELOG_DATA (&vm->elog_main, e);
- ed->s[0] = elog_string (&vm->elog_main, log_level_strings[priority]);
- ed->s[1] = elog_string (&vm->elog_main, (char *) what);
+ ed = ELOG_DATA (vlib_get_elog_main (), e);
+ ed->s[0] =
+ elog_string (vlib_get_elog_main (), log_level_strings[priority]);
+ ed->s[1] = elog_string (vlib_get_elog_main (), (char *) what);
}
va_end (va);
return;
ICMP6_ROUTER_SOLICITATION_N_NEXT,
} icmp6_router_solicitation_or_advertisement_next_t;
+/*
+ * Note: Both periodic RAs and solicited RS come through here.
+ */
static_always_inline uword
icmp6_router_solicitation (vlib_main_t * vm,
vlib_node_runtime_t * node, vlib_frame_t * frame)
if (PREDICT_TRUE (error0 == ICMP6_ERROR_NONE && o0 != 0 &&
!is_unspecified && !is_link_local))
{
+ /* *INDENT-OFF* */
ip_neighbor_learn_t learn = {
- .type = IP46_TYPE_IP6,
.sw_if_index = sw_if_index0,
- .ip.ip6 = ip0->src_address,
+ .ip = {
+ .ip.ip6 = ip0->src_address,
+ .version = AF_IP6,
+ },
};
+ /* *INDENT-ON* */
memcpy (&learn.mac, o0->ethernet_address, sizeof (learn.mac));
ip_neighbor_learn_dp (&learn);
}
error0 = ((!radv_info) ?
ICMP6_ERROR_ROUTER_SOLICITATION_RADV_NOT_CONFIG :
error0);
-
+ error0 = radv_info->send_radv == 0 ?
+ ICMP6_ERROR_ROUTER_SOLICITATION_RADV_NOT_CONFIG :
+ error0;
if (error0 == ICMP6_ERROR_NONE)
{
f64 now = vlib_time_now (vm);
/* copy ll address */
clib_memcpy (&h.ethernet_address[0],
- eth_if0->address, 6);
+ ð_if0->address, 6);
if (vlib_buffer_add_data
(vm, &bi0, (void *) &h,
ip6_radv_prefix_t *pr_info;
/* *INDENT-OFF* */
- pool_foreach (pr_info, radv_info->adv_prefixes_pool,
- ({
+ pool_foreach (pr_info, radv_info->adv_prefixes_pool)
+ {
if(pr_info->enabled &&
(!pr_info->decrement_lifetime_flag
|| (pr_info->pref_lifetime_expires >0)))
}
}
- }));
+ }
/* *INDENT-ON* */
/* add additional options before here */
eth0 = vlib_buffer_get_current (p0);
clib_memcpy (eth0->dst_address, eth0->src_address,
6);
- clib_memcpy (eth0->src_address, eth_if0->address,
+ clib_memcpy (eth0->src_address, ð_if0->address,
6);
next0 =
is_dropped ? next0 :
/* look for matching prefix - if we our advertising it, it better be consistant */
/* *INDENT-OFF* */
- pool_foreach (pr_info, radv_info->adv_prefixes_pool,
- ({
+ pool_foreach (pr_info, radv_info->adv_prefixes_pool)
+ {
ip6_address_t mask;
ip6_address_mask_from_width(&mask, pr_info->prefix_len);
}
}
break;
- }));
+ }
/* *INDENT-ON* */
break;
}
}
p0 = vlib_get_buffer (vm, bi0);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (p0);
p0->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
vnet_buffer (p0)->sw_if_index[VLIB_RX] = sw_if_index;
next_index = ip6_rewrite_mcast_node.index;
c0 = vlib_buffer_copy (vm, p0);
+ if (c0 == NULL)
+ return radv_info->keep_sending_rs;
+
ci0 = vlib_get_buffer_index (vm, c0);
f = vlib_get_frame_to_node (vm, next_index);
{
due_time = current_time + 1e9;
/* *INDENT-OFF* */
- pool_foreach (radv_info, ip6_ra_pool,
- ({
+ pool_foreach (radv_info, ip6_ra_pool)
+ {
if (check_send_rs (vm, radv_info, current_time, &dt)
&& (dt < due_time))
due_time = dt;
- }));
+ }
/* *INDENT-ON* */
current_time = vlib_time_now (vm);
}
vec_reset_length (radv_indices);
/* *INDENT-OFF* */
- pool_foreach (radv_info, ip6_ra_pool,
- ({
+ pool_foreach (radv_info, ip6_ra_pool)
+ {
vec_add1 (radv_indices, radv_info - ip6_ra_pool);
- }));
+ }
/* *INDENT-ON* */
/*
continue;
/* *INDENT-OFF* */
- pool_foreach (this_prefix, radv_info->adv_prefixes_pool,
- ({
+ pool_foreach (this_prefix, radv_info->adv_prefixes_pool)
+ {
if (this_prefix->prefix_len == prefix_len
&& ip6_address_is_equal_masked (&this_prefix->prefix, address,
&mask))
if (rv != 0)
clib_warning ("ip6_neighbor_ra_prefix returned %d", rv);
}
- }));
+ }
/* *INDENT-ON*/
}
}
/* Interface ip6 radv info list */
/* *INDENT-OFF* */
- pool_foreach (radv_info, ip6_ra_pool,
- ({
+ pool_foreach (radv_info, ip6_ra_pool)
+ {
if( !vnet_sw_interface_is_admin_up (vnm, radv_info->sw_if_index))
{
radv_info->initial_adverts_sent = radv_info->initial_adverts_count-1;
f = 0;
}
}
- }));
+ }
/* *INDENT-ON* */
if (f)
}
static void
-ip6_ra_handle_report (const ip6_ra_report_t * rap)
+ip6_ra_handle_report (ip6_ra_report_t * rap)
{
u32 ii;
vec_foreach_index (ii, ip6_ra_listeners) ip6_ra_listeners[ii] (rap);
+ vec_free (rap->prefixes);
+ clib_mem_free (rap);
}
static uword
ip6_ra_event_process (vlib_main_t * vm,
vlib_node_runtime_t * node, vlib_frame_t * frame)
{
- ip6_ra_report_t *r, *rs;
+ ip6_ra_report_t *r;
uword event_type;
+ uword *event_data = 0;
+ int i;
/* init code here */
{
vlib_process_wait_for_event_or_clock (vm, 1. /* seconds */ );
- rs = vlib_process_get_event_data (vm, &event_type);
+ event_type = vlib_process_get_events (vm, &event_data);
- if (NULL == rs)
+ if (event_type == ~0)
{
/* No events found: timer expired. */
/* process interface list and send RAs as appropriate, update timer info */
}
else
{
- vec_foreach (r, rs) ip6_ra_handle_report (r);
- vec_reset_length (rs);
+ for (i = 0; i < vec_len (event_data); i++)
+ {
+ r = (void *) (event_data[i]);
+ ip6_ra_handle_report (r);
+ }
+ vec_reset_length (event_data);
}
}
return frame->n_vectors;
}
+/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ip6_ra_process_node) =
{
-.function = ip6_ra_event_process,.name = "ip6-ra-process",.type =
- VLIB_NODE_TYPE_PROCESS,};
+ .function = ip6_ra_event_process,
+ .name = "ip6-ra-process",
+ .type = VLIB_NODE_TYPE_PROCESS,
+};
+/* *INDENT-ON* */
static void
ip6_ra_signal_report (ip6_ra_report_t * r)
if (!vec_len (ip6_ra_listeners))
return;
- q = vlib_process_signal_event_data (vm,
- ip6_ra_process_node.index,
- 0, 1, sizeof *q);
+ q = clib_mem_alloc (sizeof (*q));
*q = *r;
+
+ vlib_process_signal_event (vm, ip6_ra_process_node.index, 0, (uword) q);
}
static int
indent += 2;
/* *INDENT-OFF* */
- pool_foreach (p, radv_info->adv_prefixes_pool,
- ({
+ pool_foreach (p, radv_info->adv_prefixes_pool)
+ {
s = format (s, "%Uprefix %U, length %d\n",
format_white_space, indent+2,
format_ip6_address, &p->prefix, p->prefix_len);
- }));
+ }
/* *INDENT-ON* */
s = format (s, "%UMTU is %d\n",