23 #include <sys/types.h> 26 #include <netinet/in.h> 71 #undef __included_bihash_template_h__ 97 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 102 #define foreach_vpe_api_msg \ 103 _(WANT_OAM_EVENTS, want_oam_events) \ 104 _(OAM_ADD_DEL, oam_add_del) \ 105 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \ 106 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \ 107 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \ 108 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \ 109 _(CREATE_VLAN_SUBIF, create_vlan_subif) \ 110 _(CREATE_SUBIF, create_subif) \ 111 _(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \ 112 _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \ 113 _(VNET_GET_SUMMARY_STATS, vnet_get_summary_stats) \ 114 _(RESET_FIB, reset_fib) \ 115 _(CREATE_LOOPBACK, create_loopback) \ 116 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \ 117 _(CONTROL_PING, control_ping) \ 119 _(CLI_INBAND, cli_inband) \ 120 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit) \ 121 _(L2_PATCH_ADD_DEL, l2_patch_add_del) \ 122 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \ 123 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \ 124 _(GET_NODE_INDEX, get_node_index) \ 125 _(ADD_NODE_NEXT, add_node_next) \ 126 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \ 127 _(SHOW_VERSION, show_version) \ 128 _(INTERFACE_NAME_RENUMBER, interface_name_renumber) \ 129 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \ 130 _(WANT_IP6_ND_EVENTS, want_ip6_nd_events) \ 131 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \ 132 _(DELETE_LOOPBACK, delete_loopback) \ 133 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \ 134 _(GET_NODE_GRAPH, get_node_graph) \ 135 _(IOAM_ENABLE, ioam_enable) \ 136 _(IOAM_DISABLE, ioam_disable) \ 137 _(GET_NEXT_INDEX, get_next_index) \ 138 _(PG_CREATE_INTERFACE, pg_create_interface) \ 139 _(PG_CAPTURE, pg_capture) \ 140 _(PG_ENABLE_DISABLE, pg_enable_disable) \ 141 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \ 142 ip_source_and_port_range_check_add_del) \ 143 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \ 144 ip_source_and_port_range_check_interface_add_del) \ 145 _(DELETE_SUBIF, delete_subif) \ 147 _(FEATURE_ENABLE_DISABLE, feature_enable_disable) 150 #define QUOTE(x) QUOTE_(x) 175 p = hash_get (vam->a##_registration_hash, client_index); \ 177 rp = pool_elt_at_index (vam->a##_registrations, p[0]); \ 178 pool_put (vam->a##_registrations, rp); \ 179 hash_unset (vam->a##_registration_hash, client_index); \ 190 #define RESOLUTION_EVENT 1 191 #define RESOLUTION_PENDING_EVENT 2 192 #define IP4_ARP_EVENT 3 193 #define IP6_ND_EVENT 4 226 if (q->cursize < q->maxsize)
234 static f64 last_time;
241 clib_warning (
"arp event for %U to pid %d: queue stuffed!",
275 if (q->cursize < q->maxsize)
283 static f64 last_time;
290 clib_warning (
"ip6 nd event for %U to pid %d: queue stuffed!",
302 uword *event_data = 0;
323 for (i = 0; i <
vec_len (event_data); i++)
328 for (i = 0; i <
vec_len (event_data); i++)
345 .name =
"vpe-route-resolver-process",
352 vl_api_sw_interface_set_vpath_reply_t *rmp;
360 sw_if_index, mp->
enable, 0, 0);
362 sw_if_index, mp->
enable, 0, 0);
364 sw_if_index, mp->
enable, 0, 0);
366 sw_if_index, mp->
enable, 0, 0);
377 vl_api_sw_interface_set_l2_xconnect_reply_t *rmp;
390 rx_sw_if_index, 0, 0, 0, tx_sw_if_index);
400 REPLY_MACRO (VL_API_SW_INTERFACE_SET_L2_XCONNECT_REPLY);
408 vl_api_sw_interface_set_l2_bridge_reply_t *rmp;
425 rx_sw_if_index, bd_index, bvi, shg, 0);
435 REPLY_MACRO (VL_API_SW_INTERFACE_SET_L2_BRIDGE_REPLY);
442 vl_api_bd_ip_mac_add_del_reply_t *rmp;
450 rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
457 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
464 rv = VNET_API_ERROR_UNSPECIFIED;
475 u32 sw_if_index = (
u32) ~ 0;
492 rv = VNET_API_ERROR_BOND_SLAVE_NOT_ALLOWED;
497 if (
id == 0 ||
id > 4095)
499 rv = VNET_API_ERROR_INVALID_VLAN;
508 rv = VNET_API_ERROR_VLAN_ALREADY_EXISTS;
512 memset (&
template, 0,
sizeof (
template));
515 template.sub.id = id;
516 template.sub.eth.raw_flags = 0;
517 template.sub.eth.flags.one_tag = 1;
518 template.sub.eth.outer_vlan_id = id;
519 template.sub.eth.flags.exact_match = 1;
525 rv = VNET_API_ERROR_INVALID_REGISTRATION;
530 *kp = sup_and_sub_key;
543 rmp->_vl_msg_id = htons (VL_API_CREATE_VLAN_SUBIF_REPLY);
555 u32 sw_if_index = ~0;
573 rv = VNET_API_ERROR_BOND_SLAVE_NOT_ALLOWED;
578 sub_id = ntohl (mp->
sub_id);
580 sup_and_sub_key = ((
u64) (sw_if_index) << 32) | (
u64) sub_id;
586 clib_warning (
"sup sw_if_index %d, sub id %d already exists\n",
587 sw_if_index, sub_id);
588 rv = VNET_API_ERROR_SUBIF_ALREADY_EXISTS;
592 memset (&
template, 0,
sizeof (
template));
594 template.sup_sw_if_index = sw_if_index;
595 template.sub.id = sub_id;
596 template.sub.eth.flags.no_tags = mp->
no_tags;
597 template.sub.eth.flags.one_tag = mp->
one_tag;
598 template.sub.eth.flags.two_tags = mp->
two_tags;
599 template.sub.eth.flags.dot1ad = mp->
dot1ad;
600 template.sub.eth.flags.exact_match = mp->
exact_match;
601 template.sub.eth.flags.default_sub = mp->
default_sub;
611 rv = VNET_API_ERROR_SUBIF_CREATE_FAILED;
616 *kp = sup_and_sub_key;
636 vl_api_proxy_arp_add_del_reply_t *rmp;
643 u32 fib_index,
int is_del);
652 rv = VNET_API_ERROR_NO_SUCH_FIB;
660 fib_index, mp->
is_add == 0);
673 vl_api_proxy_arp_intfc_enable_disable_reply_t *rmp;
690 REPLY_MACRO (VL_API_PROXY_ARP_INTFC_ENABLE_DISABLE_REPLY);
697 vl_api_sw_interface_set_mpls_enable_reply_t *rmp;
706 REPLY_MACRO (VL_API_SW_INTERFACE_SET_MPLS_ENABLE_REPLY);
720 q = vl_api_client_index_to_input_queue (reg->client_index);
723 mp = vl_msg_api_alloc (sizeof (*mp));
724 mp->_vl_msg_id = ntohs (VL_API_OAM_EVENT);
725 clib_memcpy (mp->dst_address, &t->dst_address,
726 sizeof (mp->dst_address));
727 mp->state = t->state;
728 vl_msg_api_send_shmem (q, (u8 *)&mp);
737 vl_api_oam_add_del_reply_t *rmp;
766 rmp->_vl_msg_id = ntohs (VL_API_VNET_GET_SUMMARY_STATS_REPLY);
770 memset (total_pkts, 0,
sizeof (total_pkts));
771 memset (total_bytes, 0,
sizeof (total_bytes));
782 total_pkts[which] += v.
packets;
783 total_bytes[which] += v.
bytes;
801 u32 address_length: 6;
812 static u32 *sw_if_indices_to_shut;
818 int rv = VNET_API_ERROR_NO_SUCH_FIB;
826 vnet_sw_interface_t * si;
828 fib = pool_elt_at_index (im4->v4_fibs, fib_table->ft_index);
830 if (fib->table_id != target_fib_id)
834 mpls_fib_reset_labels (fib->table_id);
837 vnet_proxy_arp_fib_reset (fib->table_id);
840 vnet_set_ip4_flow_hash (fib->table_id, IP_FLOW_HASH_DEFAULT);
842 vec_reset_length (sw_if_indices_to_shut);
845 pool_foreach (si, im->sw_interfaces,
847 u32 sw_if_index = si->sw_if_index;
849 if (sw_if_index < vec_len (im4->fib_index_by_sw_if_index)
850 && (im4->fib_index_by_sw_if_index[si->sw_if_index] ==
852 vec_add1 (sw_if_indices_to_shut, si->sw_if_index);
855 for (i = 0; i <
vec_len (sw_if_indices_to_shut); i++) {
856 sw_if_index = sw_if_indices_to_shut[
i];
881 static u32 *sw_if_indices_to_shut;
886 int rv = VNET_API_ERROR_NO_SUCH_FIB;
894 vnet_sw_interface_t * si;
896 fib = pool_elt_at_index (im6->v6_fibs, fib_table->ft_index);
898 if (fib->table_id != target_fib_id)
901 vec_reset_length (sw_if_indices_to_shut);
904 vnet_set_ip6_flow_hash (fib->table_id, IP_FLOW_HASH_DEFAULT);
907 pool_foreach (si, im->sw_interfaces,
909 if (im6->fib_index_by_sw_if_index[si->sw_if_index] ==
911 vec_add1 (sw_if_indices_to_shut, si->sw_if_index);
914 for (i = 0; i <
vec_len (sw_if_indices_to_shut); i++) {
915 sw_if_index = sw_if_indices_to_shut[
i];
937 vl_api_reset_fib_reply_t *rmp;
942 rv = ip4_reset_fib_t_handler (mp);
974 is_specified, user_instance);
987 vl_api_delete_loopback_reply_t *rmp;
1006 rmp->
vpe_pid = ntohl (getpid());
1014 u8 **shmem_vecp = (
u8 **) arg;
1020 shmem_vec = *shmem_vecp;
1029 clib_memcpy (shmem_vec + offset, buffer, buffer_bytes);
1034 *shmem_vecp = shmem_vec;
1054 rp->_vl_msg_id = ntohs (VL_API_CLI_REPLY);
1077 u8 **mem_vecp = (
u8 **) arg;
1078 u8 *mem_vec = *mem_vecp;
1082 clib_memcpy (mem_vec + offset, buffer, buffer_bytes);
1083 *mem_vecp = mem_vec;
1107 rmp->
length = htonl (len);
1118 vl_api_set_arp_neighbor_limit_reply_t *rmp;
1132 rv = VNET_API_ERROR_UNSPECIFIED;
1139 REPLY_MACRO (VL_API_SET_ARP_NEIGHBOR_LIMIT_REPLY);
1146 vl_api_classify_set_interface_ip_table_reply_t *rmp;
1161 REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_IP_TABLE_REPLY);
1167 vl_api_classify_set_interface_l2_tables_reply_t *rmp;
1169 u32 sw_if_index, ip4_table_index, ip6_table_index, other_table_index;
1190 if (ip4_table_index != ~0 || ip6_table_index != ~0
1191 || other_table_index != ~0)
1204 REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_L2_TABLES_REPLY);
1208 u32 sw_if_index,
u32 enable);
1215 vl_api_l2_interface_efp_filter_reply_t *rmp;
1222 REPLY_MACRO (VL_API_L2_INTERFACE_EFP_FILTER_REPLY);
1244 strncpy ((
char *) rmp->
build_directory, vpe_api_get_build_directory(),
1246 strncpy ((
char *) rmp->
version, vpe_api_get_version(),
1248 strncpy ((
char *) rmp->
build_date, vpe_api_get_build_date(),
1261 u32 node_index = ~0;
1266 rv = VNET_API_ERROR_NO_SUCH_NODE;
1268 node_index = n->
index;
1285 u32 next_node_index = ~0, next_index = ~0;
1292 rv = VNET_API_ERROR_NO_SUCH_NODE;
1300 rv = VNET_API_ERROR_NO_SUCH_NODE2;
1304 next_node_index = next_node->
index;
1310 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
1332 u32 next_index = ~0;
1338 rv = VNET_API_ERROR_NO_SUCH_NODE;
1345 rv = VNET_API_ERROR_NO_SUCH_NODE2;
1363 vl_api_l2_patch_add_del_reply_t *rmp;
1373 (
int) (mp->
is_add != 0));
1385 vl_api_interface_name_renumber_reply_t *rmp;
1395 REPLY_MACRO (VL_API_INTERFACE_NAME_RENUMBER_REPLY);
1400 u32 sw_if_index,
u32 address)
1405 static f64 arp_event_last_time;
1423 (now - arp_event_last_time) < 10.0)))
1428 arp_event_last_time = now;
1442 static f64 nd_event_last_time;
1462 (now - nd_event_last_time) < 10.0)))
1467 nd_event_last_time = now;
1503 vl_api_want_ip4_arp_events_reply_t *rmp;
1513 vpe_resolver_process_node.index,
1521 memset (event, 0,
sizeof (*event));
1523 event->_vl_msg_id = ntohs (VL_API_IP4_ARP_EVENT);
1536 vpe_resolver_process_node.index,
1548 vl_api_want_ip6_nd_events_reply_t *rmp;
1559 vpe_resolver_process_node.index,
1567 memset (event, 0,
sizeof (*event));
1569 event->_vl_msg_id = ntohs (VL_API_IP6_ND_EVENT);
1583 vpe_resolver_process_node.index,
1594 vl_api_input_acl_set_interface_reply_t *rmp;
1605 ip6_table_index, l2_table_index, mp->
is_add);
1609 REPLY_MACRO (VL_API_INPUT_ACL_SET_INTERFACE_REPLY);
1652 vl_api_ioam_enable_reply_t *rmp;
1672 vl_api_ioam_disable_reply_t *rmp;
1706 vl_api_pg_capture_reply_t *rmp;
1714 u32 hw_if_index = ~0;
1720 if (hw_if_index != ~0)
1739 rv = VNET_API_ERROR_CANNOT_CREATE_PCAP_FILE;
1750 vl_api_pg_enable_disable_reply_t *rmp;
1754 u32 stream_index = ~0;
1778 vl_api_ip_source_and_port_range_check_add_del_reply_t *rmp;
1787 u16 *high_ports = 0;
1789 u16 tmp_low, tmp_high;
1795 if (num_ranges > 32)
1797 rv = VNET_API_ERROR_EXCEEDED_NUMBER_OF_RANGES_CAPACITY;
1804 for (i = 0; i < num_ranges; i++)
1810 if (tmp_low > tmp_high || tmp_low == 0 || tmp_high > 65535)
1812 rv = VNET_API_ERROR_INVALID_VALUE;
1816 vec_add1 (high_ports, tmp_high + 1);
1820 if ((is_ipv6 && mask_length > 128) || (!is_ipv6 && mask_length > 32))
1822 rv = VNET_API_ERROR_ADDRESS_LENGTH_MISMATCH;
1826 vrf_id = ntohl (mp->
vrf_id);
1830 rv = VNET_API_ERROR_INVALID_VALUE;
1842 high_ports, is_add);
1851 high_ports, is_add);
1857 REPLY_MACRO (VL_API_IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL_REPLY);
1865 vl_api_ip_source_and_port_range_check_interface_add_del_reply_t *rmp;
1886 if (vrf_id[i] != 0 && vrf_id[i] != ~0)
1892 rv = VNET_API_ERROR_INVALID_VALUE;
1896 fib_index[
i] = p[0];
1912 REPLY_MACRO (VL_API_IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL_REPLY);
1918 vl_api_delete_subif_reply_t *rmp;
1929 vl_api_punt_reply_t *rmp;
1948 vl_api_feature_enable_disable_reply_t *rmp;
1958 (
const char *) feature_name);
1960 rv = VNET_API_ERROR_INVALID_VALUE;
1966 if (reg->enable_disable_cb)
1967 error = reg->enable_disable_cb (sw_if_index, mp->
enable);
1970 (
const char *) feature_name,
1971 sw_if_index, mp->
enable, 0, 0);
1975 rv = VNET_API_ERROR_CANNOT_ENABLE_DISABLE_FEATURE;
1984 REPLY_MACRO (VL_API_FEATURE_ENABLE_DISABLE_REPLY);
1987 #define BOUNCE_HANDLER(nn) \ 1988 static void vl_api_##nn##_t_handler ( \ 1989 vl_api_##nn##_t *mp) \ 1991 vpe_client_registration_t *reg; \ 1992 vpe_api_main_t * vam = &vpe_api_main; \ 1993 unix_shared_memory_queue_t * q; \ 1996 pool_foreach(reg, vam->nn##_registrations, \ 1998 q = vl_api_client_index_to_input_queue (reg->client_index); \ 2005 if (q->cursize == q->maxsize) { \ 2006 clib_warning ("ERROR: receiver queue full, drop msg"); \ 2007 vl_msg_api_free (mp); \ 2010 vl_msg_api_send_shmem (q, (u8 *)&mp); \ 2014 vl_msg_api_free (mp); \ 2032 vl_msg_api_set_handlers(VL_API_##N, #n, \ 2033 vl_api_##n##_t_handler, \ 2035 vl_api_##n##_t_endian, \ 2036 vl_api_##n##_t_print, \ 2037 sizeof(vl_api_##n##_t), 1); 2046 += 5 *
sizeof (
u32x4);
2073 am->from_netconf_server_registration_hash =
hash_create (0,
sizeof (
uword));
2075 am->from_netconf_client_registration_hash =
hash_create (0,
sizeof (
uword));
2092 u64 baseva,
size, pvt_heap_size;
2094 const int max_buf_size = 4096;
2096 struct passwd _pw, *pw;
2097 struct group _grp, *grp;
2102 if (
unformat (input,
"prefix %s", &chroot_path))
2107 else if (
unformat (input,
"uid %d", &uid))
2109 else if (
unformat (input,
"gid %d", &gid))
2111 else if (
unformat (input,
"baseva %llx", &baseva))
2113 else if (
unformat (input,
"global-size %lldM", &size))
2115 else if (
unformat (input,
"global-size %lldG", &size))
2117 else if (
unformat (input,
"global-size %lld", &size))
2119 else if (
unformat (input,
"global-pvt-heap-size %lldM", &pvt_heap_size))
2121 else if (
unformat (input,
"global-pvt-heap-size size %lld",
2124 else if (
unformat (input,
"api-pvt-heap-size %lldM", &pvt_heap_size))
2126 else if (
unformat (input,
"api-pvt-heap-size size %lld",
2129 else if (
unformat (input,
"api-size %lldM", &size))
2131 else if (
unformat (input,
"api-size %lldG", &size))
2133 else if (
unformat (input,
"api-size %lld", &size))
2135 else if (
unformat (input,
"uid %s", &s))
2140 getpwnam_r (s, &_pw, buf,
vec_len (buf), &pw)) == ERANGE)
2141 && (
vec_len (buf) <= max_buf_size))
2150 "cannot fetch username %s", s);
2166 else if (
unformat (input,
"gid %s", &s))
2171 getgrnam_r (s, &_grp, buf,
vec_len (buf), &grp)) == ERANGE)
2172 && (
vec_len (buf) <= max_buf_size))
2181 "cannot fetch group %s", s);
2217 s =
format (s,
"pid %d: ", ntohl (event->
pid));
2219 s =
format (s,
"bd mac/ip4 binding events");
2230 s =
format (s,
"pid %d: ", ntohl (event->
pid));
2232 s =
format (s,
"bd mac/ip6 binding events");
2255 vlib_cli_output (vm,
"%U", format_arp_event, arp_event);
2260 vlib_cli_output (vm,
"%U", format_nd_event, nd_event);
2269 .path =
"show arp-nd-event registrations",
2271 .short_help =
"Show ip4 arp and ip6 nd event registrations",
2275 #define vl_msg_name_crc_list 2277 #undef vl_msg_name_crc_list 2282 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 2283 foreach_vl_msg_name_crc_memclnt;
2284 foreach_vl_msg_name_crc_vpe;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static void vl_api_create_loopback_t_handler(vl_api_create_loopback_t *mp)
static void vl_api_feature_enable_disable_t_handler(vl_api_feature_enable_disable_t *mp)
#define BAD_RX_SW_IF_INDEX_LABEL
Proxy ARP add / del request.
void vl_set_api_memory_size(u64 size)
clib_error_t * pg_capture(pg_capture_args_t *a)
void mpls_sw_interface_enable_disable(mpls_main_t *mm, u32 sw_if_index, u8 is_enable)
static clib_error_t * memclnt_delete_callback(u32 client_index)
static void vl_api_want_ip4_arp_events_t_handler(vl_api_want_ip4_arp_events_t *mp)
#define hash_set(h, key, value)
Register for ip6 nd resolution events.
#define VALIDATE_TX_SW_IF_INDEX(mp)
static void handle_ip4_arp_event(u32 pool_index)
sll srl srl sll sra u16x4 i
void vl_enable_disable_memory_api(vlib_main_t *vm, int yesno)
static void vl_api_reset_fib_t_handler(vl_api_reset_fib_t *mp)
static void svm_pop_heap(void *oldheap)
Reply for get next node index.
static void vl_api_interface_name_renumber_t_handler(vl_api_interface_name_renumber_t *mp)
vpe parser cli string response
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...
static void vl_api_vnet_get_summary_stats_t_handler(vl_api_vnet_get_summary_stats_t *mp)
#define foreach_vpe_api_msg
static void vl_api_cli_t_handler(vl_api_cli_t *mp)
void vlib_cli_input(vlib_main_t *vm, unformat_input_t *input, vlib_cli_output_function_t *function, uword function_arg)
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
static int arp_change_data_callback(u32 pool_index, u8 *new_mac, u32 sw_if_index, u32 address)
int vnet_set_ip6_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
void vl_set_memory_gid(int gid)
vnet_interface_main_t interface_main
Control ping from client to api server request.
Fixed length block allocator.
#define REPLY_MACRO2(t, body)
Request for a single block of summary stats.
Set max allowed ARP or ip6 neighbor entries request.
static f64 vlib_time_now(vlib_main_t *vm)
int vnet_add_del_ip6_nd_change_event(vnet_main_t *vnm, void *data_callback, u32 pid, void *address_arg, uword node_index, uword type_opaque, uword data, int is_add)
VLIB_API_INIT_FUNCTION(vpe_api_hookup)
uword * stream_index_by_name
clib_error_t * ip4_set_arp_limit(u32 arp_limit)
static void vl_api_sw_interface_set_mpls_enable_t_handler(vl_api_sw_interface_set_mpls_enable_t *mp)
static clib_error_t * api_segment_config(vlib_main_t *vm, unformat_input_t *input)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
int vnet_interface_name_renumber(u32 sw_if_index, u32 new_show_dev_instance)
static void vl_api_punt_t_handler(vl_api_punt_t *mp)
Combined counter to hold both packets and byte differences.
struct _vlib_node_registration vlib_node_registration_t
void vnet_l2_input_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
static void vl_api_set_arp_neighbor_limit_t_handler(vl_api_set_arp_neighbor_limit_t *mp)
#define hash_set_mem(h, key, value)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
uword * sub_interface_sw_if_index_by_id
unformat_function_t unformat_vnet_sw_interface
u8 * vlib_node_serialize(vlib_node_main_t *nm, u8 *vector, u32 max_threads, int include_nexts, int include_stats)
Enable / disable packet generator request.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static void vl_api_proxy_arp_add_del_t_handler(vl_api_proxy_arp_add_del_t *mp)
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
trace_cfg_t * api_trace_cfg
static void vl_api_l2_patch_add_del_t_handler(vl_api_l2_patch_add_del_t *mp)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
Process a vpe parser cli string request.
static f64 vlib_last_vector_length_per_node(vlib_main_t *vm)
pub_sub_handler(oam_events, OAM_EVENTS)
u8 pcap_file_name[pcap_name_length]
PacketGenerator capture packets on given interface request.
void vl_set_memory_uid(int uid)
static void vl_api_get_next_index_t_handler(vl_api_get_next_index_t *mp)
Get node index using name request.
Proxy ARP add / del request.
#define VNET_SW_INTERFACE_FLAG_PROXY_ARP
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
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...
static void vl_api_get_node_graph_t_handler(vl_api_get_node_graph_t *mp)
static void * svm_push_data_heap(svm_region_t *rp)
vnet_feature_registration_t * vnet_get_feature_reg(const char *arc_name, const char *node_name)
#define vec_new(T, N)
Create new vector of given type and length (unspecified alignment, no header).
vlib_combined_counter_main_t * combined_sw_if_counters
static uword ip6_address_is_equal(ip6_address_t *a, ip6_address_t *b)
Set interface source and L4 port-range request.
Reply for the vlan subinterface create request.
#define clib_error_return_fatal(e, args...)
struct _vl_api_ip4_arp_event * arp_events
static vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
void fib_table_flush(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Flush all entries from a table for the source.
#define clib_error_return(e, args...)
int vnet_l2_output_classify_set_tables(u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 other_table_index)
Set l2 per-protocol, per-interface output classification tables.
static void vl_api_want_ip6_nd_events_t_handler(vl_api_want_ip6_nd_events_t *mp)
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
static clib_error_t * vpe_api_init(vlib_main_t *vm)
static int ip6_reset_fib_t_handler(vl_api_reset_fib_t *mp)
int vnet_set_ip4_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
uword * bd_index_by_bd_id
void * vl_msg_api_alloc(int nbytes)
Configure IP source and L4 port-range check.
uword * hw_interface_by_name
vnet_api_error_t api_errno
void dsunlock(stats_main_t *sm)
static uword resolver_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vl_api_pg_enable_disable_t_handler(vl_api_pg_enable_disable_t *mp)
uword * fib_index_by_table_id
Hash table mapping table id to fib index.
counter_t packets
packet counter
static void shmem_cli_output(uword arg, u8 *buffer, uword buffer_bytes)
u32 new_show_dev_instance
static void vl_api_pg_create_interface_t_handler(vl_api_pg_create_interface_t *mp)
static void vl_api_get_node_index_t_handler(vl_api_get_node_index_t *mp)
char * vpe_api_get_version(void)
static void vl_api_bd_ip_mac_add_del_t_handler(vl_api_bd_ip_mac_add_del_t *mp)
u32 vlib_combined_counter_n_counters(const vlib_combined_counter_main_t *cm)
The number of counters (not the number of per-thread counters)
static void vl_api_sw_interface_set_l2_bridge_t_handler(vl_api_sw_interface_set_l2_bridge_t *mp)
Set/unset l2 classification tables for an interface request.
void send_oam_event(oam_target_t *t)
static u8 * format_nd_event(u8 *s, va_list *args)
Set bridge domain ip to mac entry request.
#define pool_put(P, E)
Free an object E in pool P.
u8 stream_name[stream_name_length]
uword * sw_if_index_by_sup_and_sub
static void vl_api_pg_capture_t_handler(vl_api_pg_capture_t *mp)
#define BAD_TX_SW_IF_INDEX_LABEL
Create loopback interface instance response.
u32 pg_interface_add_or_get(pg_main_t *pg, uword stream_index)
clib_error_t * vnet_punt_add_del(vlib_main_t *vm, u8 ipv, u8 protocol, u16 port, int is_add)
Request IP traffic punt to the local TCP/IP stack.
Tell client about an ip4 arp resolution event.
void vl_set_global_memory_baseva(u64 baseva)
static void vl_api_classify_set_interface_ip_table_t_handler(vl_api_classify_set_interface_ip_table_t *mp)
Enable or Disable MPLS on and interface.
IOAM enable : Enable in-band OAM.
#define REPLY_MACRO3(t, n, body)
struct _vl_api_ip6_nd_event * nd_events
IP Set the next node for a given node response.
Get node index using name request.
int vnet_create_loopback_interface(u32 *sw_if_indexp, u8 *mac_address, u8 is_specified, u32 user_instance)
static void vl_api_add_node_next_t_handler(vl_api_add_node_next_t *mp)
#define VNET_HW_INTERFACE_BOND_INFO_SLAVE
#define BAD_SW_IF_INDEX_LABEL
#define VLIB_EARLY_CONFIG_FUNCTION(x, n,...)
PacketGenerator create interface request.
static int nd_change_data_callback(u32 pool_index, u8 *new_mac, u32 sw_if_index, ip6_address_t *address)
static void vl_api_proxy_arp_intfc_enable_disable_t_handler(vl_api_proxy_arp_intfc_enable_disable_t *mp)
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
int vnet_delete_sub_interface(u32 sw_if_index)
static vlib_node_registration_t vpe_resolver_process_node
(constructor) VLIB_REGISTER_NODE (vpe_resolver_process_node)
u32 bd_add_del_ip_mac(u32 bd_index, u8 *ip_addr, u8 *mac_addr, u8 is_ip6, u8 is_add)
Add/delete IP address to MAC address mapping.
#define vec_free(V)
Free vector's memory (no header).
int vnet_delete_loopback_interface(u32 sw_if_index)
static void vl_api_ioam_disable_t_handler(vl_api_ioam_disable_t *mp)
Set/unset the classification table for an interface request.
#define clib_warning(format, args...)
char * vpe_api_get_build_directory(void)
void vl_set_global_pvt_heap_size(u64 size)
#define clib_memcpy(a, b, c)
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
void vl_set_memory_region_name(const char *name)
Feature path enable/disable request.
static void inband_cli_output(uword arg, u8 *buffer, uword buffer_bytes)
clib_error_t * ip6_ioam_enable(int has_trace_option, int has_pot_option, int has_seqno_option, int has_analyse_option)
static void vl_api_show_version_t_handler(vl_api_show_version_t *mp)
static void vnet_interface_counter_unlock(vnet_interface_main_t *im)
Definitions for punt infrastructure.
int vnet_l2_input_classify_set_tables(u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 other_table_index)
Set l2 per-protocol, per-interface input classification tables.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Delete sub interface request.
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
int ip4_add_del_route_t_handler(vl_api_ip_add_del_route_t *mp)
#define VALIDATE_RX_SW_IF_INDEX(mp)
int vnet_proxy_arp_add_del(ip4_address_t *lo_addr, ip4_address_t *hi_addr, u32 fib_index, int is_del)
Delete loopback interface request.
static void vl_api_sw_interface_set_vpath_t_handler(vl_api_sw_interface_set_vpath_t *mp)
#define VLIB_CLI_COMMAND(x,...)
Set L2 XConnect between two interfaces request.
static void vnet_interface_counter_lock(vnet_interface_main_t *im)
#define hash_create(elts, value_bytes)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
static u32 bd_find_or_add_bd_index(bd_main_t *bdm, u32 bd_id)
Get or create a bridge domain.
#define pool_put_index(p, i)
Free pool element with given index.
static void vl_api_ip_source_and_port_range_check_interface_add_del_t_handler(vl_api_ip_source_and_port_range_check_interface_add_del_t *mp)
static uword ip6_address_is_zero(ip6_address_t *a)
static clib_error_t * show_ip_arp_nd_events_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void vl_api_classify_set_interface_l2_tables_t_handler(vl_api_classify_set_interface_l2_tables_t *mp)
int ip6_add_del_route_t_handler(vl_api_ip_add_del_route_t *mp)
static void vl_api_cli_inband_t_handler(vl_api_cli_inband_t *mp)
static void setup_message_id_table(api_main_t *am)
int vpe_oam_add_del_target(ip4_address_t *src_address, ip4_address_t *dst_address, u32 fib_id, int is_add)
void pg_enable_disable(u32 stream_index, int is_enable)
int stats_memclnt_delete_callback(u32 client_index)
Control ping from the client to the server response.
static void vl_api_create_vlan_subif_t_handler(vl_api_create_vlan_subif_t *mp)
Bitmaps built as vectors of machine words.
Set the next node for a given node request.
uword * next_slot_by_node
void handle_ip6_nd_event(u32 pool_index)
#define clib_error_report(e)
Query relative index via node names.
From the control plane API.
void l2_efp_filter_configure(vnet_main_t *vnet_main, u32 sw_if_index, u32 enable)
Enable/disable the EFP Filter check on the subinterface.
#define VALIDATE_BD_ID(mp)
OAM add / del target request.
static void * clib_mem_alloc(uword size)
VL_MSG_API_REAPER_FUNCTION(memclnt_delete_callback)
void vl_set_api_pvt_heap_size(u64 size)
static void vl_api_delete_subif_t_handler(vl_api_delete_subif_t *mp)
static void vl_api_ioam_enable_t_handler(vl_api_ioam_enable_t *mp)
static vlib_main_t * vlib_get_main(void)
static void vl_api_l2_interface_efp_filter_t_handler(vl_api_l2_interface_efp_filter_t *mp)
void dslock(stats_main_t *sm, int release_hint, int tag)
template key/value backing page structure
counter_t bytes
byte counter
static void vl_api_create_loopback_instance_t_handler(vl_api_create_loopback_instance_t *mp)
Interface bridge mode request.
Create loopback interface instance request.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vnet_interface_main_t * interface_main
static void vl_api_sw_interface_set_l2_xconnect_t_handler(vl_api_sw_interface_set_l2_xconnect_t *mp)
vlib_node_main_t node_main
void * get_unformat_vnet_sw_interface(void)
static void vl_api_create_subif_t_handler(vl_api_create_subif_t *mp)
L2 interface ethernet flow point filtering enable/disable request.
static u8 * format_arp_event(u8 *s, va_list *args)
int vnet_l2_patch_add_del(u32 rx_sw_if_index, u32 tx_sw_if_index, int is_add)
PacketGenerator create interface response.
void vnet_l2_output_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
Create loopback interface request.
#define clib_error_get_code(err)
int ip4_source_and_port_range_check_add_del(ip4_address_t *address, u32 length, u32 vrf_id, u16 *low_ports, u16 *high_ports, int is_add)
static void vl_api_delete_loopback_t_handler(vl_api_delete_loopback_t *mp)
A collection of combined counters.
vpe_api_main_t vpe_api_main
Create a new subinterface with the given vlan id.
Create loopback interface response.
L2 interface patch add / del request.
#define hash_get_mem(h, key)
static void vl_api_control_ping_t_handler(vl_api_control_ping_t *mp)
Tell client about an ip6 nd resolution or mac/ip event.
struct clib_bihash_value offset
template key/value backing page structure
Interface set vpath request.
char * vpe_api_get_build_date(void)
#define VLIB_REGISTER_NODE(x,...)
ip4_main_t ip4_main
Global ip4 main structure.
static void vl_api_input_acl_set_interface_t_handler(vl_api_input_acl_set_interface_t *mp)
Reply for vnet_get_summary_stats request.
#define clib_error_return_code(e, code, flags, args...)
Register for ip4 arp resolution events.
struct fib_table_t_ * fibs
Vector of FIBs.
#define vec_foreach(var, vec)
Vector iterator.
clib_error_t * clear_ioam_rewrite_fn(void)
static int nd_change_delete_callback(u32 pool_index, u8 *notused)
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
void vl_set_global_memory_size(u64 size)
static void vl_api_oam_add_del_t_handler(vl_api_oam_add_del_t *mp)
static void vl_api_ip_source_and_port_range_check_add_del_t_handler(vl_api_ip_source_and_port_range_check_add_del_t *mp)
void vl_set_memory_root_path(const char *root_path)
clib_error_t * vnet_create_sw_interface(vnet_main_t *vnm, vnet_sw_interface_t *template, u32 *sw_if_index)
static int arp_change_delete_callback(u32 pool_index, u8 *notused)
int ip6_source_and_port_range_check_add_del(ip6_address_t *address, u32 length, u32 vrf_id, u16 *low_ports, u16 *high_ports, int is_add)
static uword vnet_sw_interface_get_flags(vnet_main_t *vnm, u32 sw_if_index)
#define RESOLUTION_PENDING_EVENT
static clib_error_t * vpe_api_hookup(vlib_main_t *vm)
typedef CLIB_PACKED(struct{ip4_address_t address;u32 address_length:6;u32 index:26;})
struct fib_table_t_ * fibs
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
int vnet_add_del_ip4_arp_change_event(vnet_main_t *vnm, void *data_callback, u32 pid, void *address_arg, uword node_index, uword type_opaque, uword data, int is_add)
Punt traffic to the host.
pg_interface_t * interfaces
#define foreach_registration_hash
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".
#define VALIDATE_SW_IF_INDEX(mp)
A protocol Independent FIB table.
struct _vnet_feature_registration vnet_feature_registration_t
feature registration object
struct _unix_shared_memory_queue unix_shared_memory_queue_t
Segment Routing data structures definitions.
clib_error_t * ip6_set_neighbor_limit(u32 neighbor_limit)
int set_ip_source_and_port_range_check(vlib_main_t *vm, u32 *fib_index, u32 sw_if_index, u32 is_add)
static uword pool_elts(void *v)
Number of active elements in a pool.