mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 22:54:01 +00:00
selftests/bpf: Fix sk lookup usage in test_sock_addr
Semantic of netns_id argument of bpf_sk_lookup_tcp and bpf_sk_lookup_udp was changed (fixed) inf71c6143c2
. Corresponding changes have to be applied to all call sites in selftests. The patch fixes corresponding call sites in test_sock_addr test: pass BPF_F_CURRENT_NETNS instead of 0 in netns_id argument. Fixes:f71c6143c2
("bpf: Support sk lookup in netns with id 0") Reported-by: Yonghong Song <yhs@fb.com> Signed-off-by: Andrey Ignatov <rdna@fb.com> Acked-by: Joe Stringer <joe@wand.net.nz> Tested-by: Yonghong Song <yhs@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
9f8c1c5712
commit
28c1272914
2 changed files with 8 additions and 4 deletions
|
@ -35,9 +35,11 @@ int connect_v4_prog(struct bpf_sock_addr *ctx)
|
||||||
if (ctx->type != SOCK_STREAM && ctx->type != SOCK_DGRAM)
|
if (ctx->type != SOCK_STREAM && ctx->type != SOCK_DGRAM)
|
||||||
return 0;
|
return 0;
|
||||||
else if (ctx->type == SOCK_STREAM)
|
else if (ctx->type == SOCK_STREAM)
|
||||||
sk = bpf_sk_lookup_tcp(ctx, &tuple, sizeof(tuple.ipv4), 0, 0);
|
sk = bpf_sk_lookup_tcp(ctx, &tuple, sizeof(tuple.ipv4),
|
||||||
|
BPF_F_CURRENT_NETNS, 0);
|
||||||
else
|
else
|
||||||
sk = bpf_sk_lookup_udp(ctx, &tuple, sizeof(tuple.ipv4), 0, 0);
|
sk = bpf_sk_lookup_udp(ctx, &tuple, sizeof(tuple.ipv4),
|
||||||
|
BPF_F_CURRENT_NETNS, 0);
|
||||||
|
|
||||||
if (!sk)
|
if (!sk)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -47,9 +47,11 @@ int connect_v6_prog(struct bpf_sock_addr *ctx)
|
||||||
if (ctx->type != SOCK_STREAM && ctx->type != SOCK_DGRAM)
|
if (ctx->type != SOCK_STREAM && ctx->type != SOCK_DGRAM)
|
||||||
return 0;
|
return 0;
|
||||||
else if (ctx->type == SOCK_STREAM)
|
else if (ctx->type == SOCK_STREAM)
|
||||||
sk = bpf_sk_lookup_tcp(ctx, &tuple, sizeof(tuple.ipv6), 0, 0);
|
sk = bpf_sk_lookup_tcp(ctx, &tuple, sizeof(tuple.ipv6),
|
||||||
|
BPF_F_CURRENT_NETNS, 0);
|
||||||
else
|
else
|
||||||
sk = bpf_sk_lookup_udp(ctx, &tuple, sizeof(tuple.ipv6), 0, 0);
|
sk = bpf_sk_lookup_udp(ctx, &tuple, sizeof(tuple.ipv6),
|
||||||
|
BPF_F_CURRENT_NETNS, 0);
|
||||||
|
|
||||||
if (!sk)
|
if (!sk)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue