24 #include <vpp/app/version.h> 43 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 49 #define vl_api_version(n,v) static u32 api_version=(v); 59 #define REPLY_MSG_ID_BASE am->msg_id_base 64 #define foreach_acl_plugin_api_msg \ 65 _(ACL_PLUGIN_GET_VERSION, acl_plugin_get_version) \ 66 _(ACL_PLUGIN_CONTROL_PING, acl_plugin_control_ping) \ 67 _(ACL_ADD_REPLACE, acl_add_replace) \ 69 _(ACL_INTERFACE_ADD_DEL, acl_interface_add_del) \ 70 _(ACL_INTERFACE_SET_ACL_LIST, acl_interface_set_acl_list) \ 71 _(ACL_DUMP, acl_dump) \ 72 _(ACL_INTERFACE_LIST_DUMP, acl_interface_list_dump) \ 73 _(MACIP_ACL_ADD, macip_acl_add) \ 74 _(MACIP_ACL_ADD_REPLACE, macip_acl_add_replace) \ 75 _(MACIP_ACL_DEL, macip_acl_del) \ 76 _(MACIP_ACL_INTERFACE_ADD_DEL, macip_acl_interface_add_del) \ 77 _(MACIP_ACL_DUMP, macip_acl_dump) \ 78 _(MACIP_ACL_INTERFACE_GET, macip_acl_interface_get) \ 79 _(MACIP_ACL_INTERFACE_LIST_DUMP, macip_acl_interface_list_dump) \ 80 _(ACL_INTERFACE_SET_ETYPE_WHITELIST, acl_interface_set_etype_whitelist) \ 81 _(ACL_INTERFACE_ETYPE_WHITELIST_DUMP, acl_interface_etype_whitelist_dump) 86 .version = VPP_BUILD_VER,
87 .description =
"Access Control Lists",
96 char *fmt = va_arg (*va,
char *);
98 for (i = 0; i <
vec_len (v); i++)
102 s =
format (s, fmt, v[i]);
128 u64 per_worker_slack = 1000000LL;
129 u64 per_worker_size =
132 u64 per_worker_size_with_slack = per_worker_slack + per_worker_size;
133 u64 main_slack = 2000000LL;
137 per_worker_size_with_slack * tm->
n_vlib_mains + bihash_size +
143 clib_warning (
"ACL heap size requested: %lld, max possible %lld",
150 (
"ACL plugin failed to allocate main heap of %U bytes, abort",
205 int msg_size =
sizeof (*rmp);
213 memset (rmp, 0, msg_size);
215 ntohs (VL_API_ACL_PLUGIN_GET_VERSION_REPLY + am->
msg_id_base);
234 rmp->
vpe_pid = ntohl (getpid ());
260 u8 *out0 =
format (0,
"acl-index %u count %u tag {%s}\n", acl_index,
264 for (j = 0; j < am->
acls[acl_index].
count; j++)
267 out0 =
format (out0,
" %4d: %s ", j, r->
is_ipv6 ?
"ipv6" :
"ipv4");
292 out0 =
format (out0,
"\n");
313 u32 **ppolicy_epoch_by_swi =
329 if (acl_num <
vec_len (*p_swi_vec_by_acl))
351 u32 * acl_list_index,
u8 * tag)
360 clib_warning (
"API dbg: acl_add_list index %d tag %s", *acl_list_index,
363 if (*acl_list_index != ~0)
370 (
"acl-plugin-error: Trying to replace nonexistent ACL %d (tag %s)",
371 *acl_list_index, tag);
372 return VNET_API_ERROR_NO_SUCH_ENTRY;
378 (
"acl-plugin-warning: supplied no rules for ACL %d (tag %s)",
379 *acl_list_index, tag);
388 for (i = 0; i <
count; i++)
391 memset (r, 0,
sizeof (*r));
415 if (~0 == *acl_list_index)
419 memset (a, 0,
sizeof (*a));
421 *acl_list_index = a - am->
acls;
425 a = am->
acls + *acl_list_index;
430 a->
rules = acl_new_rules;
432 memcpy (a->
tag, tag, sizeof (a->
tag));
450 if (acl_index <
vec_len (foo_index_vec_by_acl))
468 return VNET_API_ERROR_NO_SUCH_ENTRY;
471 return VNET_API_ERROR_ACL_IN_USE_INBOUND;
473 return VNET_API_ERROR_ACL_IN_USE_OUTBOUND;
476 return VNET_API_ERROR_ACL_IN_USE_BY_LOOKUP_CONTEXT;
499 _(
" dmac smac etype ")
500 _(ether) __ __ __ __ __ __
v __ __ __ __ __ __
v __ __
v 507 _(" ttl pr checksum ")
516 _("L4 T/U sport dport ")
527 _(" dmac smac etype ")
528 _(ether) __ __ __ __ __ __
v __ __ __ __ __ __
v __ __
v 530 _(0x0000) __ __ __ __
532 _(0x0004) __ __
XX __
543 _("L4T/U sport dport ")
544 _(tcpudp)
XX XX XX XX _(padpad) __ __ __ __ _(padeth) __ __;
547 _(" dmac smac dot1q etype ")
548 _(ether) __ __ __ __ __ __
v __ __ __ __ __ __
v XX XX __ __
v XX XX v 549 _(padpad) __ __ __ __
550 _(padpad) __ __ __ __
551 _(padpad) __ __ __ __
555 _(" dmac smac dot1ad dot1q etype ")
556 _(ether) __ __ __ __ __ __
v __ __ __ __ __ __
v XX XX __ __
XX XX __ __
v XX XX v 557 _(padpad) __ __ __ __
558 _(padpad) __ __ __ __
562 _(" dmac smac etype ")
563 _(ether) __ __ __ __ __ __
v __ __ __ __ __ __
v XX XX __ __;
579 while ((0ULL == *p64) && ((
u8 *) p64 - p) <
size)
583 return (p64 - (
u64 *) p) / 2;
588 u32 mask_len,
u32 next_table_index,
589 u32 miss_next_index,
u32 * table_index,
595 u32 match = (mask_len / 16) - skip;
596 u8 *skip_mask_ptr = mask + 16 * skip;
597 u32 current_data_flag = 0;
598 int current_data_offset = 0;
604 memory_size, skip, match,
605 next_table_index, miss_next_index,
606 table_index, current_data_flag,
607 current_data_offset, is_add,
615 u32 mask_len,
u32 next_table_index,
616 u32 miss_next_index,
u32 * table_index,
622 u32 match = (mask_len / 16) - skip;
623 u8 *skip_mask_ptr = mask + 16 * skip;
624 u32 current_data_flag = 0;
625 int current_data_offset = 0;
632 memory_size, skip, match,
633 next_table_index, miss_next_index,
634 table_index, current_data_flag,
635 current_data_offset, is_add,
645 u32 ip4_table_index = ~0;
646 u32 ip6_table_index = ~0;
647 u32 dot1q_table_index = ~0;
648 u32 dot1ad_table_index = ~0;
649 u32 etype_table_index = ~0;
673 sizeof (ip4_5tuple_mask) - 1, ~0,
675 &ip4_table_index, 0);
685 &ip6_table_index, 0);
694 ~0, &dot1q_table_index, 0);
703 ~0, &dot1ad_table_index, 0);
712 ~0, &etype_table_index, 0);
722 u32 ip4_table_index = ~0;
723 u32 ip6_table_index = ~0;
724 u32 dot1q_table_index = ~0;
725 u32 dot1ad_table_index = ~0;
726 u32 etype_table_index = ~0;
751 sizeof (ip4_5tuple_mask) - 1, ~0,
753 &ip4_table_index, 0);
763 &ip6_table_index, 0);
772 ~0, &dot1q_table_index, 0);
781 ~0, &dot1ad_table_index, 0);
790 ~0, &etype_table_index, 0);
798 u8 is_dot1ad,
u8 is_ip6)
819 idx = (is_dot1ad) ? 20 : 16;
840 match[idx + 1] = 0xdd;
846 match[idx + 1] = 0x00;
850 session_idx, 0, 0, 0, 1);
853 match[idx + 1] = 0xff;
874 u32 etype_table_index)
886 for (i = 0; i <
vec_len (whitelist); i++)
889 match[12] = (whitelist[
i] >> 8) & 0xff;
890 match[13] = whitelist[
i] & 0xff;
893 whitelist[i], 0, 0, 0, 1);
906 u32 ip4_table_index = ~0;
907 u32 ip6_table_index = ~0;
908 u32 dot1q_table_index = ~0;
909 u32 dot1ad_table_index = ~0;
910 u32 etype_table_index = ~0;
919 sizeof (ip4_5tuple_mask) - 1, ~0,
921 &ip4_table_index, 1);
929 &ip6_table_index, 1);
933 sizeof (ip4_5tuple_mask) - 1, ~0,
935 &ip4_table_index, 0);
942 &etype_table_index, 1);
949 etype_table_index, ~0,
950 &dot1ad_table_index, 1);
954 dot1ad_table_index, ~0,
955 &dot1q_table_index, 1);
960 ~0, &dot1ad_table_index, 0);
964 &ip6_table_index, 0);
966 sizeof (ip4_5tuple_mask) - 1, ~0,
968 &ip4_table_index, 0);
974 ip6_table_index, dot1q_table_index);
979 sizeof (ip4_5tuple_mask) - 1, ~0,
981 &ip4_table_index, 0);
985 &ip6_table_index, 0);
988 ~0, &dot1q_table_index, 0);
991 ~0, &dot1ad_table_index, 0);
1024 u32 ip4_table_index = ~0;
1025 u32 ip6_table_index = ~0;
1026 u32 dot1q_table_index = ~0;
1027 u32 dot1ad_table_index = ~0;
1028 u32 etype_table_index = ~0;
1037 sizeof (ip4_5tuple_mask) - 1, ~0,
1039 &ip4_table_index, 1);
1046 &ip6_table_index, 1);
1050 sizeof (ip4_5tuple_mask) - 1, ~0,
1052 &ip4_table_index, 0);
1059 &etype_table_index, 1);
1067 etype_table_index, ~0,
1068 &dot1ad_table_index, 1);
1072 dot1ad_table_index, ~0,
1073 &dot1q_table_index, 1);
1078 ~0, &dot1ad_table_index, 0);
1082 &ip6_table_index, 0);
1084 sizeof (ip4_5tuple_mask) - 1, ~0,
1086 &ip4_table_index, 0);
1092 ip6_table_index, dot1q_table_index);
1103 &ip6_table_index, 0);
1105 sizeof (ip4_5tuple_mask) - 1, ~0,
1107 &ip4_table_index, 0);
1110 ~0, &dot1q_table_index, 0);
1113 ~0, &dot1ad_table_index, 0);
1160 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
1192 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
1217 int is_input,
int enable_disable)
1233 u8 is_input,
u32 * vec_acl_list_index,
1234 int *may_clear_sessions)
1237 uword *seen_acl_bitmap = 0;
1238 uword *old_seen_acl_bitmap = 0;
1239 uword *change_acl_bitmap = 0;
1246 (
"API dbg: acl_interface_set_inout_acl_list: sw_if_index %d is_input %d acl_vec: [%U]",
1247 sw_if_index, is_input,
format_vec32, vec_acl_list_index,
"%d");
1255 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
1261 clib_warning (
"ERROR: ACL %d being applied twice", *pacln);
1262 rv = VNET_API_ERROR_ENTRY_ALREADY_EXISTS;
1269 u32 **pinout_lc_index_by_sw_if_index =
1273 u32 ***pinout_acl_vec_by_sw_if_index =
1277 u32 ***pinout_sw_if_index_vec_by_acl =
1281 vec_validate ((*pinout_acl_vec_by_sw_if_index), sw_if_index);
1285 vec_foreach (pacln, (*pinout_acl_vec_by_sw_if_index)[sw_if_index])
1287 old_seen_acl_bitmap =
clib_bitmap_set (old_seen_acl_bitmap, *pacln, 1);
1293 clib_warning (
"bitmaps: old seen %U new seen %U changed %U",
1301 if (acln <
vec_len((*pinout_sw_if_index_vec_by_acl))) {
1302 int index =
vec_search((*pinout_sw_if_index_vec_by_acl)[acln], sw_if_index);
1303 vec_del1((*pinout_sw_if_index_vec_by_acl)[acln], index);
1308 vec_add1((*pinout_sw_if_index_vec_by_acl)[acln], sw_if_index);
1313 vec_free ((*pinout_acl_vec_by_sw_if_index)[sw_if_index]);
1314 (*pinout_acl_vec_by_sw_if_index)[sw_if_index] =
1325 if (may_clear_sessions && *may_clear_sessions
1329 *may_clear_sessions = 0;
1338 if (
vec_len (vec_acl_list_index) > 0)
1340 u32 lc_index = (*pinout_lc_index_by_sw_if_index)[sw_if_index];
1349 sw_if_index, is_input);
1350 (*pinout_lc_index_by_sw_if_index)[sw_if_index] = lc_index;
1356 if (~0 != (*pinout_lc_index_by_sw_if_index)[sw_if_index])
1359 (*pinout_lc_index_by_sw_if_index)[sw_if_index] = ~0;
1365 vec_len (vec_acl_list_index) > 0);
1376 int *may_clear_sessions)
1381 may_clear_sessions);
1392 int may_clear_sessions = 1;
1394 int error_already_applied = is_input ? VNET_API_ERROR_ACL_IN_USE_INBOUND
1395 : VNET_API_ERROR_ACL_IN_USE_OUTBOUND;
1397 u32 ***pinout_acl_vec_by_sw_if_index =
1405 vec_validate ((*pinout_acl_vec_by_sw_if_index), sw_if_index);
1406 u32 index =
vec_search ((*pinout_acl_vec_by_sw_if_index)[sw_if_index],
1411 rv = error_already_applied;
1415 acl_vec =
vec_dup ((*pinout_acl_vec_by_sw_if_index)[sw_if_index]);
1416 vec_add1 (acl_vec, acl_list_index);
1420 if (sw_if_index >
vec_len (*pinout_acl_vec_by_sw_if_index))
1422 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
1426 u32 index =
vec_search ((*pinout_acl_vec_by_sw_if_index)[sw_if_index],
1431 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
1435 acl_vec =
vec_dup ((*pinout_acl_vec_by_sw_if_index)[sw_if_index]);
1440 &may_clear_sessions);
1514 for (i = 0; i <
vec_len (mv); i++)
1516 if ((mv[i].prefix_len == prefix_len) && (mv[
i].
is_ipv6 == is_ipv6)
1517 && (0 == memcmp (mv[i].mac_mask, mac_mask, 6)))
1532 unsigned int mac_bits_set = 0;
1533 unsigned int mac_byte;
1535 for (i = 0; i < 6; i++)
1538 for (; mac_byte; mac_byte >>= 1)
1539 mac_bits_set += mac_byte & 1;
1589 return (is_permit == 3);
1599 u32 match_type_index;
1606 for (i = 0; i < a->
count; i++)
1614 match_type_index =
vec_len (mvec);
1616 memcpy (mvec[match_type_index].mac_mask,
1634 mvec[match_type_index].
count++;
1642 out_last_table = ~0;
1649 u32 *last_tag_table;
1650 u32 *out_last_tag_table;
1682 for (tags = 2; tags >= 0; tags--)
1684 memset (mask, 0,
sizeof (mask));
1686 memcpy (&mask[6], mt->
mac_mask, 6);
1692 memset (&mask[12], 0xff, 2);
1697 memset (&mask[12], 0xff, 2);
1698 memset (&mask[16], 0xff, 2);
1703 memset (&mask[12], 0xff, 2);
1704 memset (&mask[16], 0xff, 2);
1705 memset (&mask[20], 0xff, 2);
1712 memcpy (&mask[l3_offset + 8], mt->
mac_mask, 6);
1715 mask[l3_offset + 14 + i] = 0xff;
1717 mask[l3_offset + 14 + (mt->
prefix_len / 8)] =
1718 0xff - ((1 << (8 - mt->
prefix_len % 8)) - 1);
1720 mask_len = ((l3_offset + 14 + ((mt->
prefix_len + 7) / 8) +
1724 (~0 == last_table) ? 0 : ~0,
1726 last_table = *last_tag_table;
1730 memset (mask, 0,
sizeof (mask));
1736 memset (&mask[12], 0xff, 2);
1741 memset (&mask[12], 0xff, 2);
1742 memset (&mask[16], 0xff, 2);
1747 memset (&mask[12], 0xff, 2);
1748 memset (&mask[16], 0xff, 2);
1749 memset (&mask[20], 0xff, 2);
1757 mask_len = ((l3_offset +
1763 out_last_table) ? 0 : ~0,
1764 out_last_tag_table, 1);
1765 out_last_table = *out_last_tag_table;
1778 u32 *last_tag_table;
1779 u32 *out_last_tag_table;
1784 for (tags = 2; tags >= 0; tags--)
1786 memset (mask, 0,
sizeof (mask));
1787 memcpy (&mask[6], mt->
mac_mask, 6);
1793 memset (&mask[12], 0xff, 2);
1797 memset (&mask[12], 0xff, 2);
1798 memset (&mask[16], 0xff, 2);
1802 memset (&mask[12], 0xff, 2);
1803 memset (&mask[16], 0xff, 2);
1804 memset (&mask[20], 0xff, 2);
1810 mask[l3_src_offs +
i] = 0xff;
1815 0xff - ((1 << (8 - mt->
prefix_len % 8)) - 1);
1821 mask_len = ((l3_src_offs + ((mt->
prefix_len + 7) / 8) +
1824 (~0 == last_table) ? 0 : ~0,
1826 last_table = *last_tag_table;
1830 for (tags = 2; tags >= 0; tags--)
1832 memset (mask, 0,
sizeof (mask));
1834 memcpy (&mask[0], mt->
mac_mask, 6);
1840 memset (&mask[12], 0xff, 2);
1844 memset (&mask[12], 0xff, 2);
1845 memset (&mask[16], 0xff, 2);
1849 memset (&mask[12], 0xff, 2);
1850 memset (&mask[16], 0xff, 2);
1851 memset (&mask[20], 0xff, 2);
1857 mask[l3_dst_offs +
i] = 0xff;
1862 0xff - ((1 << (8 - mt->
prefix_len % 8)) - 1);
1868 mask_len = ((l3_dst_offs + ((mt->
prefix_len + 7) / 8) +
1873 (~0 == out_last_table) ? 0 : ~0,
1874 out_last_tag_table, 1);
1875 out_last_table = *out_last_tag_table;
1888 for (i = 0; i < a->
count; i++)
1902 ASSERT (match_type_index != ~0);
1904 for (tags = 2; tags >= 0; tags--)
1906 memset (mask, 0,
sizeof (mask));
1935 mask[eth + 1] = 0xdd;
1941 mask[eth + 1] = 0x00;
1947 i, 0, action, metadata, 1);
1948 memset (&mask[12], 0,
sizeof (mask) - 12);
1952 if (!is6 && (mvec[match_type_index].arp_table_index != ~0))
1954 memset (mask, 0,
sizeof (mask));
1957 for (tags = 2; tags >= 0; tags--)
1988 memcpy (&mask[l3_src_offs + 8], a->
rules[i].
src_mac, 6);
1993 i, 0, action, metadata, 1);
1999 for (tags = 2; tags >= 0; tags--)
2001 memset (mask, 0,
sizeof (mask));
2032 mask[eth + 1] = 0xdd;
2039 mask[eth + 1] = 0x00;
2046 i, 0, action, metadata, 1);
2051 if (!is6 && (mvec[match_type_index].out_arp_table_index != ~0))
2053 for (tags = 2; tags >= 0; tags--)
2055 memset (mask, 0,
sizeof (mask));
2087 rules[i].is_permit ? ~0 : 0,
2088 i, 0, action, metadata, 1);
2169 u32 * acl_list_index,
u8 * tag)
2178 if (*acl_list_index != ~0)
2185 (
"acl-plugin-error: Trying to replace nonexistent MACIP ACL %d (tag %s)",
2186 *acl_list_index, tag);
2187 return VNET_API_ERROR_NO_SUCH_ENTRY;
2194 (
"acl-plugin-warning: Trying to create empty MACIP ACL (tag %s)",
2198 if (~0 != *acl_list_index)
2205 for (i = 0; i <
count; i++)
2207 r = &acl_new_rules[
i];
2212 if (rules[i].is_ipv6)
2219 if (~0 == *acl_list_index)
2223 memset (a, 0,
sizeof (*a));
2237 a->
rules = acl_new_rules;
2239 memcpy (a->
tag, tag, sizeof (a->
tag));
2261 u32 macip_acl_index;
2266 return VNET_API_ERROR_NO_SUCH_ENTRY;
2270 if (~0 == macip_acl_index)
2271 return VNET_API_ERROR_NO_SUCH_ENTRY;
2296 u32 macip_acl_index)
2302 return VNET_API_ERROR_NO_SUCH_ENTRY;
2334 return VNET_API_ERROR_NO_SUCH_ENTRY;
2399 if (supplied_len < expected_len)
2401 clib_warning (
"%s: Supplied message length %d is less than expected %d",
2402 where, supplied_len, expected_len);
2420 u32 expected_len =
sizeof (*mp) + acl_count *
sizeof (mp->
r[0]);
2428 rv = VNET_API_ERROR_INVALID_VALUE;
2443 vl_api_acl_del_reply_t *rmp;
2457 vl_api_acl_interface_add_del_reply_t *rmp;
2461 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
2475 vl_api_acl_interface_set_acl_list_reply_t *rmp;
2482 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
2485 int may_clear_sessions = 1;
2486 for (i = 0; i < mp->
count; i++)
2491 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
2498 u32 *in_acl_vec = 0;
2499 u32 *out_acl_vec = 0;
2500 for (i = 0; i < mp->
count; i++)
2501 if (i < mp->n_input)
2502 vec_add1 (in_acl_vec, clib_net_to_host_u32 (mp->
acls[i]));
2504 vec_add1 (out_acl_vec, clib_net_to_host_u32 (mp->
acls[i]));
2508 &may_clear_sessions);
2512 &may_clear_sessions);
2519 REPLY_MACRO (VL_API_ACL_INTERFACE_SET_ACL_LIST_REPLY);
2555 int msg_size =
sizeof (*mp) +
sizeof (mp->
r[0]) * acl->
count;
2559 memset (mp, 0, msg_size);
2560 mp->_vl_msg_id = ntohs (VL_API_ACL_DETAILS + am->
msg_id_base);
2566 memcpy (mp->
tag, acl->
tag, sizeof (mp->
tag));
2569 for (i = 0; i < acl->
count; i++)
2598 send_acl_details(am, reg, acl, mp->context);
2622 u32 sw_if_index,
u32 context)
2639 count = n_input + n_output;
2641 msg_size =
sizeof (*mp);
2642 msg_size +=
sizeof (mp->
acls[0]) * count;
2645 memset (mp, 0, msg_size);
2647 ntohs (VL_API_ACL_INTERFACE_LIST_DETAILS + am->
msg_id_base);
2654 for (i = 0; i < n_input; i++)
2658 for (i = 0; i < n_output; i++)
2660 mp->
acls[n_input +
i] =
2686 send_acl_interface_list_details(am, reg, swif->sw_if_index, mp->context);
2706 u32 acl_list_index = ~0;
2708 u32 expected_len =
sizeof (*mp) + acl_count *
sizeof (mp->
r[0]);
2716 rv = VNET_API_ERROR_INVALID_VALUE;
2735 u32 expected_len =
sizeof (*mp) + acl_count *
sizeof (mp->
r[0]);
2743 rv = VNET_API_ERROR_INVALID_VALUE;
2758 vl_api_macip_acl_del_reply_t *rmp;
2771 vl_api_macip_acl_interface_add_del_reply_t *rmp;
2777 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
2783 REPLY_MACRO (VL_API_MACIP_ACL_INTERFACE_ADD_DEL_REPLY);
2794 int msg_size =
sizeof (*mp) + (acl ?
sizeof (mp->
r[0]) * acl->
count : 0);
2797 memset (mp, 0, msg_size);
2798 mp->_vl_msg_id = ntohs (VL_API_MACIP_ACL_DETAILS + am->
msg_id_base);
2804 memcpy (mp->
tag, acl->
tag, sizeof (mp->
tag));
2808 for (i = 0; i < acl->
count; i++)
2817 memcpy (rules[i].src_ip_addr, &r->
src_ip_addr.ip6,
2820 memcpy (rules[i].src_ip_addr, &r->
src_ip_addr.ip4,
2853 send_macip_acl_details (am, reg,
2878 int msg_size =
sizeof (*rmp) +
sizeof (rmp->
acls[0]) * count;
2887 memset (rmp, 0, msg_size);
2889 ntohs (VL_API_MACIP_ACL_INTERFACE_GET_REPLY + am->
msg_id_base);
2891 rmp->
count = htonl (count);
2892 for (i = 0; i <
count; i++)
2904 u32 acl_index,
u32 context)
2908 int msg_size =
sizeof (*rmp) +
sizeof (rmp->
acls[0]);
2911 memset (rmp, 0, msg_size);
2913 ntohs (VL_API_MACIP_ACL_INTERFACE_LIST_DETAILS + am->
msg_id_base);
2919 rmp->
acls[0] = htonl (acl_index);
2936 if (sw_if_index == ~0)
2965 vl_api_acl_interface_set_etype_whitelist_reply_t *rmp;
2970 u16 *vec_in = 0, *vec_out = 0;
2974 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
2977 for (i = 0; i < mp->
count; i++)
2979 if (i < mp->n_input)
2988 REPLY_MACRO (VL_API_ACL_INTERFACE_SET_ETYPE_WHITELIST_REPLY);
2994 u32 sw_if_index,
u32 context)
3003 u16 *whitelist_in = 0;
3004 u16 *whitelist_out = 0;
3014 if ((0 == whitelist_in) && (0 == whitelist_out))
3019 n_input =
vec_len (whitelist_in);
3020 n_output =
vec_len (whitelist_out);
3021 count = n_input + n_output;
3023 msg_size =
sizeof (*mp);
3024 msg_size +=
sizeof (mp->
whitelist[0]) * count;
3027 memset (mp, 0, msg_size);
3029 ntohs (VL_API_ACL_INTERFACE_ETYPE_WHITELIST_DETAILS + am->
msg_id_base);
3036 for (i = 0; i < n_input; i++)
3040 for (i = 0; i < n_output; i++)
3042 mp->
whitelist[n_input +
i] = htons (whitelist_out[i]);
3069 send_acl_interface_etype_whitelist_details(am, reg, swif->sw_if_index, mp->context);
3090 vl_msg_api_set_handlers((VL_API_##N + am->msg_id_base), \ 3092 vl_api_##n##_t_handler, \ 3094 vl_api_##n##_t_endian, \ 3095 vl_api_##n##_t_print, \ 3096 sizeof(vl_api_##n##_t), 1); 3103 #define vl_msg_name_crc_list 3105 #undef vl_msg_name_crc_list 3110 #define _(id,n,crc) \ 3111 vl_msg_api_add_msg_name_crc (apim, #n "_" #crc, id + am->msg_id_base); 3112 foreach_vl_msg_name_crc_acl;
3172 clib_warning (
"Unknown timeout type %d", timeout_type);
3191 if ((eh < 256) && (value < 2))
3213 int may_clear_sessions = 1;
3240 if (
unformat (input,
"skip-ipv6-extension-header %u %u", &eh_val, &val))
3248 if (
unformat (input,
"use-hash-acl-matching %u", &val))
3253 if (
unformat (input,
"l4-match-nonfirst-fragment %u", &val))
3258 if (
unformat (input,
"reclassify-sessions %u", &val))
3263 if (
unformat (input,
"event-trace"))
3268 "expecting trace level, got `%U`",
3282 if (
unformat (input,
"validate %u", &val))
3284 else if (
unformat (input,
"trace %u", &val))
3290 if (
unformat (input,
"validate %u", &val))
3292 else if (
unformat (input,
"trace %u", &val))
3303 if (
unformat (input,
"max-entries"))
3308 "expecting maximum number of entries, got `%U`",
3318 if (
unformat (input,
"hash-table-buckets"))
3323 "expecting maximum number of hash table buckets, got `%U`",
3333 if (
unformat (input,
"hash-table-memory"))
3338 "expecting maximum amount of hash table memory, got `%U`",
3348 if (
unformat (input,
"event-trace"))
3353 "expecting trace level, got `%U`",
3371 if (!
unformat (input,
"%u", &timeout))
3374 "expecting timeout value in seconds, got `%U`",
3390 if (!
unformat (input,
"%u", &timeout))
3393 "expecting timeout value in seconds, got `%U`",
3406 if (!
unformat (input,
"%u", &timeout))
3409 "expecting timeout value in seconds, got `%U`",
3432 u8 *
a = va_arg (*args,
u8 *);
3433 return format (s,
"%02x:%02x:%02x:%02x:%02x:%02x",
3434 a[0], a[1], a[2], a[3], a[4], a[5]);
3442 out =
format (out,
"%s action %d ip %U/%d mac %U mask %U",
3466 "MACIP acl_index: %d, count: %d (true len %d) tag {%s} is free pool slot: %d\n",
3470 " ip4_table_index %d, ip6_table_index %d, l2_table_index %d\n",
3473 " out_ip4_table_index %d, out_ip6_table_index %d, out_l2_table_index %d\n",
3493 (void)
unformat (input,
"index %u", &acl_index);
3501 if ((acl_index != ~0) && (acl_index !=
i))
3548 if ((acl_index != ~0) && (acl_index !=
i))
3582 (void)
unformat (input,
"index %u", &acl_index);
3596 (void)
unformat (input,
"index %u", &lc_index);
3610 (void)
unformat (input,
"index %u", &lc_index);
3628 if ((sw_if_index != ~0) && (sw_if_index != swi))
3707 u64 five_tuple[6] = { 0, 0, 0, 0, 0, 0 };
3710 (input,
"%llx %llx %llx %llx %llx %llx", &five_tuple[0], &five_tuple[1],
3711 &five_tuple[2], &five_tuple[3], &five_tuple[4], &five_tuple[5]))
3728 u32 sw_if_index = ~0;
3729 (void)
unformat (input,
"sw_if_index %u", &sw_if_index);
3730 int show_acl =
unformat (input,
"acl");
3731 int detail =
unformat (input,
"detail");
3768 u32 show_session_thread_id,
3769 u32 show_session_session_index)
3779 vlib_cli_output (vm,
"Sessions total: add %lu - del %lu = %lu", n_adds,
3780 n_dels, n_adds - n_dels);
3787 if (show_session_thread_id == wk
3791 show_session_session_index);
3796 " info: %016llx %016llx %016llx %016llx %016llx %016llx",
3797 m[0], m[1], m[2], m[3], m[4], m[5]);
3820 (pw->fa_session_adds_by_sw_if_index)
3822 pw->fa_session_adds_by_sw_if_index
3827 (pw->fa_session_dels_by_sw_if_index)
3829 pw->fa_session_dels_by_sw_if_index
3831 u64 n_epoch_changes =
3834 (pw->fa_session_epoch_change_by_sw_if_index)
3836 pw->fa_session_epoch_change_by_sw_if_index
3838 vlib_cli_output (vm,
3839 " sw_if_index %d: add %lu - del %lu = %lu; epoch chg: %lu",
3855 head_session_index);
3856 if (~0 != head_session_index)
3895 #define _(cnt, desc) vlib_cli_output(vm, " %20lu: %s", am->cnt, desc); 3901 "Sessions per interval: min %lu max %lu increment: %f ms current: %f ms",
3918 u32 show_bihash_verbose = 0;
3919 u32 show_session_thread_id = ~0;
3920 u32 show_session_session_index = ~0;
3921 (void)
unformat (input,
"thread %u index %u", &show_session_thread_id,
3922 &show_session_session_index);
3923 (void)
unformat (input,
"verbose %u", &show_bihash_verbose);
3926 show_session_session_index);
3940 int show_acl_hash_info = 0;
3941 int show_applied_info = 0;
3942 int show_mask_type = 0;
3943 int show_bihash = 0;
3944 u32 show_bihash_verbose = 0;
3948 show_acl_hash_info = 1;
3951 unformat (input,
"index %u", &acl_index);
3953 else if (
unformat (input,
"applied"))
3955 show_applied_info = 1;
3956 unformat (input,
"lc_index %u", &lc_index);
3965 unformat (input,
"verbose %u", &show_bihash_verbose);
3969 (show_mask_type || show_acl_hash_info || show_applied_info
3974 show_acl_hash_info = 1;
3975 show_applied_info = 1;
3980 if (show_acl_hash_info)
3982 if (show_applied_info)
4003 .path =
"set acl-plugin",
4004 .short_help =
"set acl-plugin session timeout {{udp idle}|tcp {idle|transient}} <seconds>",
4009 .path =
"show acl-plugin acl",
4010 .short_help =
"show acl-plugin acl [index N]",
4015 .path =
"show acl-plugin lookup context",
4016 .short_help =
"show acl-plugin lookup context [index N]",
4021 .path =
"show acl-plugin lookup user",
4022 .short_help =
"show acl-plugin lookup user [index N]",
4027 .path =
"show acl-plugin decode 5tuple",
4028 .short_help =
"show acl-plugin decode 5tuple XXXX XXXX XXXX XXXX XXXX XXXX",
4033 .path =
"show acl-plugin interface",
4034 .short_help =
"show acl-plugin interface [sw_if_index N] [acl]",
4039 .path =
"show acl-plugin memory",
4040 .short_help =
"show acl-plugin memory",
4045 .path =
"show acl-plugin sessions",
4046 .short_help =
"show acl-plugin sessions",
4051 .path =
"show acl-plugin tables",
4052 .short_help =
"show acl-plugin tables [ acl [index N] | applied [ lc_index N ] | mask | hash [verbose N] ]",
4057 .path =
"show acl-plugin macip acl",
4058 .short_help =
"show acl-plugin macip acl [index N]",
4063 .path =
"show acl-plugin macip interface",
4064 .short_help =
"show acl-plugin macip interface",
4069 .path =
"clear acl-plugin sessions",
4070 .short_help =
"clear acl-plugin sessions",
4079 u32 conn_table_hash_buckets;
4080 u32 conn_table_hash_memory_size;
4081 u32 conn_table_max_entries;
4082 uword main_heap_size;
4083 uword hash_heap_size;
4084 u32 hash_lookup_hash_buckets;
4085 u32 hash_lookup_hash_memory;
4086 u32 reclassify_sessions;
4091 (input,
"connection hash buckets %d", &conn_table_hash_buckets))
4093 else if (
unformat (input,
"connection hash memory %d",
4094 &conn_table_hash_memory_size))
4096 else if (
unformat (input,
"connection count max %d",
4097 &conn_table_max_entries))
4109 else if (
unformat (input,
"hash lookup hash buckets %d",
4110 &hash_lookup_hash_buckets))
4112 else if (
unformat (input,
"hash lookup hash memory %d",
4113 &hash_lookup_hash_memory))
4115 else if (
unformat (input,
"reclassify sessions %d",
4116 &reclassify_sessions))
4133 memset (am, 0,
sizeof (*am));
4137 u8 *name =
format (0,
"acl_%08x%c", api_version, 0);
4196 am->fa_cleaner_cnt_delete_by_sw_index = 0;
4197 am->fa_cleaner_cnt_delete_by_sw_index_ok = 0;
4198 am->fa_cleaner_cnt_unknown_event = 0;
4199 am->fa_cleaner_cnt_timer_restarted = 0;
4200 am->fa_cleaner_cnt_wait_with_timeout = 0;
4203 #define _(N, v, s) am->fa_ipv6_known_eh_bitmap = clib_bitmap_set(am->fa_ipv6_known_eh_bitmap, v, 1);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u32 * input_policy_epoch_by_sw_if_index
u8 * format_vec16(u8 *s, va_list *va)
u32 * acl_ip4_output_classify_table_by_sw_if_index
static int macip_acl_interface_add_acl(acl_main_t *am, u32 sw_if_index, u32 macip_acl_index)
u32 fa_cleaner_node_index
u32 session_timeout_sec[ACL_N_TIMEOUTS]
static u8 * format_bitmap_hex(u8 *s, va_list *args)
Format a bitmap as a string of hex bytes.
Use acl_interface_set_acl_list instead Append/remove an ACL index to/from the list of ACLs checked fo...
#define vec_foreach_index(var, v)
Iterate over vector indices.
u32 fa_acl_in_ip4_l2_node_feat_next_node_index[32]
static int macip_acl_interface_add_del_acl(u32 sw_if_index, u8 is_add, u32 acl_list_index)
static clib_error_t * acl_clear_aclplugin_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static int acl_set_skip_ipv6_eh(u32 eh, u32 value)
static int acl_hook_l2_output_classify(acl_main_t *am, u32 sw_if_index)
static clib_error_t * acl_show_aclplugin_lookup_user_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static int verify_message_len(void *mp, u32 expected_len, char *where)
static int acl_classify_add_del_table_tiny(vnet_classify_main_t *cm, u8 *mask, u32 mask_len, u32 next_table_index, u32 miss_next_index, u32 *table_index, int is_add)
#define UDP_SESSION_IDLE_TIMEOUT_SEC
u32 * acl_dot1ad_input_classify_table_by_sw_if_index
static clib_error_t * acl_init(vlib_main_t *vm)
static void acl_setup_fa_nodes(void)
void show_fa_sessions_hash(vlib_main_t *vm, u32 verbose)
char ** l2output_get_feat_names(void)
uword * pending_clear_sw_if_index_bitmap
void acl_plugin_show_tables_mask_type(void)
static void vl_api_acl_plugin_get_version_t_handler(vl_api_acl_plugin_get_version_t *mp)
u64 fa_current_cleaner_timer_wait_interval
Set the vector of input/output ACLs checked for an interface.
#define foreach_acl_plugin_api_msg
Set the ethertype whitelists on an interface.
u32 ** input_acl_vec_by_sw_if_index
void acl_plugin_hash_acl_set_trace_heap(int on)
void acl_plugin_show_tables_applied_info(u32 lc_index)
Dump the list(s) of ACL applied to specific or all interfaces.
union fa_session_t::@348 tcp_flags_seen
vnet_main_t * vnet_get_main(void)
vl_api_macip_acl_rule_t r[count]
static int count_skip(u8 *p, u32 size)
vnet_interface_main_t interface_main
static void vl_api_acl_add_replace_t_handler(vl_api_acl_add_replace_t *mp)
static void vl_api_macip_acl_dump_t_handler(vl_api_macip_acl_dump_t *mp)
#define clib_error(format, args...)
int l4_match_nonfirst_fragment
void * mheap_alloc(void *memory, uword size)
Control ping from the client to the server response.
#define ACL_FA_CONN_TABLE_DEFAULT_HASH_NUM_BUCKETS
#define ACL_PLUGIN_VERSION_MINOR
static clib_error_t * acl_plugin_config(vlib_main_t *vm, unformat_input_t *input)
#define ACL_PLUGIN_HASH_LOOKUP_HASH_MEMORY
#define REPLY_MACRO2(t, body)
static void vl_api_macip_acl_add_t_handler(vl_api_macip_acl_add_t *mp)
static void vl_api_acl_interface_etype_whitelist_dump_t_handler(vl_api_acl_interface_list_dump_t *mp)
Details about ethertype whitelist on a single interface.
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
u32 * acl_ip6_input_classify_table_by_sw_if_index
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static void acl_clear_sessions(acl_main_t *am, u32 sw_if_index)
void vnet_l2_input_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
static int get_l3_dst_offset(int is6)
static mheap_t * mheap_header(u8 *v)
u32 * acl_etype_output_classify_table_by_sw_if_index
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
u64 session_timeout[ACL_N_TIMEOUTS]
fa_session_t * fa_sessions_pool
u32 * output_policy_epoch_by_sw_if_index
u32 out_dot1q_table_index
u32 l2_input_classify_next_acl_ip4
void(* acl_vector_print_func_t)(vlib_main_t *vm, u8 *out0)
u16 dstport_or_icmpcode_last
#define MHEAP_FLAG_THREAD_SAFE
void * vl_msg_api_alloc(int nbytes)
#define pool_len(p)
Number of elements in pool vector.
u8 * format_mheap(u8 *s, va_list *va)
static u32 macip_find_match_type(macip_match_type_t *mv, u8 *mac_mask, u8 prefix_len, u8 is_ipv6)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
Details about one MACIP ACL.
void acl_plugin_lookup_context_notify_acl_change(u32 acl_num)
u32 fa_acl_out_ip4_l2_node_feat_next_node_index[32]
f64 fa_cleaner_wait_time_increment
u32 arp_dot1q_table_index
#define clib_bitmap_validate(v, n_bits)
u32 interface_acl_user_id
u32 ** lc_index_vec_by_acl
static void acl_add_vlan_session(acl_main_t *am, u32 table_index, u8 is_output, u8 is_dot1ad, u8 is_ip6)
uword fa_conn_table_hash_memory_size
u16 dst_port_or_code_last
static int acl_interface_in_enable_disable(acl_main_t *am, u32 sw_if_index, int enable_disable)
static clib_error_t * acl_sw_interface_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
u32 l2_output_classify_next_acl_ip4
ip46_address_t src_ip_addr
void mv(vnet_classify_table_t *t)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
static int acl_is_not_defined(acl_main_t *am, u32 acl_list_index)
static clib_error_t * acl_show_aclplugin_acl_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u16 dstport_or_icmpcode_first
u64 fa_conn_table_max_entries
static uword clib_bitmap_is_zero(uword *ai)
predicate function; is an entire bitmap empty?
static int acl_is_used_by(u32 acl_index, u32 **foo_index_vec_by_acl)
uword vlib_node_add_next_with_slot(vlib_main_t *vm, uword node_index, uword next_node_index, uword slot)
u64 cnt_session_timer_restarted
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Add or delete a MACIP ACL to/from interface.
static void increment_policy_epoch(acl_main_t *am, u32 sw_if_index, int is_input)
static clib_error_t * acl_show_aclplugin_interface_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define clib_error_return(e, args...)
static u8 * format_acl_action(u8 *s, u8 action)
#define ACL_FA_CONN_TABLE_DEFAULT_MAX_ENTRIES
uword * in_acl_on_sw_if_index
static void acl_print_acl(vlib_main_t *vm, acl_main_t *am, int acl_index)
int acl_plugin_set_acl_vec_for_context(u32 lc_index, u32 *acl_list)
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.
u32 out_arp_dot1q_table_index
#define vec_search(v, E)
Search a vector for the index of the entry that matches.
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(acl_sw_interface_add_del)
static clib_error_t * acl_show_aclplugin_decode_5tuple_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Reply to add/replace MACIP ACL.
void acl_plugin_put_lookup_context_index(u32 lc_index)
u32 fa_acl_out_ip6_l2_node_feat_next_node_index[32]
static u8 * my_macip_acl_rule_t_pretty_format(u8 *out, va_list *args)
u32 * acl_ip4_input_classify_table_by_sw_if_index
static int etype_whitelist_add_sessions(acl_main_t *am, u32 sw_if_index, int is_input, u32 etype_table_index)
int vnet_classify_add_del_session(vnet_classify_main_t *cm, u32 table_index, u8 *match, u32 hit_next_index, u32 opaque_index, i32 advance, u8 action, u32 metadata, int is_add)
static int acl_unhook_l2_input_classify(acl_main_t *am, u32 sw_if_index)
static clib_error_t * acl_show_aclplugin_memory_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static int acl_hook_l2_input_classify(acl_main_t *am, u32 sw_if_index)
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void acl_plugin_show_interface(acl_main_t *am, u32 sw_if_index, int show_acl, int detail)
Details about a single MACIP ACL contents.
static void acl_set_session_max_entries(u32 value)
Control ping from client to api server request.
static void setup_message_id_table(acl_main_t *am, api_main_t *apim)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
#define ACL_FA_DEFAULT_CLEANER_WAIT_TIME_INCREMENT
u16 dst_port_or_code_first
#define TCP_SESSION_IDLE_TIMEOUT_SEC
static void warning_acl_print_acl(vlib_main_t *vm, acl_main_t *am, int acl_index)
static void vl_api_acl_dump_t_handler(vl_api_acl_dump_t *mp)
uword * fa_ipv6_known_eh_bitmap
Replace an existing ACL in-place or create a new ACL.
#define ACL_FA_DEFAULT_MIN_DELETED_SESSIONS_PER_INTERVAL
#define pool_put(P, E)
Free an object E in pool P.
#define vec_dup(V)
Return copy of vector (no header, no alignment)
u32 * output_lc_index_by_sw_if_index
void acl_plugin_acl_set_validate_heap(acl_main_t *am, int on)
Details about a single ACL contents.
static clib_error_t * acl_show_aclplugin_tables_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_CONFIG_FUNCTION(x, n,...)
#define vec_del1(v, i)
Delete the element at index I.
vl_api_acl_rule_t r[count]
static void send_acl_details(acl_main_t *am, vl_api_registration_t *reg, acl_list_t *acl, u32 context)
static int get_l3_src_offset(int is6)
int vnet_set_input_acl_intfc(vlib_main_t *vm, u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 l2_table_index, u32 is_add)
static int macip_maybe_apply_unapply_classifier_tables(acl_main_t *am, u32 acl_index, int is_apply)
u32 l2_input_classify_next_acl_ip6
static void send_acl_interface_etype_whitelist_details(acl_main_t *am, vl_api_registration_t *reg, u32 sw_if_index, u32 context)
int interrupt_is_unwanted
void acl_plugin_hash_acl_set_validate_heap(int on)
static u8 * my_format_mac_address(u8 *s, va_list *args)
u8 acl_plugin_acl_exists(u32 acl_index)
u32 out_arp_dot1ad_table_index
#define FA_POLICY_EPOCH_IS_INPUT
u16 src_port_or_type_first
u64 fa_min_deleted_sessions_per_interval
static int match_type_compare(macip_match_type_t *m1, macip_match_type_t *m2)
static void acl_print_acl_x(acl_vector_print_func_t vpr, vlib_main_t *vm, acl_main_t *am, int acl_index)
API main structure, used by both vpp and binary API clients.
void acl_plugin_show_tables_bihash(u32 show_bihash_verbose)
int acl_plugin_get_lookup_context_index(u32 acl_user_id, u32 val1, u32 val2)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
vl_api_acl_rule_t r[count]
An API client registration, only in vpp/vlib.
static int acl_unhook_l2_output_classify(acl_main_t *am, u32 sw_if_index)
Dump the list(s) of MACIP ACLs applied to specific or all interfaces.
static void vl_api_acl_interface_set_etype_whitelist_t_handler(vl_api_acl_interface_set_etype_whitelist_t *mp)
static int match_type_metric(macip_match_type_t *m)
static int macip_acl_del_list(u32 acl_list_index)
Dump one or all defined MACIP ACLs.
static int acl_classify_add_del_table_small(vnet_classify_main_t *cm, u8 *mask, u32 mask_len, u32 next_table_index, u32 miss_next_index, u32 *table_index, int is_add)
static void acl_plugin_show_acl(acl_main_t *am, u32 acl_index)
static uword * clib_bitmap_dup_xor(uword *ai, uword *bi)
Logical operator across two bitmaps which duplicates the first bitmap.
u64 fa_session_total_adds
#define vec_free(V)
Free vector's memory (no header).
void acl_plugin_acl_set_trace_heap(acl_main_t *am, int on)
static void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)
Initialize the feature next-node indexes of a graph node.
u8 * format_acl_plugin_5tuple(u8 *s, va_list *args)
static void * clib_mem_set_heap(void *heap)
u16 srcport_or_icmptype_first
Reply to add/replace ACL.
#define clib_warning(format, args...)
Reply with the vector of MACIP ACLs by sw_if_index.
void acl_plugin_show_lookup_user(u32 user_index)
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.
int use_hash_acl_matching
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
#define foreach_fa_cleaner_counter
vl_api_macip_acl_rule_t r[count]
static int acl_interface_out_enable_disable(acl_main_t *am, u32 sw_if_index, int enable_disable)
void acl_fa_enable_disable(u32 sw_if_index, int is_input, int enable_disable)
#define VLIB_CLI_COMMAND(x,...)
struct _vnet_classify_main vnet_classify_main_t
u16 srcport_or_icmptype_last
static clib_error_t * acl_show_aclplugin_macip_acl_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define ACL_PLUGIN_HASH_LOOKUP_HASH_BUCKETS
u32 hash_lookup_hash_buckets
static void vl_api_acl_interface_add_del_t_handler(vl_api_acl_interface_add_del_t *mp)
static int macip_acl_interface_del_acl(acl_main_t *am, u32 sw_if_index)
static void vl_api_macip_acl_del_t_handler(vl_api_macip_acl_del_t *mp)
static int acl_interface_inout_enable_disable(acl_main_t *am, u32 sw_if_index, int is_input, int enable_disable)
u16 src_port_or_type_last
MACIP Access List Rule entry.
static int macip_create_classify_tables(acl_main_t *am, u32 macip_acl_index)
static void acl_set_timeout_sec(int timeout_type, u32 value)
uword * out_acl_on_sw_if_index
void acl_plugin_show_lookup_context(u32 lc_index)
u32 ** sw_if_index_vec_by_macip_acl
#define MHEAP_FLAG_VALIDATE
static int macip_permit_also_egress(u8 is_permit)
#define clib_bitmap_free(v)
Free a bitmap.
vnet_classify_main_t vnet_classify_main
static void vl_api_macip_acl_add_replace_t_handler(vl_api_macip_acl_add_replace_t *mp)
u32 * acl_etype_input_classify_table_by_sw_if_index
Reply to get the plugin version.
static clib_error_t * acl_plugin_api_hookup(vlib_main_t *vm)
static int macip_acl_add_list(u32 count, vl_api_macip_acl_rule_t rules[], u32 *acl_list_index, u8 *tag)
uword * serviced_sw_if_index_bitmap
vl_api_macip_acl_rule_t r[count]
u32 fa_acl_in_ip6_l2_node_feat_next_node_index[32]
static vlib_main_t * vlib_get_main(void)
Reply to set the ACL list on an interface.
int vnet_classify_add_del_table(vnet_classify_main_t *cm, u8 *mask, u32 nbuckets, u32 memory_size, u32 skip, u32 match, u32 next_table_index, u32 miss_next_index, u32 *table_index, u8 current_data_flag, i16 current_data_offset, int is_add, int del_chain)
#define vec_elt(v, i)
Get vector value at index i.
#define MHEAP_FLAG_SMALL_OBJECT_CACHE
static void macip_acl_print(acl_main_t *am, u32 macip_acl_index)
u32 * macip_acl_by_sw_if_index
Get the vector of MACIP ACL IDs applied to the interfaces.
u32 * acl_ip6_output_classify_table_by_sw_if_index
static void vl_api_acl_interface_list_dump_t_handler(vl_api_acl_interface_list_dump_t *mp)
static void acl_interface_reset_inout_acls(u32 sw_if_index, u8 is_input, int *may_clear_sessions)
static int acl_add_list(u32 count, vl_api_acl_rule_t rules[], u32 *acl_list_index, u8 *tag)
static void print_clib_warning_and_reset(vlib_main_t *vm, u8 *out0)
static int acl_set_etype_whitelists(acl_main_t *am, u32 sw_if_index, u16 *vec_in, u16 *vec_out)
u32 arp_dot1ad_table_index
static void vl_api_acl_del_t_handler(vl_api_acl_del_t *mp)
static void send_macip_acl_details(acl_main_t *am, vl_api_registration_t *reg, macip_acl_list_t *acl, u32 context)
macip_acl_list_t * macip_acls
static clib_error_t * acl_show_aclplugin_sessions_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void send_macip_acl_interface_list_details(acl_main_t *am, vl_api_registration_t *reg, u32 sw_if_index, u32 acl_index, u32 context)
uword hash_lookup_mheap_size
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Details about a single ACL contents.
static void vl_api_macip_acl_interface_list_dump_t_handler(vl_api_macip_acl_interface_list_dump_t *mp)
acl_fa_per_worker_data_t * per_worker_data
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
vnet_sw_interface_t * sw_interfaces
int fa_interrupt_generation
u32 ** input_sw_if_index_vec_by_acl
u64 cnt_already_deleted_sessions
void vnet_l2_output_classify_enable_disable(u32 sw_if_index, int enable_disable)
Enable/disable l2 input classification on a specific interface.
u16 ** output_etype_whitelist_by_sw_if_index
static void vl_api_acl_interface_set_acl_list_t_handler(vl_api_acl_interface_set_acl_list_t *mp)
u64 fa_max_deleted_sessions_per_interval
void * acl_plugin_set_heap()
static clib_error_t * acl_set_aclplugin_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void try_increment_acl_policy_epoch(acl_main_t *am, u32 acl_num, int is_input)
static int acl_interface_add_del_inout_acl(u32 sw_if_index, u8 is_add, u8 is_input, u32 acl_list_index)
static void policy_notify_acl_change(acl_main_t *am, u32 acl_num)
static vlib_thread_main_t * vlib_get_thread_main()
static void acl_plugin_show_sessions(acl_main_t *am, u32 show_session_thread_id, u32 show_session_session_index)
static void copy_acl_rule_to_api_rule(vl_api_acl_rule_t *api_rule, acl_rule_t *r)
u16 ** input_etype_whitelist_by_sw_if_index
void mheap_validate(void *v)
#define vec_foreach(var, vec)
Vector iterator.
static void * acl_set_heap(acl_main_t *am)
static void print_cli_and_reset(vlib_main_t *vm, u8 *out0)
u32 * input_lc_index_by_sw_if_index
u32 vl_msg_api_get_msg_length(void *msg_arg)
u32 ** output_sw_if_index_vec_by_acl
#define ACL_PLUGIN_VERSION_MAJOR
static clib_error_t * acl_show_aclplugin_macip_interface_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 * acl_dot1q_output_classify_table_by_sw_if_index
#define FA_POLICY_EPOCH_MASK
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
#define CLIB_CACHE_LINE_BYTES
#define ACL_PLUGIN_HASH_LOOKUP_HEAP_SIZE
static int intf_has_etype_whitelist(acl_main_t *am, u32 sw_if_index, int is_input)
void acl_plugin_show_tables_acl_hash_info(u32 acl_index)
u32 l2_output_classify_next_acl_ip6
static int acl_interface_set_inout_acl_list(acl_main_t *am, u32 sw_if_index, u8 is_input, u32 *vec_acl_list_index, int *may_clear_sessions)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define ACL_FA_DEFAULT_MAX_DELETED_SESSIONS_PER_INTERVAL
static void vl_api_acl_plugin_control_ping_t_handler(vl_api_acl_plugin_control_ping_t *mp)
int vnet_set_output_acl_intfc(vlib_main_t *vm, u32 sw_if_index, u32 ip4_table_index, u32 ip6_table_index, u32 l2_table_index, u32 is_add)
u32 ** output_acl_vec_by_sw_if_index
static clib_error_t * acl_show_aclplugin_lookup_context_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 out_dot1ad_table_index
#define TCP_SESSION_TRANSIENT_TIMEOUT_SEC
static void vl_api_macip_acl_interface_add_del_t_handler(vl_api_macip_acl_interface_add_del_t *mp)
u32 hash_lookup_hash_memory
u64 current_time_wait_interval
u32 acl_plugin_register_user_module(char *user_module_name, char *val1_label, char *val2_label)
u32 fa_conn_table_hash_num_buckets
u32 * acl_dot1q_input_classify_table_by_sw_if_index
#define ACL_FA_CONN_TABLE_DEFAULT_HASH_MEMORY_SIZE
u64 fa_session_total_dels
static int acl_del_list(u32 acl_list_index)
static void send_acl_interface_list_details(acl_main_t *am, vl_api_registration_t *reg, u32 sw_if_index, u32 context)
static void macip_destroy_classify_tables(acl_main_t *am, u32 macip_acl_index)
u16 vl_msg_api_get_msg_ids(const char *name, int n)
static void vl_api_macip_acl_interface_get_t_handler(vl_api_macip_acl_interface_get_t *mp)
u32 * acl_dot1ad_output_classify_table_by_sw_if_index
foreach_fa_cleaner_counter vlib_main_t * vlib_main