summaryrefslogtreecommitdiffstats
path: root/test/scripts
AgeCommit message (Expand)AuthorFilesLines
2019-03-25VCL: add TLS opt to socket_test.shDave Wallace1-3/+3
2018-12-06Rename VPP_TEST_FAILED_DIR to FAILED_DIRjuraj.linkes1-7/+7
2018-11-07VCL: Fix socket_test.sh to build test apps.Dave Wallace1-4/+7
2018-10-01Fix the path error inside vcl socket_test.shYalei Wang1-9/+11
2018-09-20rename vpp-dpdk-dev to vpp-ext-depsDamjan Marion1-1/+1
2018-09-12Always use 'lib' instead of 'lib64'Damjan Marion1-18/+18
2018-09-06session: support multiple worker bindsFlorin Coras1-2/+2
2018-09-02Switch to cmakeDamjan Marion1-6/+6
2018-03-26VCL: add IPv6 to socket_test.sh and make testDave Wallace1-12/+46
2018-03-14socket_test.sh: Don't hard code debug image with gdb.Dave Wallace1-3/+0
2018-03-08VCL: Add full hoststack test option to socket_test.shDave Wallace1-7/+72
2018-02-24LDP: Refactor epoll_ctl wrapper.Dave Wallace1-2/+2
2018-02-19VCL: config api prefix using env var.Dave Wallace1-0/+3
2018-01-17LD_PRELOAD: stateless LDPDave Wallace1-0/+9
2017-11-25VCL: improve debug outputDave Wallace1-2/+10
2017-11-21VCL: close-on-empty state transition refactoring.Dave Wallace1-1/+1
2017-11-09VCL: Set debug output level from env varDave Wallace1-2/+7
2017-11-07VCL-LDPRELOAD: enable accept4() wrapperDave Wallace1-1/+1
2017-11-06VCL_LDPRELOAD: mixed libc/vcl epoll fd'sDave Wallace1-8/+2
2017-11-02VCL: application proxy configurationDave Wallace1-7/+11
2017-10-26VCL: add session namespace support.Dave Wallace1-24/+56
2017-10-25VCL: Fix vcl test scripts to check vcl.am instead of uri.amDave Wallace1-1/+1
2017-10-24VCL-LDPRELOAD: statically link vppcom into libvcl-ldpreload.soDave Wallace1-7/+8
2017-10-17VCL: refactor VCL_LDPRELOAD env vars.Dave Wallace1-1/+1
2017-10-06VCL: add epoll_* functions.Dave Wallace1-2/+2
2017-09-30make test: archive failed test data with build logs.Dave Wallace1-15/+31
2017-09-25Refactor multi-host socket_test.sh for bare-metal.Dave Wallace1-18/+51
2017-09-19Add new C APIKlement Sekera1-5/+9
2017-09-17Add multi-vm Vagrantfile for vcl-test.Dave Wallace1-3/+10
2017-09-08Fix socket_test.sh vagrant based multi-host tests.Dave Wallace1-125/+281
2017-08-31Improvements to socket_test.sh scriptKeith Burns (alagalah)1-8/+8
2017-08-18make test: fix broken passing of return valueKlement Sekera2-5/+6
2017-08-17Fix socket_test.sh to run iperf3 in docker.Dave Wallace1-16/+31
2017-08-17make test: collect symlinks to failed testsKlement Sekera1-0/+21
2017-08-14Fix VCL LD_PRELOAD lib location in socket_test.shDave Wallace1-9/+16
2017-08-14make test: properly handle ctrl-cKlement Sekera2-2/+27
2017-08-11Add VPP Communications Library (VCL)Dave Wallace1-0/+637
2017-08-07make test: kill all remaining subprocesses on exitKlement Sekera1-0/+25
2017-04-03make test: tweak helper scriptsKlement Sekera2-3/+8
2017-04-02make test: add scripts for easy test loopingKlement Sekera2-0/+122
/* IP[46] */ vnet_feature_config_main_t *fcm; u8 arc; if (tid == IN_OUT_ACL_TABLE_IP4) { char *arc_name = is_output ? "ip4-output" : "ip4-unicast"; vnet_feature_enable_disable (arc_name, is_output ? "ip4-outacl" : "ip4-inacl", sw_if_index, feature_enable, 0, 0); arc = vnet_get_feature_arc_index (arc_name); } else { char *arc_name = is_output ? "ip6-output" : "ip6-unicast"; vnet_feature_enable_disable (arc_name, is_output ? "ip6-outacl" : "ip6-inacl", sw_if_index, feature_enable, 0, 0); arc = vnet_get_feature_arc_index (arc_name); } fcm = vnet_get_feature_arc_config_main (arc); am->vnet_config_main[is_output][tid] = &fcm->config_main; } return 0; } int vnet_set_in_out_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 is_output) { in_out_acl_main_t *am = &in_out_acl_main; vnet_classify_main_t *vcm = am->vnet_classify_main; u32 acl[IN_OUT_ACL_N_TABLES] = { ip4_table_index, ip6_table_index, l2_table_index }; u32 ti; /* Assume that we've validated sw_if_index in the API layer */ for (ti = 0; ti < IN_OUT_ACL_N_TABLES; ti++) { if (acl[ti] == ~0) continue; if (pool_is_free_index (vcm->tables, acl[ti])) return VNET_API_ERROR_NO_SUCH_TABLE; vec_validate_init_empty (am->classify_table_index_by_sw_if_index[is_output][ti], sw_if_index, ~0); /* Reject any DEL operation with wrong sw_if_index */ if (!is_add && (acl[ti] != am->classify_table_index_by_sw_if_index[is_output][ti] [sw_if_index])) { clib_warning ("Non-existent intf_idx=%d with table_index=%d for delete", sw_if_index, acl[ti]); return VNET_API_ERROR_NO_SUCH_TABLE; } /* Return ok on ADD operaton if feature is already enabled */ if (is_add && am->classify_table_index_by_sw_if_index[is_output][ti][sw_if_index] != ~0) return 0; vnet_in_out_acl_ip_feature_enable (vm, am, sw_if_index, ti, is_add, is_output); if (is_add) am->classify_table_index_by_sw_if_index[is_output][ti][sw_if_index] = acl[ti]; else am->classify_table_index_by_sw_if_index[is_output][ti][sw_if_index] = ~0; } return 0; } 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) { return vnet_set_in_out_acl_intfc (vm, sw_if_index, ip4_table_index, ip6_table_index, l2_table_index, is_add, IN_OUT_ACL_INPUT_TABLE_GROUP); } 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) { return vnet_set_in_out_acl_intfc (vm, sw_if_index, ip4_table_index, ip6_table_index, l2_table_index, is_add, IN_OUT_ACL_OUTPUT_TABLE_GROUP); } static clib_error_t * set_in_out_acl_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd, u32 is_output) { vnet_main_t *vnm = vnet_get_main (); u32 sw_if_index = ~0; u32 ip4_table_index = ~0; u32 ip6_table_index = ~0; u32 l2_table_index = ~0; u32 is_add = 1; u32 idx_cnt = 0; int rv; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "intfc %U", unformat_vnet_sw_interface, vnm, &sw_if_index)) ; else if (unformat (input, "ip4-table %d", &ip4_table_index)) idx_cnt++; else if (unformat (input, "ip6-table %d", &ip6_table_index)) idx_cnt++; else if (unformat (input, "l2-table %d", &l2_table_index)) idx_cnt++; else if (unformat (input, "del")) is_add = 0; else break; } if (sw_if_index == ~0) return clib_error_return (0, "Interface must be specified."); if (!idx_cnt) return clib_error_return (0, "Table index should be specified."); if (idx_cnt > 1) return clib_error_return (0, "Only one table index per API is allowed."); rv = vnet_set_in_out_acl_intfc (vm, sw_if_index, ip4_table_index, ip6_table_index, l2_table_index, is_add, is_output); switch (rv) { case 0: break; case VNET_API_ERROR_NO_MATCHING_INTERFACE: return clib_error_return (0, "No such interface"); case VNET_API_ERROR_NO_SUCH_ENTRY: return clib_error_return (0, "No such classifier table"); } return 0; } static clib_error_t * set_input_acl_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { return set_in_out_acl_command_fn (vm, input, cmd, IN_OUT_ACL_INPUT_TABLE_GROUP); } static clib_error_t * set_output_acl_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { return set_in_out_acl_command_fn (vm, input, cmd, IN_OUT_ACL_OUTPUT_TABLE_GROUP); } /* * Configure interface to enable/disble input/output ACL features: * intfc - interface name to be configured as input ACL * Ip4-table <index> [del] - enable/disable IP4 input ACL * Ip6-table <index> [del] - enable/disable IP6 input ACL * l2-table <index> [del] - enable/disable Layer2 input ACL * * Note: Only one table index per API call is allowed. * */ /* *INDENT-OFF* */ VLIB_CLI_COMMAND (set_input_acl_command, static) = { .path = "set interface input acl", .short_help = "set interface input acl intfc <int> [ip4-table <index>]\n" " [ip6-table <index>] [l2-table <index>] [del]", .function = set_input_acl_command_fn, }; VLIB_CLI_COMMAND (set_output_acl_command, static) = { .path = "set interface output acl", .short_help = "set interface output acl intfc <int> [ip4-table <index>]\n" " [ip6-table <index>] [l2-table <index>] [del]", .function = set_output_acl_command_fn, }; /* *INDENT-ON* */ clib_error_t * in_out_acl_init (vlib_main_t * vm) { in_out_acl_main_t *am = &in_out_acl_main; am->vlib_main = vm; am->vnet_main = vnet_get_main (); am->vnet_classify_main = &vnet_classify_main; return 0; } /* *INDENT-OFF* */ VLIB_INIT_FUNCTION (in_out_acl_init) = { .runs_after = VLIB_INITS("ip_in_out_acl_init"), }; /* *INDENT-ON* */ uword unformat_acl_type (unformat_input_t * input, va_list * args) { u32 *acl_type = va_arg (*args, u32 *); u32 tid = IN_OUT_ACL_N_TABLES; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "ip4")) tid = IN_OUT_ACL_TABLE_IP4; else if (unformat (input, "ip6")) tid = IN_OUT_ACL_TABLE_IP6; else if (unformat (input, "l2")) tid = IN_OUT_ACL_TABLE_L2; else break; } *acl_type = tid; return 1; } u8 * format_vnet_in_out_acl_info (u8 * s, va_list * va) { in_out_acl_main_t *am = va_arg (*va, in_out_acl_main_t *); int sw_if_idx = va_arg (*va, int); u32 tid = va_arg (*va, u32); if (tid == ~0) { s = format (s, "%10s%20s\t\t%s", "Intfc idx", "Classify table", "Interface name"); return s; } s = format (s, "%10d%20d\t\t%U", sw_if_idx, tid, format_vnet_sw_if_index_name, am->vnet_main, sw_if_idx); return s; } static clib_error_t * show_in_out_acl_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd, u32 is_output) { in_out_acl_main_t *am = &in_out_acl_main; u32 type = IN_OUT_ACL_N_TABLES; int i; u32 *vec_tbl; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "type %U", unformat_acl_type, &type)) ; else break; } if (type == IN_OUT_ACL_N_TABLES) return clib_error_return (0, is_output ? "Invalid output ACL table type." : "Invalid input ACL table type."); vec_tbl = am->classify_table_index_by_sw_if_index[is_output][type]; if (vec_len (vec_tbl)) vlib_cli_output (vm, "%U", format_vnet_in_out_acl_info, am, ~0 /* hdr */ , ~0); else vlib_cli_output (vm, is_output ? "No output ACL tables configured" : "No input ACL tables configured"); for (i = 0; i < vec_len (vec_tbl); i++) { if (vec_elt (vec_tbl, i) == ~0) continue; vlib_cli_output (vm, "%U", format_vnet_in_out_acl_info, am, i, vec_elt (vec_tbl, i)); } return 0; } static clib_error_t * show_inacl_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { return show_in_out_acl_command_fn (vm, input, cmd, IN_OUT_ACL_INPUT_TABLE_GROUP); } static clib_error_t * show_outacl_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { return show_in_out_acl_command_fn (vm, input, cmd, IN_OUT_ACL_OUTPUT_TABLE_GROUP); } /* *INDENT-OFF* */ VLIB_CLI_COMMAND (show_inacl_command, static) = { .path = "show inacl", .short_help = "show inacl type [ip4|ip6|l2]", .function = show_inacl_command_fn, }; VLIB_CLI_COMMAND (show_outacl_command, static) = { .path = "show outacl", .short_help = "show outacl type [ip4|ip6|l2]", .function = show_outacl_command_fn, }; /* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */