Commit 7abbf38c authored by Geliang Tang's avatar Geliang Tang Committed by Martin KaFai Lau

selftests/bpf: Drop get_port in test_tcp_check_syncookie

The arguments "addr" and "len" of run_test() have dropped. This makes
function get_port() useless. Drop it from test_tcp_check_syncookie_user.c.
Signed-off-by: default avatarGeliang Tang <tanggeliang@kylinos.cn>
Link: https://lore.kernel.org/r/a9b5c8064ab4cbf0f68886fe0e4706428b8d0d47.1714907662.git.tanggeliang@kylinos.cnSigned-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent 65a3f0df
......@@ -139,21 +139,6 @@ static int run_test(int server_fd, int results_fd, bool xdp)
return ret;
}
static bool get_port(int server_fd, in_port_t *port)
{
struct sockaddr_in addr;
socklen_t len = sizeof(addr);
if (getsockname(server_fd, (struct sockaddr *)&addr, &len)) {
log_err("Failed to get server addr");
return false;
}
/* sin_port and sin6_port are located at the same offset. */
*port = addr.sin_port;
return true;
}
static int v6only_true(int fd, const struct post_socket_opts *opts)
{
int mode = true;
......@@ -214,19 +199,19 @@ int main(int argc, char **argv)
server = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr4,
sizeof(addr4), NULL);
if (server == -1 || !get_port(server, &addr4.sin_port))
if (server == -1)
goto err;
opts.post_socket_cb = v6only_true;
server_v6 = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr6,
sizeof(addr6), &opts);
if (server_v6 == -1 || !get_port(server_v6, &addr6.sin6_port))
if (server_v6 == -1)
goto err;
opts.post_socket_cb = v6only_false;
server_dual = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr6dual,
sizeof(addr6dual), &opts);
if (server_dual == -1 || !get_port(server_dual, &addr4dual.sin_port))
if (server_dual == -1)
goto err;
if (run_test(server, results, xdp))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment