[PATCH bpf-next 6/6] selftests/bpf: Drop get_port in test_tcp_check_syncookie

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Geliang Tang <tanggeliang@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 .../bpf/test_tcp_check_syncookie_user.c       | 21 +++----------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c b/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c
index b928474f3bf9..7b5fc98838cd 100644
--- a/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c
+++ b/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c
@@ -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))
-- 
2.43.0





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux