diff mbox series

[SRU,E,2/2] UBUNTU: SAUCE: Revert "selftests/bpf: Test freeing sockmap/sockhash with a socket in it"

Message ID 20200409132901.4802-3-kleber.souza@canonical.com
State New
Headers show
Series remove prog_tests/sockmap_basic.c from bpf selftests | expand

Commit Message

Kleber Sacilotto de Souza April 9, 2020, 1:29 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1871613

This reverts commit 7c57edd8018e70b4faebf0569a1fa3f35a21829c which is
commit 5d3919a953c3c96c02fc7a337f8376cde43ae31f upstream.

This commit has been backported to eoan/linux from v5.4.20 upstream
stable, however due to missing dependencies prog_tests/sockmap_basic.
can't be compiled:

prog_tests/sockmap_basic.c: In function 'connected_socket_v4':
prog_tests/sockmap_basic.c:22:6: warning: implicit declaration of function 'CHECK_FAIL' [-Wimplicit-function-declaration]
   22 | if (CHECK_FAIL(s == -1))
      | ^~~~~~~~~~
prog_tests/sockmap_basic.c:26:22: error: 'SOL_TCP' undeclared (first use in this function); did you mean 'SOL_TIPC'?
   26 | err = setsockopt(s, SOL_TCP, TCP_REPAIR, &repair, sizeof(repair));
      | ^~~~~~~
      | SOL_TIPC
prog_tests/sockmap_basic.c:26:22: note: each undeclared identifier is reported only once for each function it appears in
prog_tests/sockmap_basic.c: In function 'test_sockmap_basic':
prog_tests/sockmap_basic.c:75:6: warning: implicit declaration of function 'test__start_subtest' [-Wimplicit-function-declaration]
   75 | if (test__start_subtest("sockmap create_update_free"))
      | ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
---
 .../selftests/bpf/prog_tests/sockmap_basic.c  | 74 -------------------
 1 file changed, 74 deletions(-)
 delete mode 100644 tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
deleted file mode 100644
index 07f5b462c2ef..000000000000
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
+++ /dev/null
@@ -1,74 +0,0 @@ 
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (c) 2020 Cloudflare
-
-#include "test_progs.h"
-
-static int connected_socket_v4(void)
-{
-	struct sockaddr_in addr = {
-		.sin_family = AF_INET,
-		.sin_port = htons(80),
-		.sin_addr = { inet_addr("127.0.0.1") },
-	};
-	socklen_t len = sizeof(addr);
-	int s, repair, err;
-
-	s = socket(AF_INET, SOCK_STREAM, 0);
-	if (CHECK_FAIL(s == -1))
-		goto error;
-
-	repair = TCP_REPAIR_ON;
-	err = setsockopt(s, SOL_TCP, TCP_REPAIR, &repair, sizeof(repair));
-	if (CHECK_FAIL(err))
-		goto error;
-
-	err = connect(s, (struct sockaddr *)&addr, len);
-	if (CHECK_FAIL(err))
-		goto error;
-
-	repair = TCP_REPAIR_OFF_NO_WP;
-	err = setsockopt(s, SOL_TCP, TCP_REPAIR, &repair, sizeof(repair));
-	if (CHECK_FAIL(err))
-		goto error;
-
-	return s;
-error:
-	perror(__func__);
-	close(s);
-	return -1;
-}
-
-/* Create a map, populate it with one socket, and free the map. */
-static void test_sockmap_create_update_free(enum bpf_map_type map_type)
-{
-	const int zero = 0;
-	int s, map, err;
-
-	s = connected_socket_v4();
-	if (CHECK_FAIL(s == -1))
-		return;
-
-	map = bpf_create_map(map_type, sizeof(int), sizeof(int), 1, 0);
-	if (CHECK_FAIL(map == -1)) {
-		perror("bpf_create_map");
-		goto out;
-	}
-
-	err = bpf_map_update_elem(map, &zero, &s, BPF_NOEXIST);
-	if (CHECK_FAIL(err)) {
-		perror("bpf_map_update");
-		goto out;
-	}
-
-out:
-	close(map);
-	close(s);
-}
-
-void test_sockmap_basic(void)
-{
-	if (test__start_subtest("sockmap create_update_free"))
-		test_sockmap_create_update_free(BPF_MAP_TYPE_SOCKMAP);
-	if (test__start_subtest("sockhash create_update_free"))
-		test_sockmap_create_update_free(BPF_MAP_TYPE_SOCKHASH);
-}