aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-10-12 14:21:56 -0400
committerDavid S. Miller <davem@davemloft.net>2019-10-12 14:21:56 -0400
commit8caf8a91f34d55e8e3b1355ee8d658cb472146e2 (patch)
tree3d3d88878d6c966c854e857dbd8cec701cd3a347
parentf0308fb0708078d6c1d8a4d533941a7a191af634 (diff)
parent106c35dda32f8b63f88cad7433f1b8bb0056958a (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Alexei Starovoitov says: ==================== pull-request: bpf 2019-10-12 The following pull-request contains BPF updates for your *net* tree. The main changes are: 1) a bunch of small fixes. Nothing critical. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/xdp/xsk.c42
-rw-r--r--samples/bpf/asm_goto_workaround.h13
-rw-r--r--samples/bpf/task_fd_query_user.c1
-rw-r--r--tools/bpf/Makefile6
-rw-r--r--tools/lib/bpf/Makefile33
-rw-r--r--tools/lib/bpf/libbpf_internal.h16
-rw-r--r--tools/lib/bpf/xsk.c4
-rw-r--r--tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c2
-rw-r--r--tools/testing/selftests/bpf/prog_tests/tcp_rtt.c3
-rwxr-xr-xtools/testing/selftests/bpf/test_flow_dissector.sh3
-rwxr-xr-xtools/testing/selftests/bpf/test_lwt_ip_encap.sh6
11 files changed, 95 insertions, 34 deletions
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index fa8fbb8fa3c8..9044073fbf22 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -305,9 +305,8 @@ out:
305} 305}
306EXPORT_SYMBOL(xsk_umem_consume_tx); 306EXPORT_SYMBOL(xsk_umem_consume_tx);
307 307
308static int xsk_zc_xmit(struct sock *sk) 308static int xsk_zc_xmit(struct xdp_sock *xs)
309{ 309{
310 struct xdp_sock *xs = xdp_sk(sk);
311 struct net_device *dev = xs->dev; 310 struct net_device *dev = xs->dev;
312 311
313 return dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, 312 return dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id,
@@ -327,11 +326,10 @@ static void xsk_destruct_skb(struct sk_buff *skb)
327 sock_wfree(skb); 326 sock_wfree(skb);
328} 327}
329 328
330static int xsk_generic_xmit(struct sock *sk, struct msghdr *m, 329static int xsk_generic_xmit(struct sock *sk)
331 size_t total_len)
332{ 330{
333 u32 max_batch = TX_BATCH_SIZE;
334 struct xdp_sock *xs = xdp_sk(sk); 331 struct xdp_sock *xs = xdp_sk(sk);
332 u32 max_batch = TX_BATCH_SIZE;
335 bool sent_frame = false; 333 bool sent_frame = false;
336 struct xdp_desc desc; 334 struct xdp_desc desc;
337 struct sk_buff *skb; 335 struct sk_buff *skb;
@@ -394,6 +392,18 @@ out:
394 return err; 392 return err;
395} 393}
396 394
395static int __xsk_sendmsg(struct sock *sk)
396{
397 struct xdp_sock *xs = xdp_sk(sk);
398
399 if (unlikely(!(xs->dev->flags & IFF_UP)))
400 return -ENETDOWN;
401 if (unlikely(!xs->tx))
402 return -ENOBUFS;
403
404 return xs->zc ? xsk_zc_xmit(xs) : xsk_generic_xmit(sk);
405}
406
397static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) 407static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len)
398{ 408{
399 bool need_wait = !(m->msg_flags & MSG_DONTWAIT); 409 bool need_wait = !(m->msg_flags & MSG_DONTWAIT);
@@ -402,21 +412,18 @@ static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len)
402 412
403 if (unlikely(!xsk_is_bound(xs))) 413 if (unlikely(!xsk_is_bound(xs)))
404 return -ENXIO; 414 return -ENXIO;
405 if (unlikely(!(xs->dev->flags & IFF_UP))) 415 if (unlikely(need_wait))
406 return -ENETDOWN;
407 if (unlikely(!xs->tx))
408 return -ENOBUFS;
409 if (need_wait)
410 return -EOPNOTSUPP; 416 return -EOPNOTSUPP;
411 417
412 return (xs->zc) ? xsk_zc_xmit(sk) : xsk_generic_xmit(sk, m, total_len); 418 return __xsk_sendmsg(sk);
413} 419}
414 420
415static unsigned int xsk_poll(struct file *file, struct socket *sock, 421static unsigned int xsk_poll(struct file *file, struct socket *sock,
416 struct poll_table_struct *wait) 422 struct poll_table_struct *wait)
417{ 423{
418 unsigned int mask = datagram_poll(file, sock, wait); 424 unsigned int mask = datagram_poll(file, sock, wait);
419 struct xdp_sock *xs = xdp_sk(sock->sk); 425 struct sock *sk = sock->sk;
426 struct xdp_sock *xs = xdp_sk(sk);
420 struct net_device *dev; 427 struct net_device *dev;
421 struct xdp_umem *umem; 428 struct xdp_umem *umem;
422 429
@@ -426,9 +433,14 @@ static unsigned int xsk_poll(struct file *file, struct socket *sock,
426 dev = xs->dev; 433 dev = xs->dev;
427 umem = xs->umem; 434 umem = xs->umem;
428 435
429 if (umem->need_wakeup) 436 if (umem->need_wakeup) {
430 dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, 437 if (dev->netdev_ops->ndo_xsk_wakeup)
431 umem->need_wakeup); 438 dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id,
439 umem->need_wakeup);
440 else
441 /* Poll needs to drive Tx also in copy mode */
442 __xsk_sendmsg(sk);
443 }
432 444
433 if (xs->rx && !xskq_empty_desc(xs->rx)) 445 if (xs->rx && !xskq_empty_desc(xs->rx))
434 mask |= POLLIN | POLLRDNORM; 446 mask |= POLLIN | POLLRDNORM;
diff --git a/samples/bpf/asm_goto_workaround.h b/samples/bpf/asm_goto_workaround.h
index 7409722727ca..7048bb3594d6 100644
--- a/samples/bpf/asm_goto_workaround.h
+++ b/samples/bpf/asm_goto_workaround.h
@@ -3,7 +3,8 @@
3#ifndef __ASM_GOTO_WORKAROUND_H 3#ifndef __ASM_GOTO_WORKAROUND_H
4#define __ASM_GOTO_WORKAROUND_H 4#define __ASM_GOTO_WORKAROUND_H
5 5
6/* this will bring in asm_volatile_goto macro definition 6/*
7 * This will bring in asm_volatile_goto and asm_inline macro definitions
7 * if enabled by compiler and config options. 8 * if enabled by compiler and config options.
8 */ 9 */
9#include <linux/types.h> 10#include <linux/types.h>
@@ -13,5 +14,15 @@
13#define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto") 14#define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto")
14#endif 15#endif
15 16
17/*
18 * asm_inline is defined as asm __inline in "include/linux/compiler_types.h"
19 * if supported by the kernel's CC (i.e CONFIG_CC_HAS_ASM_INLINE) which is not
20 * supported by CLANG.
21 */
22#ifdef asm_inline
23#undef asm_inline
24#define asm_inline asm
25#endif
26
16#define volatile(x...) volatile("") 27#define volatile(x...) volatile("")
17#endif 28#endif
diff --git a/samples/bpf/task_fd_query_user.c b/samples/bpf/task_fd_query_user.c
index e39938058223..4c31b305e6ef 100644
--- a/samples/bpf/task_fd_query_user.c
+++ b/samples/bpf/task_fd_query_user.c
@@ -13,6 +13,7 @@
13#include <sys/resource.h> 13#include <sys/resource.h>
14#include <sys/types.h> 14#include <sys/types.h>
15#include <sys/stat.h> 15#include <sys/stat.h>
16#include <linux/perf_event.h>
16 17
17#include "libbpf.h" 18#include "libbpf.h"
18#include "bpf_load.h" 19#include "bpf_load.h"
diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
index fbf5e4a0cb9c..5d1995fd369c 100644
--- a/tools/bpf/Makefile
+++ b/tools/bpf/Makefile
@@ -12,7 +12,11 @@ INSTALL ?= install
12CFLAGS += -Wall -O2 12CFLAGS += -Wall -O2
13CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include 13CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include
14 14
15ifeq ($(srctree),) 15# This will work when bpf is built in tools env. where srctree
16# isn't set and when invoked from selftests build, where srctree
17# is set to ".". building_out_of_srctree is undefined for in srctree
18# builds
19ifndef building_out_of_srctree
16srctree := $(patsubst %/,%,$(dir $(CURDIR))) 20srctree := $(patsubst %/,%,$(dir $(CURDIR)))
17srctree := $(patsubst %/,%,$(dir $(srctree))) 21srctree := $(patsubst %/,%,$(dir $(srctree)))
18endif 22endif
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index c6f94cffe06e..56ce6292071b 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -8,7 +8,11 @@ LIBBPF_MAJOR_VERSION := $(firstword $(subst ., ,$(LIBBPF_VERSION)))
8 8
9MAKEFLAGS += --no-print-directory 9MAKEFLAGS += --no-print-directory
10 10
11ifeq ($(srctree),) 11# This will work when bpf is built in tools env. where srctree
12# isn't set and when invoked from selftests build, where srctree
13# is a ".". building_out_of_srctree is undefined for in srctree
14# builds
15ifndef building_out_of_srctree
12srctree := $(patsubst %/,%,$(dir $(CURDIR))) 16srctree := $(patsubst %/,%,$(dir $(CURDIR)))
13srctree := $(patsubst %/,%,$(dir $(srctree))) 17srctree := $(patsubst %/,%,$(dir $(srctree)))
14srctree := $(patsubst %/,%,$(dir $(srctree))) 18srctree := $(patsubst %/,%,$(dir $(srctree)))
@@ -110,6 +114,9 @@ override CFLAGS += $(INCLUDES)
110override CFLAGS += -fvisibility=hidden 114override CFLAGS += -fvisibility=hidden
111override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 115override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
112 116
117# flags specific for shared library
118SHLIB_FLAGS := -DSHARED
119
113ifeq ($(VERBOSE),1) 120ifeq ($(VERBOSE),1)
114 Q = 121 Q =
115else 122else
@@ -126,14 +133,17 @@ all:
126export srctree OUTPUT CC LD CFLAGS V 133export srctree OUTPUT CC LD CFLAGS V
127include $(srctree)/tools/build/Makefile.include 134include $(srctree)/tools/build/Makefile.include
128 135
129BPF_IN := $(OUTPUT)libbpf-in.o 136SHARED_OBJDIR := $(OUTPUT)sharedobjs/
137STATIC_OBJDIR := $(OUTPUT)staticobjs/
138BPF_IN_SHARED := $(SHARED_OBJDIR)libbpf-in.o
139BPF_IN_STATIC := $(STATIC_OBJDIR)libbpf-in.o
130VERSION_SCRIPT := libbpf.map 140VERSION_SCRIPT := libbpf.map
131 141
132LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET)) 142LIB_TARGET := $(addprefix $(OUTPUT),$(LIB_TARGET))
133LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE)) 143LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
134PC_FILE := $(addprefix $(OUTPUT),$(PC_FILE)) 144PC_FILE := $(addprefix $(OUTPUT),$(PC_FILE))
135 145
136GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN) | \ 146GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
137 cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \ 147 cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
138 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}' | \ 148 awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}' | \
139 sort -u | wc -l) 149 sort -u | wc -l)
@@ -155,7 +165,7 @@ all: fixdep
155 165
156all_cmd: $(CMD_TARGETS) check 166all_cmd: $(CMD_TARGETS) check
157 167
158$(BPF_IN): force elfdep bpfdep 168$(BPF_IN_SHARED): force elfdep bpfdep
159 @(test -f ../../include/uapi/linux/bpf.h -a -f ../../../include/uapi/linux/bpf.h && ( \ 169 @(test -f ../../include/uapi/linux/bpf.h -a -f ../../../include/uapi/linux/bpf.h && ( \
160 (diff -B ../../include/uapi/linux/bpf.h ../../../include/uapi/linux/bpf.h >/dev/null) || \ 170 (diff -B ../../include/uapi/linux/bpf.h ../../../include/uapi/linux/bpf.h >/dev/null) || \
161 echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'" >&2 )) || true 171 echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'" >&2 )) || true
@@ -171,17 +181,20 @@ $(BPF_IN): force elfdep bpfdep
171 @(test -f ../../include/uapi/linux/if_xdp.h -a -f ../../../include/uapi/linux/if_xdp.h && ( \ 181 @(test -f ../../include/uapi/linux/if_xdp.h -a -f ../../../include/uapi/linux/if_xdp.h && ( \
172 (diff -B ../../include/uapi/linux/if_xdp.h ../../../include/uapi/linux/if_xdp.h >/dev/null) || \ 182 (diff -B ../../include/uapi/linux/if_xdp.h ../../../include/uapi/linux/if_xdp.h >/dev/null) || \
173 echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/if_xdp.h' differs from latest version at 'include/uapi/linux/if_xdp.h'" >&2 )) || true 183 echo "Warning: Kernel ABI header at 'tools/include/uapi/linux/if_xdp.h' differs from latest version at 'include/uapi/linux/if_xdp.h'" >&2 )) || true
174 $(Q)$(MAKE) $(build)=libbpf 184 $(Q)$(MAKE) $(build)=libbpf OUTPUT=$(SHARED_OBJDIR) CFLAGS="$(CFLAGS) $(SHLIB_FLAGS)"
185
186$(BPF_IN_STATIC): force elfdep bpfdep
187 $(Q)$(MAKE) $(build)=libbpf OUTPUT=$(STATIC_OBJDIR)
175 188
176$(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION) 189$(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION)
177 190
178$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN) 191$(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN_SHARED)
179 $(QUIET_LINK)$(CC) --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \ 192 $(QUIET_LINK)$(CC) --shared -Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \
180 -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@ 193 -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@
181 @ln -sf $(@F) $(OUTPUT)libbpf.so 194 @ln -sf $(@F) $(OUTPUT)libbpf.so
182 @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION) 195 @ln -sf $(@F) $(OUTPUT)libbpf.so.$(LIBBPF_MAJOR_VERSION)
183 196
184$(OUTPUT)libbpf.a: $(BPF_IN) 197$(OUTPUT)libbpf.a: $(BPF_IN_STATIC)
185 $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^ 198 $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
186 199
187$(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a 200$(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a
@@ -197,7 +210,7 @@ check: check_abi
197 210
198check_abi: $(OUTPUT)libbpf.so 211check_abi: $(OUTPUT)libbpf.so
199 @if [ "$(GLOBAL_SYM_COUNT)" != "$(VERSIONED_SYM_COUNT)" ]; then \ 212 @if [ "$(GLOBAL_SYM_COUNT)" != "$(VERSIONED_SYM_COUNT)" ]; then \
200 echo "Warning: Num of global symbols in $(BPF_IN)" \ 213 echo "Warning: Num of global symbols in $(BPF_IN_SHARED)" \
201 "($(GLOBAL_SYM_COUNT)) does NOT match with num of" \ 214 "($(GLOBAL_SYM_COUNT)) does NOT match with num of" \
202 "versioned symbols in $^ ($(VERSIONED_SYM_COUNT))." \ 215 "versioned symbols in $^ ($(VERSIONED_SYM_COUNT))." \
203 "Please make sure all LIBBPF_API symbols are" \ 216 "Please make sure all LIBBPF_API symbols are" \
@@ -255,9 +268,9 @@ config-clean:
255 $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null 268 $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null
256 269
257clean: 270clean:
258 $(call QUIET_CLEAN, libbpf) $(RM) $(TARGETS) $(CXX_TEST_TARGET) \ 271 $(call QUIET_CLEAN, libbpf) $(RM) -rf $(TARGETS) $(CXX_TEST_TARGET) \
259 *.o *~ *.a *.so *.so.$(LIBBPF_MAJOR_VERSION) .*.d .*.cmd \ 272 *.o *~ *.a *.so *.so.$(LIBBPF_MAJOR_VERSION) .*.d .*.cmd \
260 *.pc LIBBPF-CFLAGS 273 *.pc LIBBPF-CFLAGS $(SHARED_OBJDIR) $(STATIC_OBJDIR)
261 $(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf 274 $(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
262 275
263 276
diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h
index 2e83a34f8c79..98216a69c32f 100644
--- a/tools/lib/bpf/libbpf_internal.h
+++ b/tools/lib/bpf/libbpf_internal.h
@@ -34,6 +34,22 @@
34 (offsetof(TYPE, FIELD) + sizeof(((TYPE *)0)->FIELD)) 34 (offsetof(TYPE, FIELD) + sizeof(((TYPE *)0)->FIELD))
35#endif 35#endif
36 36
37/* Symbol versioning is different between static and shared library.
38 * Properly versioned symbols are needed for shared library, but
39 * only the symbol of the new version is needed for static library.
40 */
41#ifdef SHARED
42# define COMPAT_VERSION(internal_name, api_name, version) \
43 asm(".symver " #internal_name "," #api_name "@" #version);
44# define DEFAULT_VERSION(internal_name, api_name, version) \
45 asm(".symver " #internal_name "," #api_name "@@" #version);
46#else
47# define COMPAT_VERSION(internal_name, api_name, version)
48# define DEFAULT_VERSION(internal_name, api_name, version) \
49 extern typeof(internal_name) api_name \
50 __attribute__((alias(#internal_name)));
51#endif
52
37extern void libbpf_print(enum libbpf_print_level level, 53extern void libbpf_print(enum libbpf_print_level level,
38 const char *format, ...) 54 const char *format, ...)
39 __attribute__((format(printf, 2, 3))); 55 __attribute__((format(printf, 2, 3)));
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index 24fa313524fb..a902838f9fcc 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -261,8 +261,8 @@ int xsk_umem__create_v0_0_2(struct xsk_umem **umem_ptr, void *umem_area,
261 return xsk_umem__create_v0_0_4(umem_ptr, umem_area, size, fill, comp, 261 return xsk_umem__create_v0_0_4(umem_ptr, umem_area, size, fill, comp,
262 &config); 262 &config);
263} 263}
264asm(".symver xsk_umem__create_v0_0_2, xsk_umem__create@LIBBPF_0.0.2"); 264COMPAT_VERSION(xsk_umem__create_v0_0_2, xsk_umem__create, LIBBPF_0.0.2)
265asm(".symver xsk_umem__create_v0_0_4, xsk_umem__create@@LIBBPF_0.0.4"); 265DEFAULT_VERSION(xsk_umem__create_v0_0_4, xsk_umem__create, LIBBPF_0.0.4)
266 266
267static int xsk_load_xdp_prog(struct xsk_socket *xsk) 267static int xsk_load_xdp_prog(struct xsk_socket *xsk)
268{ 268{
diff --git a/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c b/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
index 6cbeea7b4bf1..8547ecbdc61f 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
@@ -195,7 +195,7 @@ static void run_test(int cgroup_fd)
195 195
196 if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread, 196 if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread,
197 (void *)&server_fd))) 197 (void *)&server_fd)))
198 goto close_bpf_object; 198 goto close_server_fd;
199 199
200 pthread_mutex_lock(&server_started_mtx); 200 pthread_mutex_lock(&server_started_mtx);
201 pthread_cond_wait(&server_started, &server_started_mtx); 201 pthread_cond_wait(&server_started, &server_started_mtx);
diff --git a/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c b/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c
index a82da555b1b0..f4cd60d6fba2 100644
--- a/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c
+++ b/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c
@@ -260,13 +260,14 @@ void test_tcp_rtt(void)
260 260
261 if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread, 261 if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread,
262 (void *)&server_fd))) 262 (void *)&server_fd)))
263 goto close_cgroup_fd; 263 goto close_server_fd;
264 264
265 pthread_mutex_lock(&server_started_mtx); 265 pthread_mutex_lock(&server_started_mtx);
266 pthread_cond_wait(&server_started, &server_started_mtx); 266 pthread_cond_wait(&server_started, &server_started_mtx);
267 pthread_mutex_unlock(&server_started_mtx); 267 pthread_mutex_unlock(&server_started_mtx);
268 268
269 CHECK_FAIL(run_test(cgroup_fd, server_fd)); 269 CHECK_FAIL(run_test(cgroup_fd, server_fd));
270close_server_fd:
270 close(server_fd); 271 close(server_fd);
271close_cgroup_fd: 272close_cgroup_fd:
272 close(cgroup_fd); 273 close(cgroup_fd);
diff --git a/tools/testing/selftests/bpf/test_flow_dissector.sh b/tools/testing/selftests/bpf/test_flow_dissector.sh
index d23d4da66b83..e2d06191bd35 100755
--- a/tools/testing/selftests/bpf/test_flow_dissector.sh
+++ b/tools/testing/selftests/bpf/test_flow_dissector.sh
@@ -63,6 +63,9 @@ fi
63 63
64# Setup 64# Setup
65tc qdisc add dev lo ingress 65tc qdisc add dev lo ingress
66echo 0 > /proc/sys/net/ipv4/conf/default/rp_filter
67echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
68echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter
66 69
67echo "Testing IPv4..." 70echo "Testing IPv4..."
68# Drops all IP/UDP packets coming from port 9 71# Drops all IP/UDP packets coming from port 9
diff --git a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh
index acf7a74f97cd..59ea56945e6c 100755
--- a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh
+++ b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh
@@ -314,15 +314,15 @@ test_gso()
314 command -v nc >/dev/null 2>&1 || \ 314 command -v nc >/dev/null 2>&1 || \
315 { echo >&2 "nc is not available: skipping TSO tests"; return; } 315 { echo >&2 "nc is not available: skipping TSO tests"; return; }
316 316
317 # listen on IPv*_DST, capture TCP into $TMPFILE 317 # listen on port 9000, capture TCP into $TMPFILE
318 if [ "${PROTO}" == "IPv4" ] ; then 318 if [ "${PROTO}" == "IPv4" ] ; then
319 IP_DST=${IPv4_DST} 319 IP_DST=${IPv4_DST}
320 ip netns exec ${NS3} bash -c \ 320 ip netns exec ${NS3} bash -c \
321 "nc -4 -l -s ${IPv4_DST} -p 9000 > ${TMPFILE} &" 321 "nc -4 -l -p 9000 > ${TMPFILE} &"
322 elif [ "${PROTO}" == "IPv6" ] ; then 322 elif [ "${PROTO}" == "IPv6" ] ; then
323 IP_DST=${IPv6_DST} 323 IP_DST=${IPv6_DST}
324 ip netns exec ${NS3} bash -c \ 324 ip netns exec ${NS3} bash -c \
325 "nc -6 -l -s ${IPv6_DST} -p 9000 > ${TMPFILE} &" 325 "nc -6 -l -p 9000 > ${TMPFILE} &"
326 RET=$? 326 RET=$?
327 else 327 else
328 echo " test_gso: unknown PROTO: ${PROTO}" 328 echo " test_gso: unknown PROTO: ${PROTO}"