() or ping_v4_sendmsg() IP options
have to be freed if they were allocated previously.
Add label so that future callers (if any) can use it instead of kfree()
before return that is easy to forget.
Fixes: c319b4d76b9e (net: ipv4: add IPPROTO_ICMP socket kind)
Signed-off-by: Andrey Ignatov <r...@fb.
libbpf can guess prog type and expected attach type based on section
name. Add hints for "cgroup/sendmsg4" and "cgroup/sendmsg6" section
names.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau &
(asm) .. [PASS]
Test case: sendmsg6: rewrite IP & port (C) .. [PASS]
Test case: sendmsg6: IPv4-mapped IPv6 .. [PASS]
Test case: sendmsg6: deny call .. [PASS]
Summary: 27 PASSED, 0 FAILED
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org
`;
* `msg_src_ip4` to set source IPv4 for UDPv4;
* `msg_src_ip6` to set source IPv6 for UDPv6.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
---
include/linux/bpf-cgroup.h | 23 +--
include/linux/filter.h | 1 +
include/uapi/linux/
rite IP & TCP port .. [PASS]
Test case: connect6: rewrite IP & UDP port .. [PASS]
Summary: 16 PASSED, 0 FAILED
(stderr contains errors from libbpf when testing load/attach with
invalid arguments)
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a..
lar to sys_connect hooks, sys_sendmsg ones can be used to make system
calls such as sendmsg(2) and sendto(2) return EPERM.
Please see patch 0001 for more details.
Andrey Ignatov (5):
bpf: Hooks for sys_sendmsg
bpf: Sync bpf.h to tools/
libbpf: Support guessing sendmsg{4,6} progs
selftests/bpf: Prep
Sync new `BPF_CGROUP_UDP4_SENDMSG` and `BPF_CGROUP_UDP6_SENDMSG`
attach types to tools/.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau <ka...@fb.com>
---
tools/include/uapi/linux/bpf.h | 8
`;
* `msg_src_ip4` to set source IPv4 for UDPv4;
* `msg_src_ip6` to set source IPv6 for UDPv6.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau <ka...@fb.com>
---
include/linux/bpf-cgroup.h | 23 +--
incl
e details.
Andrey Ignatov (6):
bpf: Define cgroup_bpf_enabled for CONFIG_CGROUP_BPF=n
bpf: Hooks for sys_sendmsg
bpf: Sync bpf.h to tools/
libbpf: Support guessing sendmsg{4,6} progs
selftests/bpf: Prepare test_sock_addr for extension
selftests/bpf: Selftest for sys_sendmsg hooks
incl
Sync new `BPF_CGROUP_UDP4_SENDMSG` and `BPF_CGROUP_UDP6_SENDMSG`
attach types to tools/.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau <ka...@fb.com>
---
tools/include/uapi/linux/bpf.h | 8
rite IP & TCP port .. [PASS]
Test case: connect6: rewrite IP & UDP port .. [PASS]
Summary: 16 PASSED, 0 FAILED
(stderr contains errors from libbpf when testing load/attach with
invalid arguments)
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a..
(asm) .. [PASS]
Test case: sendmsg6: rewrite IP & port (C) .. [PASS]
Test case: sendmsg6: IPv4-mapped IPv6 .. [PASS]
Test case: sendmsg6: deny call .. [PASS]
Summary: 27 PASSED, 0 FAILED
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org
BPF_CGROUP_RUN_PROG_* macros that
defined for both states of CONFIG_CGROUP_BPF.
Signed-off-by: Andrey Ignatov <r...@fb.com>
---
include/linux/bpf-cgroup.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index 30d15e6..de8e89a
libbpf can guess prog type and expected attach type based on section
name. Add hints for "cgroup/sendmsg4" and "cgroup/sendmsg6" section
names.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau &
install_headers target should contain all headers that are part of
libbpf. Add missing btf.h
Signed-off-by: Andrey Ignatov <r...@fb.com>
---
tools/lib/bpf/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index f3fab4a..5390e77
Daniel Borkmann <dan...@iogearbox.net> [Thu, 2018-05-24 18:00 -0700]:
> On 05/23/2018 01:40 AM, Andrey Ignatov wrote:
> [...]
> > diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> > index ff4d4ba..a1f9ba2 100644
> > --- a/net/ipv4/udp.c
> > +++ b/net/ipv4/udp.c
>
(asm) .. [PASS]
Test case: sendmsg6: rewrite IP & port (C) .. [PASS]
Test case: sendmsg6: IPv4-mapped IPv6 .. [PASS]
Test case: sendmsg6: deny call .. [PASS]
Summary: 27 PASSED, 0 FAILED
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org
ed UDP is handled by sys_connect hooks, unconnected by
sys_sendmsg ones.
Similar to sys_connect hooks, sys_sendmsg ones can be used to make system
calls such as sendmsg(2) and sendto(2) return EPERM.
Please see patch 0001 for more details.
Andrey Ignatov (5):
bpf: Hooks for sys_sendmsg
bpf
`;
* `msg_src_ip4` to set source IPv4 for UDPv4;
* `msg_src_ip6` to set source IPv6 for UDPv6.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau <ka...@fb.com>
---
include/linux/bpf-cgroup.h | 23 +--
incl
libbpf can guess prog type and expected attach type based on section
name. Add hints for "cgroup/sendmsg4" and "cgroup/sendmsg6" section
names.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau &
rite IP & TCP port .. [PASS]
Test case: connect6: rewrite IP & UDP port .. [PASS]
Summary: 16 PASSED, 0 FAILED
(stderr contains errors from libbpf when testing load/attach with
invalid arguments)
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a..
Sync new `BPF_CGROUP_UDP4_SENDMSG` and `BPF_CGROUP_UDP6_SENDMSG`
attach types to tools/.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau <ka...@fb.com>
---
tools/include/uapi/linux/bpf.h | 8
Martin KaFai Lau <ka...@fb.com> [Mon, 2018-05-21 16:17 -0700]:
> On Fri, May 18, 2018 at 07:21:09PM -0700, Andrey Ignatov wrote:
[...]
> > diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> > index 2839c1b..6f580ea 100644
> > --- a/net/ipv6/udp.c
> > +++ b/net/ipv6/udp
(asm) .. [PASS]
Test case: sendmsg6: rewrite IP & port (C) .. [PASS]
Test case: sendmsg6: deny call .. [PASS]
Summary: 26 PASSED, 0 FAILED
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
---
tools/testing/selftests/bpf/Makefile
libbpf can guess prog type and expected attach type based on section
name. Add hints for "cgroup/sendmsg4" and "cgroup/sendmsg6" section
names.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
---
tools/lib/bpf/li
. This makes UDP support
complete: connected UDP is handled by sys_connect hooks, unconnected by
sys_sendmsg ones.
Similar to sys_connect hooks, sys_sendmsg ones can be used to make system
calls such as sendmsg(2) and sendto(2) return EPERM.
Please see patch 0001 for more details.
Andrey Ignatov (5
`;
* `msg_src_ip4` to set source IPv4 for UDPv4;
* `msg_src_ip6` to set source IPv6 for UDPv6.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
---
include/linux/bpf-cgroup.h | 23 +--
include/linux/filter.h | 1 +
include/uapi/linux/
rite IP & TCP port .. [PASS]
Test case: connect6: rewrite IP & UDP port .. [PASS]
Summary: 16 PASSED, 0 FAILED
(stderr contains errors from libbpf when testing load/attach with
invalid arguments)
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@
Sync new `BPF_CGROUP_UDP4_SENDMSG` and `BPF_CGROUP_UDP6_SENDMSG`
attach types to tools/.
Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Alexei Starovoitov <a...@kernel.org>
---
tools/include/uapi/linux/bpf.h | 8
1 file changed, 8 insertions(+)
diff --git a/tools/
Add support for recently added BPF_CGROUP_UDP4_SENDMSG and
BPF_CGROUP_UDP6_SENDMSG attach types to bpftool, update documentation
and bash completion.
Signed-off-by: Andrey Ignatov
---
I'm not sure about "since 4.18" in Documentation part. I can follow-up when
the next kernel versio
is already covered by BPF_CGROUP_INET{4,6}_CONNECT and
the only missing piece is selftest. The patch adds selftest for TFO.
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf/test_sock_addr.c | 37
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/tools/testing
The patch syncs bpf.h to tools/.
Signed-off-by: Andrey Ignatov <r...@fb.com>
---
tools/include/uapi/linux/bpf.h | 12 ++--
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index da77a93..730f448
to `_kern` structures in BPF helpers
description by corresponding user visible structures.
Signed-off-by: Andrey Ignatov <r...@fb.com>
---
include/uapi/linux/bpf.h | 12 ++--
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux
BPF helpers documentation in UAPI refers to kernel ctx structures when it
has to refer to user visible ones. Fix it.
Andrey Ignatov (2):
bpf: Fix helpers ctx struct types in uapi doc
bpf: Sync bpf.h to tools/
include/uapi/linux/bpf.h | 12 ++--
tools/include/uapi/linux/bpf.h
.
Patch 4 adds selftest for new functionality.
Andrey Ignatov (4):
bpf: Support bpf_get_socket_cookie in more prog types
bpf: Sync bpf.h to tools/
selftests/bpf: Add bpf_get_socket_cookie to bpf_helpers.h
selftests/bpf: Test for get_socket_cookie
include/uapi/linux/bpf.h
bpf_get_socket_cookie() but adds support to this helper to accept
`struct bpf_sock_addr` and `struct bpf_sock_ops`.
Documentation in bpf.h is changed in a way that should not break
automatic generation of markdown.
Signed-off-by: Andrey Ignatov
---
include/uapi/linux/bpf.h | 14 ++
net
Add missing helper to bpf_helpers.h that is used in tests and samples.
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf/bpf_helpers.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/bpf_helpers.h
b/tools/testing/selftests/bpf/bpf_helpers.h
index
Sync bpf_get_socket_cookie() related bpf UAPI changes to tools/.
Signed-off-by: Andrey Ignatov
---
tools/include/uapi/linux/bpf.h | 14 ++
1 file changed, 14 insertions(+)
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 870113916cac..0ebaaf7f3568
y the test verifies the value in the map.
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf/Makefile | 6 +-
.../selftests/bpf/socket_cookie_prog.c| 60 +
.../selftests/bpf/test_socket_cookie.c| 249 ++
3 files changed, 313 insert
Sync bpf_get_socket_cookie() related bpf UAPI changes to tools/.
Signed-off-by: Andrey Ignatov
Acked-by: Yonghong Song
---
tools/include/uapi/linux/bpf.h | 14 ++
1 file changed, 14 insertions(+)
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index
bpf_get_socket_cookie() but adds support to this helper to accept
`struct bpf_sock_addr` and `struct bpf_sock_ops`.
Documentation in bpf.h is changed in a way that should not break
automatic generation of markdown.
Signed-off-by: Andrey Ignatov
Acked-by: Yonghong Song
---
include/uapi/linux/bpf.h
ges to tools/.
Patch 3 adds missing helper to bpf_helpers.h.
Patch 4 adds selftest for new functionality.
Andrey Ignatov (4):
bpf: Support bpf_get_socket_cookie in more prog types
bpf: Sync bpf.h to tools/
selftests/bpf: Add bpf_get_socket_cookie to bpf_helpers.h
selftests/bpf: T
y the test verifies the value in the map.
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf/Makefile | 6 +-
.../selftests/bpf/socket_cookie_prog.c| 60 +
.../selftests/bpf/test_socket_cookie.c| 225 ++
3 files changed, 289 insert
Add missing helper to bpf_helpers.h that is used in tests and samples.
Signed-off-by: Andrey Ignatov
Acked-by: Yonghong Song
---
tools/testing/selftests/bpf/bpf_helpers.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/bpf_helpers.h
b/tools/testing/selftests
Yonghong Song [Mon, 2018-07-30 16:59 -0700]:
>
>
> On 7/30/18 9:04 AM, Andrey Ignatov wrote:
> > Add test to use get_socket_cookie() from BPF programs of types
> > BPF_PROG_TYPE_SOCK_OPS and BPF_PROG_TYPE_CGROUP_SOCK_ADDR.
> >
> > The test attaches two pr
Add bpf_skb_cgroup_id and bpf_skb_ancestor_cgroup_id helpers to
bpf_helpers.h to use them in tests and samples.
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf/bpf_helpers.h | 4
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/bpf/bpf_helpers.h
b/tools
:
# ./test_skb_cgroup_id.sh
Wait for testing link-local IP to become available ... OK
Note: 8 bytes struct bpf_elf_map fixup performed due to size mismatch!
[PASS]
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf/Makefile | 9 +-
.../selftests/bpf/test_skb_cgroup_id.sh | 61
with skb.
Patch 0001 provides more details and describes use-cases.
Patch 0002 syncs UAPI changes to tools/.
Patch 0003 adds skb*cgroup_id helpers to bpf_helper.h header.
Patch 0004 adds selftest for the new helper and is an example of usage.
Andrey Ignatov (4):
bpf: Introduce
Sync skb_ancestor_cgroup_id() related bpf UAPI changes to tools/.
Signed-off-by: Andrey Ignatov
---
tools/include/uapi/linux/bpf.h | 21 -
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index
's not obviously better).
Format of return value of the new helper is same as that of
bpf_skb_cgroup_id.
Signed-off-by: Andrey Ignatov
---
include/linux/cgroup.h | 30 ++
include/uapi/linux/bpf.h | 21 -
net/core/filter.c| 28 ++
Add bpf_skb_cgroup_id and bpf_skb_ancestor_cgroup_id helpers to
bpf_helpers.h to use them in tests and samples.
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf/bpf_helpers.h | 4
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/bpf/bpf_helpers.h
b/tools
:
# ./test_skb_cgroup_id.sh
Wait for testing link-local IP to become available ... OK
Note: 8 bytes struct bpf_elf_map fixup performed due to size mismatch!
[PASS]
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf/Makefile | 9 +-
.../selftests/bpf/test_skb_cgroup_id.sh | 62
per and is an example of usage.
Andrey Ignatov (4):
bpf: Introduce bpf_skb_ancestor_cgroup_id helper
bpf: Sync bpf.h to tools/
selftests/bpf: Add cgroup id helpers to bpf_helpers.h
selftests/bpf: Selftest for bpf_skb_ancestor_cgroup_id
include/linux/cgroup.h| 30 +++
incl
's not obviously better).
Format of return value of the new helper is same as that of
bpf_skb_cgroup_id.
Signed-off-by: Andrey Ignatov
---
include/linux/cgroup.h | 30 ++
include/uapi/linux/bpf.h | 21 -
net/core/filter.c| 28 ++
Sync skb_ancestor_cgroup_id() related bpf UAPI changes to tools/.
Signed-off-by: Andrey Ignatov
---
tools/include/uapi/linux/bpf.h | 21 -
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index
Yonghong Song [Sat, 2018-08-11 23:59 -0700]:
>
>
> On 8/10/18 10:35 PM, Andrey Ignatov wrote:
> > Add selftests for bpf_skb_ancestor_cgroup_id helper.
> >
> > test_skb_cgroup_id.sh prepares testing interface and adds tc qdisc and
> > filter for
Tejun Heo [Mon, 2018-08-13 07:47 -0700]:
> Hello, Andrey.
Hey Tejun!
> On Fri, Aug 10, 2018 at 10:35:23PM -0700, Andrey Ignatov wrote:
> > +static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp,
> > +int ancestor_level)
>
used across API many times and will be
more consistent, when "title" is used just once (IMO
bpf_program__title() should have been called bpf_program__name() to be
consistent with bpf_map__name() and others, not sure if it's fine to
change now).
> +enum bpf_attach_type *expected_attach_type);
> +
> /* Accessors of bpf_program */
> struct bpf_program;
> struct bpf_program *bpf_program__next(struct bpf_program *prog,
> --
> 2.17.1
>
--
Andrey Ignatov
pf_object__open_buffer() below), where path is not needed.
Otherwise, if bpf_object__open_buffer() has to be extended in the
future, another _xattr function will be needed (or caller would need to
pass NULL to path, what would make API less convenient).
> struct bpf_object *bpf_object__open_buffer(void *obj_buf,
> size_t obj_buf_sz,
> const char *name);
> --
> 2.17.1
>
--
Andrey Ignatov
Jakub Kicinski [Mon, 2018-07-09 19:49 -0700]:
> On Mon, 9 Jul 2018 13:22:54 -0700, Andrey Ignatov wrote:
> > Jakub Kicinski [Mon, 2018-07-09 11:01 -0700]:
> > > More advanced applications may want to only replace programs without
> > > destroying associated maps. Al
p *map, void *priv,
> bpf_map_clear_priv_t clear_priv);
> void *bpf_map__priv(struct bpf_map *map);
> +int bpf_map__reuse_fd(struct bpf_map *map, int fd);
> bool bpf_map__is_offload_neutral(struct bpf_map *map);
> void bpf_map__set_ifindex(struct bpf_map *map, __u32 ifindex);
> int bpf_map__pin(struct bpf_map *map, const char *path);
> --
> 2.17.1
>
--
Andrey Ignatov
bpf_object_clear_priv_t clear_priv);
> void *bpf_object__priv(struct bpf_object *prog);
>
> +int libbpf_prog_type_by_name(const char *name, enum bpf_prog_type *prog_type,
> + enum bpf_attach_type *expected_attach_type);
> +
> /* Accessors of bpf_program */
> struct bpf_program;
> struct bpf_program *bpf_program__next(struct bpf_program *prog,
> --
> 2.17.1
>
Thanks for changes Jakub!
Acked-by: Andrey Ignatov
--
Andrey Ignatov
+261,7 @@ typedef void (*bpf_map_clear_priv_t)(struct bpf_map *,
> void *);
> int bpf_map__set_priv(struct bpf_map *map, void *priv,
> bpf_map_clear_priv_t clear_priv);
> void *bpf_map__priv(struct bpf_map *map);
> +int bpf_map__reuse_fd(struct bpf_map *ma
;
> + enum bpf_prog_type prog_type;
> +};
> +
> struct bpf_object *bpf_object__open(const char *path);
> +struct bpf_object *bpf_object__open_xattr(struct bpf_object_open_attr *attr);
> struct bpf_object *bpf_object__open_buffer(void *obj_buf,
> size_t obj_buf_sz,
> const char *name);
> --
> 2.17.1
>
Acked-by: Andrey Ignatov
--
Andrey Ignatov
unexpected field is
printed.
Signed-off-by: Andrey Ignatov
Acked-by: Alexei Starovoitov
---
.../testing/selftests/bpf/test_tcpbpf_user.c | 64 +++
1 file changed, 39 insertions(+), 25 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_tcpbpf_user.c
b/tools/testing/selftests
Lack of const in cgroup helpers signatures forces to write ugly client
code. Fix it.
Signed-off-by: Andrey Ignatov
Acked-by: Alexei Starovoitov
---
tools/testing/selftests/bpf/cgroup_helpers.c | 6 +++---
tools/testing/selftests/bpf/cgroup_helpers.h | 6 +++---
2 files changed, 6 insertions
This patchset adds TCP-BPF callback for listening sockets.
Patch 0001 provides more details and is the main patch in the set.
Patch 0006 adds selftest for the new callback.
Other patches are bug fixes and improvements in TCP-BPF selftest to make it
easier to extend in 0006.
Andrey Ignatov (6
.
Signed-off-by: Andrey Ignatov
Acked-by: Alexei Starovoitov
---
include/uapi/linux/bpf.h | 3 +++
net/ipv4/af_inet.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index b7db3261c62d..aa11cdcbfcaf 100644
--- a/include/uapi/linux
ser space later.
Signed-off-by: Andrey Ignatov
Acked-by: Alexei Starovoitov
---
tools/testing/selftests/bpf/test_tcpbpf.h | 1 +
tools/testing/selftests/bpf/test_tcpbpf_kern.c | 17 -
tools/testing/selftests/bpf/test_tcpbpf_user.c | 4 +++-
3 files changed, 16 insertions(+)
Switch to cgroup_helpers to simplify the code and fix cgroup cleanup:
before cgroup was not cleaned up after the test.
It also removes SYSTEM macro, that only printed error, but didn't
terminate the test.
Signed-off-by: Andrey Ignatov
Acked-by: Alexei Starovoitov
---
tools/testing/selftests
Sync BPF_SOCK_OPS_TCP_LISTEN_CB related UAPI changes to tools/.
Signed-off-by: Andrey Ignatov
Acked-by: Alexei Starovoitov
---
tools/include/uapi/linux/bpf.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index
ot;) is not relevant to
bpf_bind() and should be removed. It's about sys_connect hook itself
that can call to bpf_bind() but also has other functionality (and that
other functionality is described by this paragraph).
--
Andrey Ignatov
The patch looks good to me.
Acked-by: Andrey Ignatov <r...@fb.com>
Thanks for improving the tests, Yonghong!
Yonghong Song <y...@fb.com> [Wed, 2018-04-18 10:49 -0700]:
> The bpf selftests test_sock and test_sock_addr.sh failed
> in my test machine. The failure looks like:
&
E`, for backward compatibility.
Signed-off-by: Andrey Ignatov <r...@fb.com>
---
tools/lib/bpf/libbpf.c | 6 ++
1 file changed, 6 insertions(+)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 5922443..0fcc447 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf
Add support for various BPF prog types and attach types that have been added to
kernel recently but not to bpftool or libbpf yet.
Andrey Ignatov (3):
bpftool: Add missing prog types and attach types
libbpf: Support guessing post_bind{4,6} progs
libbpf: Type functions for raw tracepoints
Add missing prog types to `bpftool prog` and missing attach types to
`bpftool cgroup`.
Signed-off-by: Andrey Ignatov <r...@fb.com>
---
tools/bpf/bpftool/cgroup.c | 19 ---
tools/bpf/bpftool/prog.c | 3 +++
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a
Add missing pieces for BPF_PROG_TYPE_RAW_TRACEPOINT in libbpf:
* is- and set- functions;
* support guessing prog type.
Signed-off-by: Andrey Ignatov <r...@fb.com>
---
tools/lib/bpf/libbpf.c | 2 ++
tools/lib/bpf/libbpf.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/tools/l
This tracepoint was replaced by inet_sock_set_state in 563e0bb and not
used anywhere in the kernel anymore. Remove it.
Signed-off-by: Andrey Ignatov <r...@fb.com>
---
include/trace/events/tcp.h | 47 --
1 file changed, 47 deletions(-)
diff
Add recently added prog types to `bpftool prog` and attach types to
`bpftool cgroup`.
Update bpftool documentation and bash completion appropriately.
Signed-off-by: Andrey Ignatov <r...@fb.com>
---
tools/bpf/bpftool/Documentation/bpftool-cgroup.rst | 11 +--
tools/bpf/bpftoo
v1->v2:
- add new types to bpftool-cgroup man page;
- add new types to bash completion for bpftool;
- don't add types that should not be in bpftool cgroup.
Add support for various BPF prog types and attach types that have been
added to kernel recently but not to bpftool or libbpf yet.
And
E`, for backward compatibility.
Signed-off-by: Andrey Ignatov <r...@fb.com>
---
tools/lib/bpf/libbpf.c | 6 ++
1 file changed, 6 insertions(+)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 5922443..0fcc447 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf
Add missing pieces for BPF_PROG_TYPE_RAW_TRACEPOINT in libbpf:
* is- and set- functions;
* support guessing prog type.
Signed-off-by: Andrey Ignatov <r...@fb.com>
---
tools/lib/bpf/libbpf.c | 2 ++
tools/lib/bpf/libbpf.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/tools/l
rks for IPv4 and IPv6, TCP and UDP sockets. The
> + * domain (*addr*\ **->sa_family**) must be **AF_INET** (or
> + * **AF_INET6**). Looking for a free port to bind to can be
> + * expensive, therefore binding to port is not permitted by the
> + * he
Jakub Kicinski <kubak...@wp.pl> [Mon, 2018-04-16 16:53 -0700]:
> On Mon, 16 Apr 2018 14:41:57 -0700, Andrey Ignatov wrote:
> > diff --git a/tools/bpf/bpftool/cgroup.c b/tools/bpf/bpftool/cgroup.c
> > index cae32a6..8689916 100644
> > --- a/tools/bpf/bpftool/cgroup.c
*/
> + if (!txmsg_redir || (txmsg_redir && txmsg_ingress)) {
> + err = sockmap_init_ktls(opt->verbose, rx_fd);
> + if (err)
> + return err;
> + }
> + err = sockmap_init_ktls(opt->verbose, c1);
> + if (err)
> + return err;
> + }
> +
> rxpid = fork();
> if (rxpid == 0) {
> if (opt->drop_expected)
> @@ -907,6 +994,8 @@ static void test_options(char *options)
> strncat(options, "ingress,", OPTSTRING);
> if (txmsg_skb)
> strncat(options, "skb,", OPTSTRING);
> + if (ktls)
> + strncat(options, "ktls,", OPTSTRING);
> }
>
> static int __test_exec(int cgrp, int test, struct sockmap_options *opt)
> --
> 2.9.5
>
--
Andrey Ignatov
sn't break bpftool since
bpftool links libbpf statically.
[1] https://www.akkadia.org/drepper/dsohowto.pdf (2.2 Export Control)
[2] https://www.mail-archive.com/netdev@vger.kernel.org/msg251434.html
Signed-off-by: Andrey Ignatov
---
tools/lib/bpf/Makefile | 1 +
tools/lib/bpf/bpf.
; This is the cset:
>
> commit 956b620fcf0b64de403cd26a56bc41e6e4826ea6
> Author: Andrey Ignatov
> Date: Wed Sep 26 15:24:53 2018 -0700
>
> libbpf: Introduce libbpf_attach_type_by_name
>
>
>
> Tests are continuing, so f
6b620fcf0b ("libbpf: Introduce libbpf_attach_type_by_name")
Reported-by: Arnaldo Carvalho de Melo
Signed-off-by: Andrey Ignatov
---
tools/lib/bpf/libbpf.c | 13 +++--
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.
Test the following narrow loads in test_verifier for context __sk_buff:
* off=1, size=1 - ok;
* off=2, size=1 - ok;
* off=3, size=1 - ok;
* off=0, size=2 - ok;
* off=1, size=2 - fail;
* off=0, size=2 - ok;
* off=3, size=2 - fail.
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf
* off=0, size=4 (full).
Reported-by: Yonghong Song
Signed-off-by: Andrey Ignatov
---
include/linux/filter.h | 16 +---
kernel/bpf/verifier.c | 19 +++
2 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/include/linux/filter.h b/include/linux/filter.h
inde
This patch set adds support for narrow loads with offset > 0 to BPF
verifier.
Patch 1 provides more details and is the main patch in the set.
Patches 2 and 3 add new test cases to test_verifier and test_sock_addr
selftests.
Andrey Ignatov (3):
bpf: Allow narrow loads with offset
Add more test cases for context bpf_sock_addr to test narrow loads with
offset > 0 for ctx->user_ip4 field (__u32):
* off=1, size=1;
* off=2, size=1;
* off=3, size=1;
* off=2, size=2.
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf/test_sock_addr.c | 28 +
for IPv6 incorrect.
The patch fixes byte order of dport passed to __udp6_lib_lookup.
Originally sk_lookup properly handled UDPv6, but not TCPv6. 5ef0ae84f02a
fixes TCPv6 but breaks UDPv6.
Fixes: 5ef0ae84f02a ("bpf: Fix IPv6 dport byte-order in bpf_sk_lookup")
Signed-off-by: Andrey Ignatov
---
* off=0, size=4 (full).
Reported-by: Yonghong Song
Signed-off-by: Andrey Ignatov
---
include/linux/filter.h | 16 +---
kernel/bpf/verifier.c | 21 -
2 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/include/linux/filter.h b/include/linux/filter
Add more test cases for context bpf_sock_addr to test narrow loads with
offset > 0 for ctx->user_ip4 field (__u32):
* off=1, size=1;
* off=2, size=1;
* off=3, size=1;
* off=2, size=2.
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf/test_sock_addr.c | 28 +
This patch set adds support for narrow loads with offset > 0 to BPF
verifier.
Patch 1 provides more details and is the main patch in the set.
Patches 2 and 3 add new test cases to test_verifier and test_sock_addr
selftests.
v1->v2:
- fix -Wdeclaration-after-statement warning.
Andrey Igna
Test the following narrow loads in test_verifier for context __sk_buff:
* off=1, size=1 - ok;
* off=2, size=1 - ok;
* off=3, size=1 - ok;
* off=0, size=2 - ok;
* off=1, size=2 - fail;
* off=0, size=2 - ok;
* off=3, size=2 - fail.
Signed-off-by: Andrey Ignatov
---
tools/testing/selftests/bpf
for IPv6 incorrect.
The patch fixes byte order of dport passed to __udp6_lib_lookup.
Originally sk_lookup properly handled UDPv6, but not TCPv6. 5ef0ae84f02a
fixes TCPv6 but breaks UDPv6.
Fixes: 5ef0ae84f02a ("bpf: Fix IPv6 dport byte-order in bpf_sk_lookup")
Signed-off-by: Andrey Ignatov
Ack
ic
changes and simply moves code around.
Patch 3 is the main patch in the set, it makes the helpers available for
BPF_PROG_TYPE_CGROUP_SOCK_ADDR and provides more details about use-case.
Patch 4 adds selftest for new functionality.
Andrey Ignatov (4):
bpf: Fix IPv6 dport byte order in bpf_sk_lookup
Use bpf_sk_lookup_tcp, bpf_sk_lookup_udp and bpf_sk_release helpers from
test_sock_addr programs to make sure they're available and can lookup
and release socket properly for IPv4/IPv4, TCP/UDP.
Reading from a few fields of returned struct bpf_sock is also tested.
Signed-off-by: Andrey Ignatov
1 - 100 of 134 matches
Mail list logo