28 #include <vpp/app/version.h> 35 #include <vnet/ip6-nd/ip6_nd.api_enum.h> 36 #include <vnet/ip6-nd/ip6_nd.api_types.h> 42 #define REPLY_MSG_ID_BASE ip6_nd_base_msg_id 55 mp->_vl_msg_id =
ntohs (VL_API_IP6ND_PROXY_DETAILS);
101 fib_table_walk(fib_table->ft_index,
103 api_ip6nd_proxy_fib_table_walk,
126 vl_api_ip6nd_proxy_add_del_reply_t *rmp;
146 vl_api_sw_interface_ip6nd_ra_config_reply_t *rmp;
149 u8 is_no, suppress, managed, other, ll_option, send_unicast, cease,
152 is_no = mp->
is_no == 1;
155 other = mp->
other == 1;
158 cease = mp->
cease == 1;
164 suppress, managed, other,
165 ll_option, send_unicast, cease,
166 default_router, ntohl (mp->
lifetime),
174 REPLY_MACRO (VL_API_SW_INTERFACE_IP6ND_RA_CONFIG_REPLY);
182 vl_api_sw_interface_ip6nd_ra_prefix_reply_t *rmp;
185 u8 is_no, use_default, no_advertise, off_link, no_autoconfig, no_onlink;
190 is_no = mp->
is_no == 1;
202 off_link, no_autoconfig, no_onlink, is_no);
205 REPLY_MACRO (VL_API_SW_INTERFACE_IP6ND_RA_PREFIX_REPLY);
212 vl_api_ip6nd_send_router_solicitation_reply_t *rmp;
220 REPLY_MACRO (VL_API_IP6ND_SEND_ROUTER_SOLICITATION_REPLY);
225 params.
irt = ntohl (mp->
irt);
226 params.
mrt = ntohl (mp->
mrt);
227 params.
mrc = ntohl (mp->
mrc);
228 params.
mrd = ntohl (mp->
mrd);
242 vl_api_registration_t *vl_reg;
244 vl_reg = vl_api_client_index_to_registration (rp->client_index);
246 if (vl_reg && vl_api_can_send_msg (vl_reg))
248 vl_api_ip6_ra_prefix_info_t *prefix;
249 vl_api_ip6_ra_event_t *event;
251 u32 event_size = (sizeof (vl_api_ip6_ra_event_t) +
252 vec_len (rap->prefixes) *
253 sizeof (vl_api_ip6_ra_prefix_info_t));
254 event = vl_msg_api_alloc_zero (event_size);
256 event->_vl_msg_id = htons (VL_API_IP6_RA_EVENT + REPLY_MSG_ID_BASE);
257 event->client_index = rp->client_index;
258 event->pid = rp->client_pid;
259 event->sw_if_index = clib_host_to_net_u32 (rap->sw_if_index);
261 ip6_address_encode (&rap->router_address,
264 event->current_hop_limit = rap->current_hop_limit;
265 event->flags = rap->flags;
266 event->router_lifetime_in_sec =
267 clib_host_to_net_u16 (rap->router_lifetime_in_sec);
268 event->neighbor_reachable_time_in_msec =
269 clib_host_to_net_u32 (rap->neighbor_reachable_time_in_msec);
270 event->time_in_msec_between_retransmitted_neighbor_solicitations =
271 clib_host_to_net_u32 (rap->time_in_msec_between_retransmitted_neighbor_solicitations);
272 event->n_prefixes = clib_host_to_net_u32 (vec_len (rap->prefixes));
274 prefix = event->prefixes;
277 for (j = 0; j < vec_len (rap->prefixes); j++)
279 ra_report_prefix_info_t *info = &rap->prefixes[j];
280 ip_prefix_encode(&info->prefix, &prefix->prefix);
281 prefix->flags = info->flags;
282 prefix->valid_time = clib_host_to_net_u32 (info->valid_time);
283 prefix->preferred_time =
284 clib_host_to_net_u32 (info->preferred_time);
288 vl_api_send_msg (vl_reg, (u8 *) event);
298 vl_api_want_ip6_ra_events_reply_t *rmp;
299 int rv = 0, had_reg, have_reg;
301 had_reg =
hash_elts (am->ip6_ra_events_registration_hash);
309 rv = VNET_API_ERROR_INVALID_REGISTRATION;
315 pool_put (am->ip6_ra_events_registrations, rp);
323 rv = VNET_API_ERROR_INVALID_REGISTRATION;
326 pool_get (am->ip6_ra_events_registrations, rp);
330 rp - am->ip6_ra_events_registrations);
333 have_reg =
hash_elts (am->ip6_ra_events_registration_hash);
335 if (!had_reg && have_reg)
337 else if (had_reg && !have_reg)
350 p =
hash_get (am->ip6_ra_events_registration_hash, client_index);
355 pool_put (am->ip6_ra_events_registrations, rp);
356 hash_unset (am->ip6_ra_events_registration_hash, client_index);
363 #include <vnet/ip6-nd/ip6_nd.api.c> void ip6_ra_report_register(ip6_ra_report_notify_t fn)
static void send_ip6nd_proxy_details(vl_api_registration_t *reg, u32 context, const ip46_address_t *addr, u32 sw_if_index)
Continue on to the next entry.
#define hash_set(h, key, value)
Register for ip6 router advertisement events.
#define hash_unset(h, key)
void ip_prefix_decode(const vl_api_prefix_t *in, fib_prefix_t *out)
static void vl_api_sw_interface_ip6nd_ra_prefix_t_handler(vl_api_sw_interface_ip6nd_ra_prefix_t *mp)
static void vl_api_ip6nd_send_router_solicitation_t_handler(vl_api_ip6nd_send_router_solicitation_t *mp)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static clib_error_t * ip6_nd_api_init(vlib_main_t *vm)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
void ip6_address_decode(const vl_api_ip6_address_t in, ip6_address_t *out)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
void icmp6_send_router_solicitation(vlib_main_t *vm, u32 sw_if_index, u8 stop, const icmp6_send_router_solicitation_params_t *params)
const fib_prefix_t * fib_entry_get_prefix(fib_node_index_t fib_entry_index)
IPv6 router advertisement config request.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
void * vl_msg_api_alloc(int nbytes)
int ip6_ra_config(vlib_main_t *vm, u32 sw_if_index, u8 suppress, u8 managed, u8 other, u8 ll_option, u8 send_unicast, u8 cease, u8 use_lifetime, u32 lifetime, u32 initial_count, u32 initial_interval, u32 max_interval, u32 min_interval, u8 is_no)
static void vl_api_sw_interface_ip6nd_ra_config_t_handler(vl_api_sw_interface_ip6nd_ra_config_t *mp)
int ip6_nd_proxy_add(u32 sw_if_index, const ip6_address_t *addr)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
Start / stop sending router solicitation.
Aggregate type for a prefix.
u16 fp_len
The mask length.
int fib_entry_cmp_for_sort(void *i1, void *i2)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vl_api_want_ip6_ra_events_t_handler(vl_api_want_ip6_ra_events_t *mp)
void ip6_ra_report_unregister(ip6_ra_report_notify_t fn)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
#define pool_put(P, E)
Free an object E in pool P.
static u32 ip6_nd_base_msg_id
Base message ID fot the plugin.
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
An API client registration, only in vpp/vlib.
#define BAD_SW_IF_INDEX_LABEL
int fib_entry_is_sourced(fib_node_index_t fib_entry_index, fib_source_t source)
static void vl_api_ip6nd_proxy_add_del_t_handler(vl_api_ip6nd_proxy_add_del_t *mp)
enum fib_table_walk_rc_t_ fib_table_walk_rc_t
return code controlling how a table walk proceeds
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
u32 fib_node_index_t
A typedef of a node index.
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static fib_table_walk_rc_t api_ip6nd_proxy_fib_table_walk(fib_node_index_t fei, void *arg)
vl_api_interface_index_t sw_if_index
static void vl_api_ip6nd_proxy_dump_t_handler(vl_api_ip6nd_proxy_dump_t *mp)
static uword hash_elts(void *v)
IPv6 router advertisement prefix config request.
IPv6 ND proxy details returned after request.
IPv6 ND proxy dump request.
void ip6_address_encode(const ip6_address_t *in, vl_api_ip6_address_t out)
vl_api_interface_index_t sw_if_index
static vlib_main_t * vlib_get_main(void)
int ip6_nd_proxy_del(u32 sw_if_index, const ip6_address_t *addr)
vl_api_interface_index_t sw_if_index
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
struct api_ip6nd_proxy_fib_table_walk_ctx_t_ api_ip6nd_proxy_fib_table_walk_ctx_t
VL_MSG_API_REAPER_FUNCTION(want_ip6_ra_events_reaper)
vl_api_interface_index_t sw_if_index
vl_api_interface_index_t sw_if_index
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)
#define vec_foreach(var, vec)
Vector iterator.
static void setup_message_id_table(snat_main_t *sm, api_main_t *am)
vpe_api_main_t vpe_api_main
static void ip6_ra_handle_report(const ip6_ra_report_t *rap)
struct fib_table_t_ * fibs
static clib_error_t * want_ip6_ra_events_reaper(u32 client_index)
vl_api_interface_index_t sw_if_index
#define VALIDATE_SW_IF_INDEX(mp)
A protocol Independent FIB table.