mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 09:31:26 +00:00
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: Geliang Tang <tanggeliang@kylinos.cn> Link: https://lore.kernel.org/r/a9b5c8064ab4cbf0f68886fe0e4706428b8d0d47.1714907662.git.tanggeliang@kylinos.cn Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
This commit is contained in:
parent
65a3f0df44
commit
7abbf38cd8
@ -139,21 +139,6 @@ out:
|
|||||||
return ret;
|
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)
|
static int v6only_true(int fd, const struct post_socket_opts *opts)
|
||||||
{
|
{
|
||||||
int mode = true;
|
int mode = true;
|
||||||
@ -214,19 +199,19 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
server = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr4,
|
server = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr4,
|
||||||
sizeof(addr4), NULL);
|
sizeof(addr4), NULL);
|
||||||
if (server == -1 || !get_port(server, &addr4.sin_port))
|
if (server == -1)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
opts.post_socket_cb = v6only_true;
|
opts.post_socket_cb = v6only_true;
|
||||||
server_v6 = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr6,
|
server_v6 = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr6,
|
||||||
sizeof(addr6), &opts);
|
sizeof(addr6), &opts);
|
||||||
if (server_v6 == -1 || !get_port(server_v6, &addr6.sin6_port))
|
if (server_v6 == -1)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
opts.post_socket_cb = v6only_false;
|
opts.post_socket_cb = v6only_false;
|
||||||
server_dual = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr6dual,
|
server_dual = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr6dual,
|
||||||
sizeof(addr6dual), &opts);
|
sizeof(addr6dual), &opts);
|
||||||
if (server_dual == -1 || !get_port(server_dual, &addr4dual.sin_port))
|
if (server_dual == -1)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (run_test(server, results, xdp))
|
if (run_test(server, results, xdp))
|
||||||
|
Loading…
Reference in New Issue
Block a user