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);
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);
248 vl_api_ip6_ra_prefix_info_t *
prefix;
253 sizeof (vl_api_ip6_ra_prefix_info_t));
259 event->sw_if_index = clib_host_to_net_u32 (rap->
sw_if_index);
265 event->flags = rap->
flags;
266 event->router_lifetime_in_sec =
268 event->neighbor_reachable_time_in_msec =
270 event->time_in_msec_between_retransmitted_neighbor_solicitations =
274 prefix =
event->prefixes;
281 prefix->flags = info->
flags;
282 prefix->valid_time = clib_host_to_net_u32 (info->
valid_time);
283 prefix->preferred_time =
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)
#define REPLY_MSG_ID_BASE
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)
#define pool_foreach(VAR, POOL)
Iterate through pool.
u16 router_lifetime_in_sec
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
u32 time_in_msec_between_retransmitted_neighbor_solicitations
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_zero(int nbytes)
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 int vl_api_can_send_msg(vl_api_registration_t *rp)
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 VLIB_INIT_FUNCTION(x)
Start / stop sending router solicitation.
Aggregate type for a prefix.
u16 fp_len
The mask length.
ip6_address_t router_address
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.
vl_api_ip6_address_t router_addr
#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.
static void setup_message_id_table(api_main_t *am)
#define BAD_SW_IF_INDEX_LABEL
fib_node_index_t ft_index
Index into FIB vector.
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)
u32 neighbor_reachable_time_in_msec
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)
ra_report_prefix_info_t * prefixes
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)
Tell client about a router advertisement event.
void fib_table_walk(u32 fib_index, fib_protocol_t proto, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
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)
void ip_prefix_encode(const fib_prefix_t *in, vl_api_prefix_t *out)
int ip6_nd_proxy_del(u32 sw_if_index, const ip6_address_t *addr)
vl_api_interface_index_t sw_if_index
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#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.
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.