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
This commit is contained in:
Harald Welte 2021-04-25 13:03:41 +02:00
parent a1f8e20bb3
commit 1c8d16c570
1 changed files with 3 additions and 15 deletions

View File

@ -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' */