From 1c8d16c57057f821a372353614d74eb732ce5c80 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 25 Apr 2021 13:03:41 +0200 Subject: [PATCH] pcap-client: Don't bind to second 'traffic' udp port if the tester runs on a different host/IP than the IUT (like in our dockerized jenkins tests), then of course we cannot assume that traffic sent by the tester can be received by the tester again. So rather than binding/connecting two sockets, let's only use one and send packets without caring if there is a remote receiver. Change-Id: If826705c78c7a0ad0e633b7a320d7dd5e5561c27 --- pcap-client/OPCAP_CLIENT_Tests.ttcn | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/pcap-client/OPCAP_CLIENT_Tests.ttcn b/pcap-client/OPCAP_CLIENT_Tests.ttcn index 5f59cafc9..e9fe406ad 100644 --- a/pcap-client/OPCAP_CLIENT_Tests.ttcn +++ b/pcap-client/OPCAP_CLIENT_Tests.ttcn @@ -34,7 +34,7 @@ type component test_CT extends OPCAP_Adapter_CT { /* port to generate IP traffic that may or may not be captured */ port IPL4asp_PT IP; - var integer g_traffic_conn_id[2]; + var integer g_traffic_conn_id; }; private altstep as_Tguard() runs on test_CT { @@ -70,24 +70,12 @@ private function f_init() runs on test_CT { /* 0 -> 1 */ res := f_IPL4_connect(IP, mp_traffic_b.ip, mp_traffic_b.udp_port, mp_traffic_a.ip, mp_traffic_a.udp_port, -1, { udp:={} }); - g_traffic_conn_id[0] := res.connId; - - /* 1 -> 0 */ - res := f_IPL4_connect(IP, mp_traffic_a.ip, mp_traffic_a.udp_port, - mp_traffic_b.ip, mp_traffic_b.udp_port, -1, { udp:={} }); - g_traffic_conn_id[1] := res.connId; + g_traffic_conn_id := res.connId; } /* generate user traffic from A -> B */ function f_trafic_pkt_ab(octetstring payload) runs on test_CT { - IP.send(ASP_Send:{g_traffic_conn_id[0], omit, payload}) - IP.receive(ASP_RecvFrom:{g_traffic_conn_id[1], ?, ?, ?, ?, { udp:={} }, ?, payload}); -} - -/* generate user traffic from B -> A */ -function f_trafic_pkt_ba(octetstring payload) runs on test_CT { - IP.send(ASP_Send:{g_traffic_conn_id[1], omit, payload}) - IP.receive(ASP_RecvFrom:{g_traffic_conn_id[0], ?, ?, ?, ?, { udp:={} }, ?, payload}); + IP.send(ASP_Send:{g_traffic_conn_id, omit, payload}) } /* expect a specified UDP payload on the OPCAP connection 'idx' */