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 _(RESET_FIB, reset_fib) \ 114 _(CREATE_LOOPBACK, create_loopback) \ 115 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \ 116 _(CONTROL_PING, control_ping) \ 118 _(CLI_INBAND, cli_inband) \ 119 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit) \ 120 _(L2_PATCH_ADD_DEL, l2_patch_add_del) \ 121 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \ 122 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \ 123 _(GET_NODE_INDEX, get_node_index) \ 124 _(ADD_NODE_NEXT, add_node_next) \ 125 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \ 126 _(SHOW_VERSION, show_version) \ 127 _(INTERFACE_NAME_RENUMBER, interface_name_renumber) \ 128 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \ 129 _(WANT_IP6_ND_EVENTS, want_ip6_nd_events) \ 130 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \ 131 _(DELETE_LOOPBACK, delete_loopback) \ 132 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \ 133 _(GET_NODE_GRAPH, get_node_graph) \ 134 _(IOAM_ENABLE, ioam_enable) \ 135 _(IOAM_DISABLE, ioam_disable) \ 136 _(GET_NEXT_INDEX, get_next_index) \ 137 _(PG_CREATE_INTERFACE, pg_create_interface) \ 138 _(PG_CAPTURE, pg_capture) \ 139 _(PG_ENABLE_DISABLE, pg_enable_disable) \ 140 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \ 141 ip_source_and_port_range_check_add_del) \ 142 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \ 143 ip_source_and_port_range_check_interface_add_del) \ 144 _(DELETE_SUBIF, delete_subif) \ 146 _(PUNT_SOCKET_REGISTER, punt_socket_register) \ 147 _(PUNT_SOCKET_DEREGISTER, punt_socket_deregister) \ 148 _(FEATURE_ENABLE_DISABLE, feature_enable_disable) 151 #define QUOTE(x) QUOTE_(x) 176 p = hash_get (vam->a##_registration_hash, client_index); \ 178 rp = pool_elt_at_index (vam->a##_registrations, p[0]); \ 179 pool_put (vam->a##_registrations, rp); \ 180 hash_unset (vam->a##_registration_hash, client_index); \ 191 #define RESOLUTION_EVENT 1 192 #define RESOLUTION_PENDING_EVENT 2 193 #define IP4_ARP_EVENT 3 194 #define IP6_ND_EVENT 4 227 if (q->cursize < q->maxsize)
235 static f64 last_time;
242 clib_warning (
"arp event for %U to pid %d: queue stuffed!",
276 if (q->cursize < q->maxsize)
284 static f64 last_time;
291 clib_warning (
"ip6 nd event for %U to pid %d: queue stuffed!",
302 volatile f64 timeout = 100.0;
303 volatile uword *event_data = 0;
324 for (i = 0; i <
vec_len (event_data); i++)
329 for (i = 0; i <
vec_len (event_data); i++)
346 .name =
"vpe-route-resolver-process",
353 vl_api_sw_interface_set_vpath_reply_t *rmp;
361 sw_if_index, mp->
enable, 0, 0);
363 sw_if_index, mp->
enable, 0, 0);
365 sw_if_index, mp->
enable, 0, 0);
367 sw_if_index, mp->
enable, 0, 0);
378 vl_api_sw_interface_set_l2_xconnect_reply_t *rmp;
391 rx_sw_if_index, 0, 0, 0, tx_sw_if_index);
401 REPLY_MACRO (VL_API_SW_INTERFACE_SET_L2_XCONNECT_REPLY);
409 vl_api_sw_interface_set_l2_bridge_reply_t *rmp;
426 rx_sw_if_index, bd_index, bvi, shg, 0);
436 REPLY_MACRO (VL_API_SW_INTERFACE_SET_L2_BRIDGE_REPLY);
443 vl_api_bd_ip_mac_add_del_reply_t *rmp;
451 rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
458 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
465 rv = VNET_API_ERROR_UNSPECIFIED;
476 u32 sw_if_index = (
u32) ~ 0;
493 rv = VNET_API_ERROR_BOND_SLAVE_NOT_ALLOWED;
498 if (
id == 0 ||
id > 4095)
500 rv = VNET_API_ERROR_INVALID_VLAN;
509 rv = VNET_API_ERROR_VLAN_ALREADY_EXISTS;
513 memset (&
template, 0,
sizeof (
template));
516 template.sub.id = id;
517 template.sub.eth.raw_flags = 0;
518 template.sub.eth.flags.one_tag = 1;
519 template.sub.eth.outer_vlan_id = id;
520 template.sub.eth.flags.exact_match = 1;
526 rv = VNET_API_ERROR_INVALID_REGISTRATION;
531 *kp = sup_and_sub_key;
544 rmp->_vl_msg_id = htons (VL_API_CREATE_VLAN_SUBIF_REPLY);
556 u32 sw_if_index = ~0;
574 rv = VNET_API_ERROR_BOND_SLAVE_NOT_ALLOWED;
579 sub_id = ntohl (mp->
sub_id);
581 sup_and_sub_key = ((
u64) (sw_if_index) << 32) | (
u64) sub_id;
587 clib_warning (
"sup sw_if_index %d, sub id %d already exists\n",
588 sw_if_index, sub_id);
589 rv = VNET_API_ERROR_SUBIF_ALREADY_EXISTS;
593 memset (&
template, 0,
sizeof (
template));
595 template.sup_sw_if_index = sw_if_index;
596 template.sub.id = sub_id;
597 template.sub.eth.flags.no_tags = mp->
no_tags;
598 template.sub.eth.flags.one_tag = mp->
one_tag;
599 template.sub.eth.flags.two_tags = mp->
two_tags;
600 template.sub.eth.flags.dot1ad = mp->
dot1ad;
601 template.sub.eth.flags.exact_match = mp->
exact_match;
602 template.sub.eth.flags.default_sub = mp->
default_sub;
612 rv = VNET_API_ERROR_SUBIF_CREATE_FAILED;
617 *kp = sup_and_sub_key;
637 vl_api_proxy_arp_add_del_reply_t *rmp;
644 u32 fib_index,
int is_del);
653 rv = VNET_API_ERROR_NO_SUCH_FIB;
661 fib_index, mp->
is_add == 0);
674 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;
707 REPLY_MACRO (VL_API_SW_INTERFACE_SET_MPLS_ENABLE_REPLY);
721 q = vl_api_client_index_to_input_queue (reg->client_index);
724 mp = vl_msg_api_alloc (sizeof (*mp));
725 mp->_vl_msg_id = ntohs (VL_API_OAM_EVENT);
726 clib_memcpy (mp->dst_address, &t->dst_address,
727 sizeof (mp->dst_address));
728 mp->state = t->state;
729 vl_msg_api_send_shmem (q, (u8 *)&mp);
738 vl_api_oam_add_del_reply_t *rmp;
755 static u32 *sw_if_indices_to_shut;
761 int rv = VNET_API_ERROR_NO_SUCH_FIB;
769 vnet_sw_interface_t * si;
771 fib = pool_elt_at_index (im4->v4_fibs, fib_table->ft_index);
773 if (fib->table_id != target_fib_id)
777 mpls_fib_reset_labels (fib->table_id);
780 vnet_proxy_arp_fib_reset (fib->table_id);
783 vnet_set_ip4_flow_hash (fib->table_id, IP_FLOW_HASH_DEFAULT);
785 vec_reset_length (sw_if_indices_to_shut);
788 pool_foreach (si, im->sw_interfaces,
790 u32 sw_if_index = si->sw_if_index;
792 if (sw_if_index < vec_len (im4->fib_index_by_sw_if_index)
793 && (im4->fib_index_by_sw_if_index[si->sw_if_index] ==
795 vec_add1 (sw_if_indices_to_shut, si->sw_if_index);
798 for (i = 0; i <
vec_len (sw_if_indices_to_shut); i++) {
799 sw_if_index = sw_if_indices_to_shut[
i];
824 static u32 *sw_if_indices_to_shut;
829 int rv = VNET_API_ERROR_NO_SUCH_FIB;
837 vnet_sw_interface_t * si;
839 fib = pool_elt_at_index (im6->v6_fibs, fib_table->ft_index);
841 if (fib->table_id != target_fib_id)
844 vec_reset_length (sw_if_indices_to_shut);
847 vnet_set_ip6_flow_hash (fib->table_id, IP_FLOW_HASH_DEFAULT);
850 pool_foreach (si, im->sw_interfaces,
852 if (im6->fib_index_by_sw_if_index[si->sw_if_index] ==
854 vec_add1 (sw_if_indices_to_shut, si->sw_if_index);
857 for (i = 0; i <
vec_len (sw_if_indices_to_shut); i++) {
858 sw_if_index = sw_if_indices_to_shut[
i];
880 vl_api_reset_fib_reply_t *rmp;
917 is_specified, user_instance);
930 vl_api_delete_loopback_reply_t *rmp;
949 rmp->
vpe_pid = ntohl (getpid());
957 u8 **shmem_vecp = (
u8 **) arg;
963 shmem_vec = *shmem_vecp;
972 clib_memcpy (shmem_vec + offset, buffer, buffer_bytes);
977 *shmem_vecp = shmem_vec;
997 rp->_vl_msg_id = ntohs (VL_API_CLI_REPLY);
1020 u8 **mem_vecp = (
u8 **) arg;
1021 u8 *mem_vec = *mem_vecp;
1025 clib_memcpy (mem_vec + offset, buffer, buffer_bytes);
1026 *mem_vecp = mem_vec;
1050 rmp->
length = htonl (len);
1061 vl_api_set_arp_neighbor_limit_reply_t *rmp;
1075 rv = VNET_API_ERROR_UNSPECIFIED;
1082 REPLY_MACRO (VL_API_SET_ARP_NEIGHBOR_LIMIT_REPLY);
1089 vl_api_classify_set_interface_ip_table_reply_t *rmp;
1104 REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_IP_TABLE_REPLY);
1110 vl_api_classify_set_interface_l2_tables_reply_t *rmp;
1112 u32 sw_if_index, ip4_table_index, ip6_table_index, other_table_index;
1133 if (ip4_table_index != ~0 || ip6_table_index != ~0
1134 || other_table_index != ~0)
1147 REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_L2_TABLES_REPLY);
1151 u32 sw_if_index,
u32 enable);
1158 vl_api_l2_interface_efp_filter_reply_t *rmp;
1165 REPLY_MACRO (VL_API_L2_INTERFACE_EFP_FILTER_REPLY);
1187 strncpy ((
char *) rmp->
build_directory, vpe_api_get_build_directory(),
1189 strncpy ((
char *) rmp->
version, vpe_api_get_version(),
1191 strncpy ((
char *) rmp->
build_date, vpe_api_get_build_date(),
1204 u32 node_index = ~0;
1209 rv = VNET_API_ERROR_NO_SUCH_NODE;
1211 node_index = n->
index;
1228 u32 next_node_index = ~0, next_index = ~0;
1235 rv = VNET_API_ERROR_NO_SUCH_NODE;
1243 rv = VNET_API_ERROR_NO_SUCH_NODE2;
1247 next_node_index = next_node->
index;
1253 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
1275 u32 next_index = ~0;
1281 rv = VNET_API_ERROR_NO_SUCH_NODE;
1288 rv = VNET_API_ERROR_NO_SUCH_NODE2;
1306 vl_api_l2_patch_add_del_reply_t *rmp;
1316 (
int) (mp->
is_add != 0));
1328 vl_api_interface_name_renumber_reply_t *rmp;
1338 REPLY_MACRO (VL_API_INTERFACE_NAME_RENUMBER_REPLY);
1343 u32 sw_if_index,
u32 address)
1439 for (i = 0; i <
vec_len (arp_events); i++)
1442 if (arp_prev.
ip4 == arp_events[i].
ip4 &&
1445 (now - last_arp) < 10.0)
1449 arp_prev = arp_events[
i];
1453 pool_foreach(reg, vpe_api_main.wc_ip4_arp_events_registrations,
1455 unix_shared_memory_queue_t *q;
1456 q = vl_api_client_index_to_input_queue (reg->client_index);
1457 if (q && q->cursize < q->maxsize)
1459 vl_api_ip4_arp_event_t * event = vl_msg_api_alloc (sizeof *event);
1460 memset (event, 0, sizeof *event);
1461 event->_vl_msg_id = htons (VL_API_IP4_ARP_EVENT);
1462 event->client_index = reg->client_index;
1463 event->pid = reg->client_pid;
1465 event->address = arp_events[i].ip4;
1466 event->sw_if_index = htonl(arp_events[i].sw_if_index);
1467 memcpy(event->new_mac, arp_events[i].mac, sizeof event->new_mac);
1468 vl_msg_api_send_shmem (q, (u8 *) &event);
1474 else if (event_type == WC_ND_REPORT)
1484 && (now - last_nd) < 10.0)
1488 nd_prev = nd_events[
i];
1492 pool_foreach(reg, vpe_api_main.wc_ip6_nd_events_registrations,
1494 unix_shared_memory_queue_t *q;
1495 q = vl_api_client_index_to_input_queue (reg->client_index);
1496 if (q && q->cursize < q->maxsize)
1498 vl_api_ip6_nd_event_t * event = vl_msg_api_alloc (sizeof *event);
1499 memset (event, 0, sizeof *event);
1500 event->_vl_msg_id = htons (VL_API_IP6_ND_EVENT);
1501 event->client_index = reg->client_index;
1502 event->pid = reg->client_pid;
1504 memcpy(event->address, nd_events[i].ip6.as_u8, sizeof event->address);
1505 event->sw_if_index = htonl(nd_events[i].sw_if_index);
1506 memcpy(event->new_mac, nd_events[i].mac, sizeof event->new_mac);
1507 vl_msg_api_send_shmem (q, (u8 *) &event);
1523 .name =
"wildcard-ip4-arp-publisher-process",
1532 vl_api_want_ip4_arp_events_reply_t *rmp;
1545 rv = VNET_API_ERROR_INVALID_REGISTRATION;
1552 pool_put (am->wc_ip4_arp_events_registrations, rp);
1553 hash_unset (am->wc_ip4_arp_events_registration_hash,
1555 if (
pool_elts (am->wc_ip4_arp_events_registrations) == 0)
1563 rv = VNET_API_ERROR_INVALID_REGISTRATION;
1566 pool_get (am->wc_ip4_arp_events_registrations, rp);
1570 rp - am->wc_ip4_arp_events_registrations);
1582 vpe_resolver_process_node.index,
1590 memset (event, 0,
sizeof (*event));
1593 event->_vl_msg_id = htons (VL_API_IP4_ARP_EVENT);
1605 vpe_resolver_process_node.index,
1617 vl_api_want_ip6_nd_events_reply_t *rmp;
1630 rv = VNET_API_ERROR_INVALID_REGISTRATION;
1637 pool_put (am->wc_ip6_nd_events_registrations, rp);
1638 hash_unset (am->wc_ip6_nd_events_registration_hash,
1640 if (
pool_elts (am->wc_ip6_nd_events_registrations) == 0)
1648 rv = VNET_API_ERROR_INVALID_REGISTRATION;
1651 pool_get (am->wc_ip6_nd_events_registrations, rp);
1655 rp - am->wc_ip6_nd_events_registrations);
1668 vpe_resolver_process_node.index,
1676 memset (event, 0,
sizeof (*event));
1678 event->_vl_msg_id = ntohs (VL_API_IP6_ND_EVENT);
1688 vpe_resolver_process_node.index,
1699 vl_api_input_acl_set_interface_reply_t *rmp;
1710 ip6_table_index, l2_table_index, mp->
is_add);
1714 REPLY_MACRO (VL_API_INPUT_ACL_SET_INTERFACE_REPLY);
1757 vl_api_ioam_enable_reply_t *rmp;
1777 vl_api_ioam_disable_reply_t *rmp;
1811 vl_api_pg_capture_reply_t *rmp;
1819 u32 hw_if_index = ~0;
1825 if (hw_if_index != ~0)
1844 rv = VNET_API_ERROR_CANNOT_CREATE_PCAP_FILE;
1855 vl_api_pg_enable_disable_reply_t *rmp;
1859 u32 stream_index = ~0;
1883 vl_api_ip_source_and_port_range_check_add_del_reply_t *rmp;
1892 u16 *high_ports = 0;
1894 u16 tmp_low, tmp_high;
1900 if (num_ranges > 32)
1902 rv = VNET_API_ERROR_EXCEEDED_NUMBER_OF_RANGES_CAPACITY;
1909 for (i = 0; i < num_ranges; i++)
1915 if (tmp_low > tmp_high || tmp_low == 0 || tmp_high > 65535)
1917 rv = VNET_API_ERROR_INVALID_VALUE;
1921 vec_add1 (high_ports, tmp_high + 1);
1925 if ((is_ipv6 && mask_length > 128) || (!is_ipv6 && mask_length > 32))
1927 rv = VNET_API_ERROR_ADDRESS_LENGTH_MISMATCH;
1931 vrf_id = ntohl (mp->
vrf_id);
1935 rv = VNET_API_ERROR_INVALID_VALUE;
1947 high_ports, is_add);
1956 high_ports, is_add);
1962 REPLY_MACRO (VL_API_IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL_REPLY);
1970 vl_api_ip_source_and_port_range_check_interface_add_del_reply_t *rmp;
1991 if (vrf_id[i] != 0 && vrf_id[i] != ~0)
1997 rv = VNET_API_ERROR_INVALID_VALUE;
2001 fib_index[
i] = p[0];
2017 REPLY_MACRO (VL_API_IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL_REPLY);
2023 vl_api_delete_subif_reply_t *rmp;
2034 vl_api_punt_reply_t *rmp;
2074 rmp->_vl_msg_id = htons (VL_API_PUNT_SOCKET_REGISTER_REPLY);
2076 rmp->
retval = htonl (rv);
2086 vl_api_punt_socket_deregister_reply_t *rmp;
2106 rmp->_vl_msg_id = htons (VL_API_PUNT_SOCKET_DEREGISTER_REPLY);
2108 rmp->retval = htonl (rv);
2115 vl_api_feature_enable_disable_reply_t *rmp;
2125 (
const char *) feature_name);
2127 rv = VNET_API_ERROR_INVALID_VALUE;
2133 if (reg->enable_disable_cb)
2134 error = reg->enable_disable_cb (sw_if_index, mp->
enable);
2137 (
const char *) feature_name,
2138 sw_if_index, mp->
enable, 0, 0);
2142 rv = VNET_API_ERROR_CANNOT_ENABLE_DISABLE_FEATURE;
2151 REPLY_MACRO (VL_API_FEATURE_ENABLE_DISABLE_REPLY);
2154 #define BOUNCE_HANDLER(nn) \ 2155 static void vl_api_##nn##_t_handler ( \ 2156 vl_api_##nn##_t *mp) \ 2158 vpe_client_registration_t *reg; \ 2159 vpe_api_main_t * vam = &vpe_api_main; \ 2160 unix_shared_memory_queue_t * q; \ 2163 pool_foreach(reg, vam->nn##_registrations, \ 2165 q = vl_api_client_index_to_input_queue (reg->client_index); \ 2172 if (q->cursize == q->maxsize) { \ 2173 clib_warning ("ERROR: receiver queue full, drop msg"); \ 2174 vl_msg_api_free (mp); \ 2177 vl_msg_api_send_shmem (q, (u8 *)&mp); \ 2181 vl_msg_api_free (mp); \ 2199 vl_msg_api_set_handlers(VL_API_##N, #n, \ 2200 vl_api_##n##_t_handler, \ 2202 vl_api_##n##_t_endian, \ 2203 vl_api_##n##_t_print, \ 2204 sizeof(vl_api_##n##_t), 1); 2213 += 5 *
sizeof (
u32x4);
2239 am->a##_registration_hash = hash_create (0, sizeof (uword)); 2256 u64 baseva,
size, pvt_heap_size;
2258 const int max_buf_size = 4096;
2260 struct passwd _pw, *pw;
2261 struct group _grp, *grp;
2266 if (
unformat (input,
"prefix %s", &chroot_path))
2271 else if (
unformat (input,
"uid %d", &uid))
2273 else if (
unformat (input,
"gid %d", &gid))
2275 else if (
unformat (input,
"baseva %llx", &baseva))
2277 else if (
unformat (input,
"global-size %lldM", &size))
2279 else if (
unformat (input,
"global-size %lldG", &size))
2281 else if (
unformat (input,
"global-size %lld", &size))
2283 else if (
unformat (input,
"global-pvt-heap-size %lldM", &pvt_heap_size))
2285 else if (
unformat (input,
"global-pvt-heap-size size %lld",
2288 else if (
unformat (input,
"api-pvt-heap-size %lldM", &pvt_heap_size))
2290 else if (
unformat (input,
"api-pvt-heap-size size %lld",
2293 else if (
unformat (input,
"api-size %lldM", &size))
2295 else if (
unformat (input,
"api-size %lldG", &size))
2297 else if (
unformat (input,
"api-size %lld", &size))
2299 else if (
unformat (input,
"uid %s", &s))
2304 getpwnam_r (s, &_pw, buf,
vec_len (buf), &pw)) == ERANGE)
2305 && (
vec_len (buf) <= max_buf_size))
2314 "cannot fetch username %s", s);
2330 else if (
unformat (input,
"gid %s", &s))
2335 getgrnam_r (s, &_grp, buf,
vec_len (buf), &grp)) == ERANGE)
2336 && (
vec_len (buf) <= max_buf_size))
2345 "cannot fetch group %s", s);
2381 s =
format (s,
"pid %d: ", ntohl (event->
pid));
2391 s =
format (s,
"pid %d: ", ntohl (event->
pid));
2405 pool_elts (am->wc_ip4_arp_events_registrations) == 0 &&
2406 pool_elts (am->wc_ip6_nd_events_registrations) == 0)
2415 vlib_cli_output (vm,
"%U", format_arp_event, arp_event);
2421 vlib_cli_output (vm,
"pid %d: bd mac/ip4 binding events",
2422 ntohl (reg->client_pid));
2427 vlib_cli_output (vm,
"%U", format_nd_event, nd_event);
2432 vlib_cli_output (vm,
"pid %d: bd mac/ip6 binding events",
2433 ntohl (reg->client_pid));
2442 .path =
"show arp-nd-event registrations",
2444 .short_help =
"Show ip4 arp and ip6 nd event registrations",
2448 #define vl_msg_name_crc_list 2450 #undef vl_msg_name_crc_list 2455 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 2456 foreach_vl_msg_name_crc_memclnt;
2457 foreach_vl_msg_name_crc_vpe;
static vlib_node_registration_t wc_arp_process_node
(constructor) VLIB_REGISTER_NODE (wc_arp_process_node)
#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)
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...
#define foreach_vpe_api_msg
#define hash_unset(h, key)
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
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.
int size
for sanity checking
Fixed length block allocator.
#define REPLY_MACRO2(t, body)
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)
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
Current trace configuration.
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.
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).
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...)
svm_region_t * vlib_rp
Binary api segment descriptor.
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 void vl_api_punt_socket_deregister_t_handler(vl_api_punt_socket_deregister_t *mp)
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.
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)
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)
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.
static void vl_api_punt_socket_register_t_handler(vl_api_punt_socket_register_t *mp)
#define REPLY_MACRO3(t, n, body)
struct _vl_api_ip6_nd_event * nd_events
API main structure, used by both vpp and binary API clients.
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)
void wc_nd_set_publisher_node(uword node_index, uword event_type)
#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)
clib_error_t * vnet_punt_socket_add(vlib_main_t *vm, u32 header_version, bool is_ip4, u8 protocol, u16 port, char *client_pathname)
static void vl_api_proxy_arp_intfc_enable_disable_t_handler(vl_api_proxy_arp_intfc_enable_disable_t *mp)
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)
int mpls_sw_interface_enable_disable(mpls_main_t *mm, u32 sw_if_index, u8 is_enable, u8 is_api)
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)
void wc_arp_set_publisher_node(uword node_index, uword event_type)
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)
char * vnet_punt_get_server_pathname(void)
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.
#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)
clib_error_t * vnet_punt_socket_del(vlib_main_t *vm, bool is_ip4, u8 l4_protocol, u16 port)
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)
Punt traffic to the host via socket.
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
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.
static void * vlib_process_get_event_data(vlib_main_t *vm, uword *return_event_type_opaque)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword wc_arp_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
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)
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
clib_error_t * vnet_punt_add_del(vlib_main_t *vm, u8 ipv, u8 protocol, u16 port, bool is_add)
Request IP traffic punt to the local TCP/IP stack.
Interface set vpath request.
char * vpe_api_get_build_date(void)
u8 * is_mp_safe
Message is mp safe vector.
#define VLIB_REGISTER_NODE(x,...)
ip4_main_t ip4_main
Global ip4 main structure.
static void vlib_process_put_event_data(vlib_main_t *vm, void *event_data)
static u32 eth_mac_equal(u8 *mac1, u8 *mac2)
static void vl_api_input_acl_set_interface_t_handler(vl_api_input_acl_set_interface_t *mp)
#define clib_error_return_code(e, code, flags, args...)
static int ip4_reset_fib_t_handler(vl_api_reset_fib_t *mp)
Register for ip4 arp resolution events.
struct fib_table_t_ * fibs
Vector of FIBs.
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)
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.