X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fvnet%2Fsession%2Fsession_test.c;h=058644d91d42ff1f29f3724110d02617da3f4c7e;hb=ab2f6dbf9f7b7164a9810f4c80c8abf8463e42ad;hp=91ac351f86082e2bfdc2c247055bb78ca6a723a4;hpb=371ca50a74a9c4f1b74c4c1b65c6fdec610fcfc3;p=vpp.git diff --git a/src/vnet/session/session_test.c b/src/vnet/session/session_test.c index 91ac351f860..058644d91d4 100644 --- a/src/vnet/session/session_test.c +++ b/src/vnet/session/session_test.c @@ -159,11 +159,13 @@ session_test_basic (vlib_main_t * vm, unformat_input_t * input) .options = options, .namespace_id = 0, .session_cb_vft = &dummy_session_cbs, + .name = format (0, "session_test"), }; error = vnet_application_attach (&attach_args); SESSION_TEST ((error == 0), "app attached"); server_index = attach_args.app_index; + vec_free (attach_args.name); server_sep.is_ip4 = 1; vnet_bind_args_t bind_args = { @@ -210,7 +212,7 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) { u64 options[APP_OPTIONS_N_OPTIONS], dummy_secret = 1234; u32 server_index, server_st_index, server_local_st_index; - u32 dummy_port = 1234, client_index; + u32 dummy_port = 1234, client_index, server_wrk_index; u32 dummy_api_context = 4321, dummy_client_api_index = 1234; u32 dummy_server_api_index = ~0, sw_if_index = 0; session_endpoint_t server_sep = SESSION_ENDPOINT_NULL; @@ -236,6 +238,7 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) .options = options, .namespace_id = 0, .session_cb_vft = &dummy_session_cbs, + .name = format (0, "session_test"), }; vnet_bind_args_t bind_args = { @@ -244,10 +247,10 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) }; vnet_connect_args_t connect_args = { - .sep = client_sep, .app_index = 0, .api_context = 0, }; + clib_memcpy (&connect_args.sep, &client_sep, sizeof (client_sep)); vnet_unbind_args_t unbind_args = { .handle = bind_args.handle, @@ -259,7 +262,7 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) }; ip4_address_t intf_addr = { - .as_u32 = clib_host_to_net_u32 (0x06000105), + .as_u32 = clib_host_to_net_u32 (0x07000105), }; intf_sep.ip.ip4 = intf_addr; @@ -315,6 +318,7 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) SESSION_TEST ((error == 0), "server attachment should work"); server_index = attach_args.app_index; server = application_get (server_index); + server_wrk_index = application_get_default_worker (server)->wrk_index; SESSION_TEST ((server->ns_index == 0), "server should be in the default ns"); @@ -325,8 +329,8 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) server_st_index = application_session_table (server, FIB_PROTOCOL_IP4); s = session_lookup_listener (server_st_index, &server_sep); SESSION_TEST ((s != 0), "listener should exist in global table"); - SESSION_TEST ((s->app_index == server_index), "app_index should be that of " - "the server"); + SESSION_TEST ((s->app_wrk_index == server_wrk_index), "app_index should be" + " that of the server"); server_local_st_index = application_local_session_table (server); SESSION_TEST ((server_local_st_index == APP_INVALID_INDEX), "server shouldn't have access to local table"); @@ -354,6 +358,7 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) SESSION_TEST ((error == 0), "server attachment should work"); server_index = attach_args.app_index; server = application_get (server_index); + server_wrk_index = application_get_default_worker (server)->wrk_index; SESSION_TEST ((server->ns_index == app_namespace_index (app_ns)), "server should be in the right ns"); @@ -363,8 +368,8 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) server_st_index = application_session_table (server, FIB_PROTOCOL_IP4); s = session_lookup_listener (server_st_index, &server_sep); SESSION_TEST ((s != 0), "listener should exist in global table"); - SESSION_TEST ((s->app_index == server_index), "app_index should be that of " - "the server"); + SESSION_TEST ((s->app_wrk_index == server_wrk_index), "app_index should be" + " that of the server"); server_local_st_index = application_local_session_table (server); handle = session_lookup_local_endpoint (server_local_st_index, &server_sep); SESSION_TEST ((handle != SESSION_INVALID_HANDLE), @@ -503,6 +508,8 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) error = vnet_application_attach (&attach_args); SESSION_TEST ((error == 0), "server attachment should work"); server_index = attach_args.app_index; + server = application_get (server_index); + server_wrk_index = application_get_default_worker (server)->wrk_index; bind_args.app_index = server_index; error = vnet_bind (&bind_args); @@ -512,8 +519,8 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) s = session_lookup_listener (server_st_index, &intf_sep); SESSION_TEST ((s != 0), "intf listener should exist in global table"); - SESSION_TEST ((s->app_index == server_index), "app_index should be that of " - "the server"); + SESSION_TEST ((s->app_wrk_index == server_wrk_index), "app_index should be " + "that of the server"); server_local_st_index = application_local_session_table (server); handle = session_lookup_local_endpoint (server_local_st_index, &server_sep); SESSION_TEST ((handle != SESSION_INVALID_HANDLE), @@ -524,6 +531,7 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) /* * Cleanup */ + vec_free (attach_args.name); vec_free (ns_id); session_delete_loopback (sw_if_index); return 0; @@ -838,6 +846,7 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input) .options = options, .namespace_id = 0, .session_cb_vft = &dummy_session_cbs, + .name = format (0, "session_test"), }; vnet_bind_args_t bind_args = { @@ -1032,10 +1041,10 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input) " 5.6.7.9/32 4321 in local table should return deny"); vnet_connect_args_t connect_args = { - .sep = sep, .app_index = attach_args.app_index, .api_context = 0, }; + clib_memcpy (&connect_args.sep, &sep, sizeof (sep)); /* Try connecting */ error = vnet_connect (&connect_args); @@ -1312,7 +1321,7 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input) connect_args.app_index = server_index; - connect_args.sep = sep; + clib_memcpy (&connect_args.sep, &sep, sizeof (sep)); error = vnet_connect (&connect_args); SESSION_TEST ((error != 0), "connect should fail"); @@ -1356,6 +1365,7 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input) vnet_application_detach (&detach_args); vec_free (ns_id); + vec_free (attach_args.name); return 0; } @@ -1369,7 +1379,7 @@ session_test_proxy (vlib_main_t * vm, unformat_input_t * input) u32 server_index, app_index; u32 dummy_server_api_index = ~0, sw_if_index = 0; clib_error_t *error = 0; - u8 sst, is_filtered = 0; + u8 is_filtered = 0; stream_session_t *s; transport_connection_t *tc; u16 lcl_port = 1234, rmt_port = 4321; @@ -1426,6 +1436,7 @@ session_test_proxy (vlib_main_t * vm, unformat_input_t * input) .options = options, .namespace_id = 0, .session_cb_vft = &dummy_session_cbs, + .name = format (0, "session_test"), }; attach_args.api_client_index = dummy_server_api_index; @@ -1447,10 +1458,9 @@ session_test_proxy (vlib_main_t * vm, unformat_input_t * input) TRANSPORT_PROTO_TCP, 0, &is_filtered); SESSION_TEST ((tc != 0), "lookup 1.2.3.4 1234 5.6.7.8 4321 should be " "successful"); - sst = session_type_from_proto_and_ip (TRANSPORT_PROTO_TCP, 1); - s = listen_session_get (sst, tc->s_index); - SESSION_TEST ((s->app_index == server_index), "lookup should return the" - " server"); + s = listen_session_get (tc->s_index); + SESSION_TEST ((s->app_index == server_index), "lookup should return" + " the server"); tc = session_lookup_connection_wt4 (0, &rmt_ip, &rmt_ip, lcl_port, rmt_port, TRANSPORT_PROTO_TCP, 0, &is_filtered); @@ -1481,6 +1491,7 @@ session_test_proxy (vlib_main_t * vm, unformat_input_t * input) "local session endpoint lookup should not work after detach"); if (verbose) unformat_free (&tmp_input); + vec_free (attach_args.name); return 0; }