48 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 55 #define foreach_ip_api_msg \ 56 _(IP_FIB_DUMP, ip_fib_dump) \ 57 _(IP_FIB_DETAILS, ip_fib_details) \ 58 _(IP6_FIB_DUMP, ip6_fib_dump) \ 59 _(IP6_FIB_DETAILS, ip6_fib_details) \ 60 _(IP_NEIGHBOR_DUMP, ip_neighbor_dump) \ 61 _(IP_NEIGHBOR_DETAILS, ip_neighbor_details) \ 62 _(IP_ADDRESS_DUMP, ip_address_dump) \ 64 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \ 65 _(IP_ADD_DEL_ROUTE, ip_add_del_route) \ 66 _(SET_IP_FLOW_HASH,set_ip_flow_hash) \ 67 _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config) \ 68 _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix) \ 69 _(SW_INTERFACE_IP6_ENABLE_DISABLE, sw_interface_ip6_enable_disable ) \ 70 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \ 71 sw_interface_ip6_set_link_local_address) 86 memset (mp, 0,
sizeof (*mp));
87 mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_DETAILS);
92 memcpy (mp->
ip_address, ip_address, (is_ipv6) ? 16 : 4);
206 path_count =
vec_len (api_rpaths);
210 memset (mp, 0,
sizeof (*mp));
211 mp->_vl_msg_id = ntohs (VL_API_IP_FIB_DETAILS);
218 mp->
count = htonl (path_count);
222 memset (fp, 0,
sizeof (*fp));
280 for (i = 0; i < ARRAY_LEN (fib_table->v4.fib_entry_by_dst_address); i++)
282 hash_foreach(key, lfei, fib_table->v4.fib_entry_by_dst_address[i],
284 vec_add1(lfeis, lfei);
300 fib_table->ft_table_id, &pfx, api_rpaths,
337 path_count =
vec_len (api_rpaths);
341 memset (mp, 0,
sizeof (*mp));
342 mp->_vl_msg_id = ntohs (VL_API_IP6_FIB_DETAILS);
349 mp->
count = htonl (path_count);
353 memset (fp, 0,
sizeof (*fp));
435 &pfx, api_rpaths, mp->
context);
456 api_ip6_fib_table_get_all(q, mp, fib_table);
493 ethernet_arp_ip4_over_ethernet_address_t
a;
520 u32 classify_table_index,
522 u8 is_resolve_attached,
525 u8 next_hop_proto_is_ip4,
526 const ip46_address_t * next_hop,
527 u32 next_hop_sw_if_index,
528 u8 next_hop_fib_index,
539 .frp_sw_if_index = next_hop_sw_if_index,
540 .frp_fib_index = next_hop_fib_index,
541 .frp_weight = next_hop_weight,
542 .frp_label_stack = next_hop_out_label_stack,
553 if (is_resolve_attached)
581 if (is_drop || is_local || is_classify || is_unreach || is_prohibit)
600 else if (is_prohibit)
604 else if (is_classify)
607 ntohl (classify_table_index)))
610 return VNET_API_ERROR_NO_SUCH_TABLE;
615 ntohl (classify_table_index)));
620 return VNET_API_ERROR_NO_SUCH_TABLE;
657 u32 next_hop_sw_if_index,
659 u32 next_hop_table_id,
660 u8 create_missing_tables,
666 if (~0 == *fib_index)
668 if (create_missing_tables)
676 return VNET_API_ERROR_NO_SUCH_FIB;
680 if (~0 != ntohl (next_hop_sw_if_index))
683 ntohl (next_hop_sw_if_index)))
685 return VNET_API_ERROR_NO_MATCHING_INTERFACE;
691 ntohl (next_hop_table_id));
693 if (~0 == *next_hop_fib_index)
695 if (create_missing_tables)
697 *next_hop_fib_index =
699 ntohl (next_hop_table_id));
704 return VNET_API_ERROR_NO_SUCH_FIB;
717 int rv, ii, n_labels;;
725 &fib_index, &next_hop_fib_index);
737 memset (&nh, 0,
sizeof (nh));
743 else if (1 == n_labels)
748 for (ii = 0; ii < n_labels; ii++)
776 int rv, ii, n_labels;;
784 &fib_index, &next_hop_fib_index);
796 memset (&nh, 0,
sizeof (nh));
802 else if (1 == n_labels)
807 for (ii = 0; ii < n_labels; ii++)
855 memset (mp, 0,
sizeof (*mp));
856 mp->_vl_msg_id = ntohs (VL_API_IP_DETAILS);
867 u8 * ip,
u16 prefix_length,
u8 is_ipv6,
u32 context)
872 memset (mp, 0,
sizeof (*mp));
873 mp->_vl_msg_id = ntohs (VL_API_IP_ADDRESS_DETAILS);
902 u32 sw_if_index = ~0;
903 int rv __attribute__ ((unused)) = 0;
949 u32 sw_if_index = ~0;
959 _vec_len (sorted_sis) = 0;
963 vec_add1 (sorted_sis, si[0]);
985 int rv = VNET_API_ERROR_UNIMPLEMENTED;
1000 table_id = ntohl (mp->
vrf_id);
1002 #define _(a,b) if (mp->a) flow_hash_config |= b; 1028 u8 is_no, suppress, managed, other, ll_option, send_unicast, cease,
1031 is_no = mp->
is_no == 1;
1034 other = mp->
other == 1;
1037 cease = mp->
cease == 1;
1043 suppress, managed, other,
1044 ll_option, send_unicast, cease,
1045 default_router, ntohl (mp->
lifetime),
1053 REPLY_MACRO (VL_API_SW_INTERFACE_IP6ND_RA_CONFIG_REPLY);
1063 u8 is_no, use_default, no_advertise, off_link, no_autoconfig, no_onlink;
1067 is_no = mp->
is_no == 1;
1079 off_link, no_autoconfig, no_onlink, is_no);
1082 REPLY_MACRO (VL_API_SW_INTERFACE_IP6ND_RA_PREFIX_REPLY);
1107 rv = VNET_API_ERROR_UNSPECIFIED;
1116 REPLY_MACRO (VL_API_SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY);
1140 rv = VNET_API_ERROR_UNSPECIFIED;
1149 REPLY_MACRO (VL_API_SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS_REPLY);
1153 #define vl_msg_name_crc_list 1154 #include <vnet/ip/ip.api.h> 1155 #undef vl_msg_name_crc_list 1160 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 1161 foreach_vl_msg_name_crc_ip;
1171 vl_msg_api_set_handlers(VL_API_##N, #n, \ 1172 vl_api_##n##_t_handler, \ 1174 vl_api_##n##_t_endian, \ 1175 vl_api_##n##_t_print, \ 1176 sizeof(vl_api_##n##_t), 1);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
IPv6 set link local address on interface request.
fib_protocol_t fp_proto
protocol type
#define VNET_SW_INTERFACE_FLAG_UNNUMBERED
u32 fib_entry_get_fib_index(fib_node_index_t fib_entry_index)
fib_protocol_t frp_proto
The protocol of the address below.
void ip_null_dpo_add_and_lock(dpo_proto_t proto, ip_null_dpo_action_t action, dpo_id_t *dpo)
ip46_address_t frp_addr
The next-hop address.
sll srl srl sll sra u16x4 i
void receive_dpo_add_or_lock(dpo_proto_t proto, u32 sw_if_index, const ip46_address_t *nh_addr, dpo_id_t *dpo)
A representation of a fib path for fib_path_encode to convey the information to the caller...
int vnet_set_ip4_flow_hash(u32 table_id, flow_hash_config_t flow_hash_config)
vl_api_fib_path_t path[count]
A representation of a path as described by a route producer.
static void vl_api_ip_neighbor_add_del_t_handler(vl_api_ip_neighbor_add_del_t *mp, vlib_main_t *vm)
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
static vlib_main_t * vlib_get_main(void)
vnet_interface_main_t interface_main
The table that stores ALL routes learned by the DP.
void fib_entry_get_prefix(fib_node_index_t fib_entry_index, fib_prefix_t *pfx)
fib_node_index_t fib_table_entry_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *paths)
Update an entry to have a new set of paths.
static void vl_api_ip6_fib_details_t_endian(vl_api_ip6_fib_details_t *mp)
int ip6_neighbor_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)
fib_node_index_t fib_table_entry_path_add2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *rpath)
Add n paths to an entry (aka route) in the FIB.
ip6_neighbor_t * ip6_neighbors_entries(u32 sw_if_index)
u32 mpls_label_t
A label value only, i.e.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define IP_NULL_DPO_ACTION_NUM
static void vl_api_ip6_fib_details_t_print(vl_api_ip6_fib_details_t *mp)
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
ip_lookup_main_t lookup_main
IPv6 router advertisement config request.
#define clib_error_report(e)
int add_del_route_check(fib_protocol_t table_proto, u32 table_id, u32 next_hop_sw_if_index, fib_protocol_t next_hop_table_proto, u32 next_hop_table_id, u8 create_missing_tables, u32 *fib_index, u32 *next_hop_fib_index)
IPv6 set link local address on interface response.
static void api_ip6_fib_table_put_entries(clib_bihash_kv_24_8_t *kvp, void *arg)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
vnet_main_t * vnet_get_main(void)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
u32 frp_sw_if_index
The interface.
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a 'special' entry from the FIB.
#define vec_new(T, N)
Create new vector of given type and length (unspecified alignment, no header).
Recursion constraint of via a host prefix.
Aggregrate type for a prefix.
int ip6_interface_enabled(vlib_main_t *vm, u32 sw_if_index)
static void vl_api_ip_dump_t_handler(vl_api_ip_dump_t *mp)
static int ip6_add_del_route_t_handler(vl_api_ip_add_del_route_t *mp)
#define clib_warning(format, args...)
IPv6 interface enable / disable request.
enum fib_route_path_flags_t_ fib_route_path_flags_t
Path flags from the control plane.
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u16 fp_len
The mask length.
int fib_entry_cmp_for_sort(void *i1, void *i2)
int vnet_arp_unset_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, void *a_arg)
Control Plane hook to remove an ARP entry.
vnet_api_error_t api_errno
int vnet_set_ip6_ethernet_neighbor(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *a, u8 *link_layer_address, uword n_bytes_link_layer_address, int is_static)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static void send_ip_address_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u8 *ip, u16 prefix_length, u8 is_ipv6, u32 context)
static void vl_api_ip_fib_details_t_endian(vl_api_ip_fib_details_t *mp)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
index_t classify_dpo_create(dpo_proto_t proto, u32 classify_table_index)
dpo_type_t dpoi_type
the type
ip4_address_t ip4_address
static void vl_api_sw_interface_ip6nd_ra_prefix_t_handler(vl_api_sw_interface_ip6nd_ra_prefix_t *mp)
clib_error_t * set_ip6_link_local_address(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *address, u8 address_length)
void fib_table_entry_path_remove2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_route_path_t *rpath)
Remove n paths to an entry (aka route) in the FIB.
vl_api_fib_path_t path[count]
IPv6 router advertisement prefix config response.
Recursion constraint of via an attahced prefix.
fib_node_index_t * entries
VLIB_API_INIT_FUNCTION(ip_api_hookup)
static void vl_api_sw_interface_ip6_enable_disable_t_handler(vl_api_sw_interface_ip6_enable_disable_t *mp)
static void vl_api_set_ip_flow_hash_t_handler(vl_api_set_ip_flow_hash_t *mp)
int ip6_neighbor_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)
void stats_dsunlock(void)
#define ip46_address_is_ip4(ip46)
void clib_bihash_foreach_key_value_pair(clib_bihash *h, void *callback, void *arg)
Visit active (key,value) pairs in a bi-hash table.
#define BAD_SW_IF_INDEX_LABEL
Set the ip flow hash config for a fib request.
fib_node_index_t fib_table_entry_special_dpo_update(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Update a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the...
void * vl_msg_api_alloc(int nbytes)
u32 ft_table_id
Table ID (hash key) for this FIB.
#define IP6_NEIGHBOR_FLAG_STATIC
#define MPLS_LABEL_INVALID
#define vec_free(V)
Free vector's memory (no header).
void copy_fib_next_hop(fib_route_path_encode_t *api_rpath, void *fp_arg)
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
u32 frp_weight
[un]equal cost path weight
IPv6 interface enable / disable response.
#define clib_memcpy(a, b, c)
static void send_ip_fib_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u32 table_id, fib_prefix_t *pfx, fib_route_path_encode_t *api_rpaths, u32 context)
#define ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC
u32 fib_node_index_t
A typedef of a node index.
Reply for IP Neighbor add / delete request.
static void set_ip6_flow_hash(vl_api_set_ip_flow_hash_t *mp)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
clib_error_t * enable_ip6_interface(vlib_main_t *vm, u32 sw_if_index)
struct _vnet_classify_main vnet_classify_main_t
#define foreach_flow_hash_bit
int vnet_arp_set_ip4_over_ethernet(vnet_main_t *vnm, u32 sw_if_index, void *a_arg, int is_static)
IP neighbor add / del request.
IPv6 router advertisement config response.
ip6_address_t ip6_address
ip_lookup_main_t lookup_main
static void vl_api_ip_neighbor_details_t_handler(vl_api_ip_neighbor_details_t *mp)
static int ip4_add_del_route_t_handler(vl_api_ip_add_del_route_t *mp)
Reply for add / del route request.
IPv6 router advertisement prefix config request.
static void set_ip4_flow_hash(vl_api_set_ip_flow_hash_t *mp)
fib_route_path_flags_t frp_flags
flags on the path
static void vl_api_ip_fib_details_t_handler(vl_api_ip_fib_details_t *mp)
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
vnet_classify_main_t vnet_classify_main
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
From the control plane API.
static void send_ip6_fib_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u32 table_id, fib_prefix_t *pfx, fib_route_path_encode_t *api_rpaths, u32 context)
void stats_dslock_with_hint(int hint, int tag)
int vnet_unset_ip6_ethernet_neighbor(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *a, u8 *link_layer_address, uword n_bytes_link_layer_address)
static clib_error_t * ip_api_hookup(vlib_main_t *vm)
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
static void vl_api_ip_fib_dump_t_handler(vl_api_ip_fib_dump_t *mp)
ip6_fib_table_instance_t ip6_table[IP6_FIB_NUM_TABLES]
The two FIB tables; fwding and non-fwding.
IP neighboors dump response.
void fib_entry_encode(fib_node_index_t fib_entry_index, fib_route_path_encode_t **api_rpaths)
static void vl_api_ip6_fib_details_t_handler(vl_api_ip6_fib_details_t *mp)
mpls_label_t frp_local_label
The MPLS local Label to reursively resolve through.
static void setup_message_id_table(api_main_t *am)
static void vl_api_ip_fib_details_t_print(vl_api_ip_fib_details_t *mp)
index_t dpoi_index
the index of objects of that type
static void send_ip_details(vpe_api_main_t *am, unix_shared_memory_queue_t *q, u32 sw_if_index, u32 context)
#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.
vnet_sw_interface_t * sw_interfaces
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
u32 next_hop_out_label_stack[next_hop_n_out_labels]
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
static void vl_api_sw_interface_ip6nd_ra_config_t_handler(vl_api_sw_interface_ip6nd_ra_config_t *mp)
int add_del_route_t_handler(u8 is_multipath, u8 is_add, u8 is_drop, u8 is_unreach, u8 is_prohibit, u8 is_local, u8 is_classify, u32 classify_table_index, u8 is_resolve_host, u8 is_resolve_attached, u32 fib_index, const fib_prefix_t *prefix, u8 next_hop_proto_is_ip4, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u8 next_hop_fib_index, u32 next_hop_weight, mpls_label_t next_hop_via_label, mpls_label_t *next_hop_out_label_stack)
ip4_main_t ip4_main
Global ip4 main structure.
struct fib_table_t_ * fibs
Vector of FIBs.
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
#define vec_foreach(var, vec)
Vector iterator.
static void vl_api_sw_interface_ip6_set_link_local_address_t_handler(vl_api_sw_interface_ip6_set_link_local_address_t *mp)
static void vl_api_ip_address_dump_t_handler(vl_api_ip_address_dump_t *mp)
ethernet_arp_ip4_entry_t * ip4_neighbor_entries(u32 sw_if_index)
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
static void send_ip_neighbor_details(u8 is_ipv6, u8 is_static, u8 *mac_address, u8 *ip_address, unix_shared_memory_queue_t *q, u32 context)
static void api_ip6_fib_table_get_all(unix_shared_memory_queue_t *q, vl_api_ip6_fib_dump_t *mp, fib_table_t *fib_table)
struct apt_ip6_fib_show_ctx_t_ api_ip6_fib_show_ctx_t
clib_error_t * disable_ip6_interface(vlib_main_t *vm, u32 sw_if_index)
vpe_api_main_t vpe_api_main
void vl_api_ip_add_del_route_t_handler(vl_api_ip_add_del_route_t *mp)
struct fib_table_t_ * fibs
#define foreach_ip_api_msg
const ip46_address_t zero_addr
static void vl_api_ip6_fib_dump_t_handler(vl_api_ip6_fib_dump_t *mp)
#define VALIDATE_SW_IF_INDEX(mp)
A protocol Independent FIB table.
Set the ip flow hash config for a fib response.
struct _unix_shared_memory_queue unix_shared_memory_queue_t
static void vl_api_ip_neighbor_dump_t_handler(vl_api_ip_neighbor_dump_t *mp)
static uword pool_elts(void *v)
Number of active elements in a pool.