[PATCH bpf] selftests/bpf: update test_lwt_seg6local.sh according to iproute2

2018-08-01 Thread Mathieu Xhonneux
Signed-off-by: Mathieu Xhonneux --- tools/testing/selftests/bpf/test_lwt_seg6local.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/test_lwt_seg6local.sh b/tools/testing/selftests/bpf/test_lwt_seg6local.sh index 270fa8f49573..785eabf2a593

[PATCH bpf-next v3] bpf: add End.DT6 action to bpf_lwt_seg6_action helper

2018-07-25 Thread Mathieu Xhonneux
. v3: s/1/true, s/0/false for boolean values v2: - changed true/false -> 1/0 - preempt_enable no longer called in first conditional block Signed-off-by: Mathieu Xhonneux --- include/net/seg6_local.h | 4 ++- net/core/filter.c| 89

Re: [PATCH bpf-next v2] bpf: add End.DT6 action to bpf_lwt_seg6_action helper

2018-07-25 Thread Mathieu Xhonneux
2018-07-25 23:13 GMT+02:00 Martin KaFai Lau : >> v2: - changed true/false -> 1/0 > hmmm...I thought I was asking to replace 1/0 with true/false. More > below. Silly me, I read your indication backwards. Agreed. @Daniel: sorry for this one, sending a v3.

[PATCH bpf-next v2] bpf: add End.DT6 action to bpf_lwt_seg6_action helper

2018-07-25 Thread Mathieu Xhonneux
. v2: - changed true/false -> 1/0 - preempt_enable no longer called in first conditional block Signed-off-by: Mathieu Xhonneux --- include/net/seg6_local.h | 4 ++- net/core/filter.c| 83 +--- net/ipv6/seg6_local.c|

Re: [PATCH bpf-next] bpf: add End.DT6 action to bpf_lwt_seg6_action helper

2018-07-25 Thread Mathieu Xhonneux
Indeed, I missed this one. Thanks, sending a v2. 2018-07-25 5:40 GMT+00:00 Daniel Borkmann : > On 07/24/2018 07:14 PM, Martin KaFai Lau wrote: >> On Tue, Jul 24, 2018 at 04:59:54PM +, Mathieu Xhonneux wrote: >>> The seg6local LWT provides the End.DT6 action, which allows to

[PATCH bpf-next] bpf: add End.DT6 action to bpf_lwt_seg6_action helper

2018-07-24 Thread Mathieu Xhonneux
. Signed-off-by: Mathieu Xhonneux --- include/net/seg6_local.h | 4 ++- net/core/filter.c| 83 +--- net/ipv6/seg6_local.c| 42 +++- 3 files changed, 87 insertions(+), 42 deletions(-) diff --git a/include/net

[PATCH iproute2 v2] ip: add support for seg6local End.BPF action

2018-07-17 Thread Mathieu Xhonneux
::18 encap seg6local action End.BPF endpoint my_bpf.o:[my_func] dev eth0 metric 1024 pref medium v2: - re-use of print_encap_bpf_prog instead of fprintf - introduction of "endpoint" keyword for more consistency with others parameters Signed-off-by: Mathieu Xhonneu

Re: [PATCH iproute2] ip: add support for seg6local End.BPF action

2018-07-16 Thread Mathieu Xhonneux
This patch corresponds to a new feature that is now available in the net tree. I hence assumed that this patch had to be sent to iproute2 and not iproute2-next, please tell me if this is not OK, I'll then send a v2 towards iproute2-next. Thanks. 2018-07-16 14:47 GMT+00:00 Mathieu Xho

[PATCH iproute2] ip: add support for seg6local End.BPF action

2018-07-16 Thread Mathieu Xhonneux
encap seg6local action End.BPF my_bpf.o:[my_func] dev eth0 metric 1024 pref medium Signed-off-by: Mathieu Xhonneux --- ip/iproute_lwtunnel.c | 122 +- lib/bpf.c | 5 +++ 2 files changed, 77 insertions(+), 50 deletions(-) diff --git a/ip

[PATCH bpf-next] bpf: better availability probing for seg6 helpers

2018-07-10 Thread Mathieu Xhonneux
: Mathieu Xhonneux --- net/core/filter.c | 22 -- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index b9ec916f4e3a..c910a95e9a7c 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4439,10 +4439,10 @@ static const

Re: [PATCH bpf-next v7 3/6] bpf: Add IPv6 Segment Routing helpers

2018-06-05 Thread Mathieu Xhonneux
2018-05-30 13:00 GMT+02:00 Daniel Borkmann : >> Instead of doing this inside the helper you can reject the program already >> in the lwt_*_func_proto() by returning NULL when !CONFIG_IPV6_SEG6_BPF. That >> way programs get rejected at verification time instead of runtime, so the >> user can probe a

[PATCH bpf-next v2] selftests/bpf: missing headers test_lwt_seg6local

2018-05-26 Thread Mathieu Xhonneux
#x27; file not found ^~~~ 1 error generated. make: Leaving directory `/data/users/yhs/work/net-next/tools/testing/selftests/bpf' v2: moving the headers to tools/include/uapi/. Reported-by: Y Song Signed-off-by: Mathieu Xhonneux --- tools/include/uapi/linux/seg6.h | 55 ++

Re: [PATCH bpf-next] selftests/bpf: missing headers test_lwt_seg6local

2018-05-26 Thread Mathieu Xhonneux
2018-05-25 18:39 GMT+02:00 Daniel Borkmann : > Yes, should definitely go there to tools include infrastructure. What is the point of tools/testing/selftests/bpf/include/uapi/ then ? Incompatibility issues preventing linux/types.h to be included in non-bpf testing executables ? My initial conceptio

[PATCH net] ipv6: sr: fix memory OOB access in seg6_do_srh_encap/inline

2018-05-25 Thread Mathieu Xhonneux
h lwtunnels") Signed-off-by: David Lebrun Signed-off-by: Mathieu Xhonneux --- net/ipv6/seg6_iptunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c index 5fe139484919..bf4763fd68c2 100644 --- a/net/ipv6/seg6_iptunnel.

[PATCH bpf-next] selftests/bpf: missing headers test_lwt_seg6local

2018-05-25 Thread Mathieu Xhonneux
#x27; file not found ^~~~ 1 error generated. make: Leaving directory `/data/users/yhs/work/net-next/tools/testing/selftests/bpf' Reported-by: Y Song Signed-off-by: Mathieu Xhonneux --- .../selftests/bpf/include/uapi/linux/seg6.h| 55 +++ .../selftests/bpf/includ

[PATCH bpf-next v7 2/6] ipv6: sr: export function lookup_nexthop

2018-05-20 Thread Mathieu Xhonneux
ned-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6.h | 3 ++- include/net/seg6_local.h | 24 net/ipv6/seg6_local.c| 20 +++- 3 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 include/net/seg6_local.h d

[PATCH bpf-next v7 5/6] ipv6: sr: Add seg6local action End.BPF

2018-05-20 Thread Mathieu Xhonneux
return this value, as the skb's destination is already set and the default lookup should not be performed. - BPF_DROP : the packet will be dropped. Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 1 + include/uapi/linux/

[PATCH bpf-next v7 6/6] selftests/bpf: test for seg6local End.BPF action

2018-05-20 Thread Mathieu Xhonneux
before entering this chain. Each End.BPF action validates the previous one, otherwise the packet is dropped. The test succeeds if the last node in the chain receives the packet and the UDP datagram contained can be retrieved from userspace. Signed-off-by: Mathieu Xhonneux --- tools/include/uapi

[PATCH bpf-next v7 4/6] bpf: Split lwt inout verifier structures

2018-05-20 Thread Mathieu Xhonneux
: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 4 +-- net/core/filter.c | 83 +-- 2 files changed, 54 insertions(+), 33 deletions(-) diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index

[PATCH bpf-next v7 3/6] bpf: Add IPv6 Segment Routing helpers

2018-05-20 Thread Mathieu Xhonneux
route. These helpers require CONFIG_IPV6=y (and not =m). Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6_local.h | 8 ++ include/uapi/linux/bpf.h | 96 +++- net/core/filter.c| 285 +++ net/ipv6/Kc

[PATCH bpf-next v7 1/6] ipv6: sr: make seg6.h includable without IPv6

2018-05-20 Thread Mathieu Xhonneux
u mean 'ipv4'? return net->ipv6.seg6_data; ^~~~ ipv4 This commit makes seg6_pernet return NULL if IPv6 is not compiled, hence allowing seg6.h to be included regardless of the configuration. Signed-off-by: Mathieu Xhonneux --- include/net/seg6.

[PATCH bpf-next v7 0/6] ipv6: sr: introduce seg6local End.BPF action

2018-05-20 Thread Mathieu Xhonneux
pf for netlink nested bpf attributes - SEG6_LOCAL_BPF_PROG attr now contains prog->aux->id when dumping state Thanks. Mathieu Xhonneux (6): ipv6: sr: make seg6.h includable without IPv6 ipv6: sr: export function lookup_nexthop bpf: Add IPv6 Segment Routing helpers bpf: Spl

Re: [PATCH bpf-next v6 5/6] ipv6: sr: Add seg6local action End.BPF

2018-05-20 Thread Mathieu Xhonneux
2018-05-18 21:24 GMT+01:00 Daniel Borkmann : >> +#define MAX_PROG_NAME 256 >> +static const struct nla_policy bpf_prog_policy[LWT_BPF_PROG_MAX + 1] = { >> + [LWT_BPF_PROG_FD] = { .type = NLA_U32, }, > > From UAPI point of view, I wouldn't name it LWT_BPF_PROG_FD but rather > something like >

[PATCH] bpf: fix mem leak in error path of lwt bpf setup

2018-05-20 Thread Mathieu Xhonneux
In bpf_parse_prog, if bpf_prog_get_type fails, the function is immediately terminated without freeing the previously allocated prog->name. This patch adds a kfree before the return. Signed-off-by: Mathieu Xhonneux --- net/core/lwt_bpf.c | 4 +++- 1 file changed, 3 insertions(+), 1 delet

[PATCH bpf-next v6 6/6] selftests/bpf: test for seg6local End.BPF action

2018-05-17 Thread Mathieu Xhonneux
before the chain. Each End.BPF action validates the previous one, otherwise the packet is dropped. The test succeeds if the last node in the chain receives the packet and the UDP datagram contained can be retrieved from userspace. Signed-off-by: Mathieu Xhonneux --- tools/include/uapi/linux/bpf.h

[PATCH bpf-next v6 3/6] bpf: Add IPv6 Segment Routing helpers

2018-05-17 Thread Mathieu Xhonneux
route. These helpers require CONFIG_IPV6=y (and not =m). Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6_local.h | 8 ++ include/uapi/linux/bpf.h | 96 +++- net/core/filter.c| 285 +++ net/ipv6/Kc

[PATCH bpf-next v6 2/6] ipv6: sr: export function lookup_nexthop

2018-05-17 Thread Mathieu Xhonneux
ned-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6.h | 3 ++- include/net/seg6_local.h | 24 net/ipv6/seg6_local.c| 20 +++- 3 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 include/net/seg6_local.h d

[PATCH bpf-next v6 4/6] bpf: Split lwt inout verifier structures

2018-05-17 Thread Mathieu Xhonneux
: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 4 +-- net/core/filter.c | 83 +-- 2 files changed, 54 insertions(+), 33 deletions(-) diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index

[PATCH bpf-next v6 1/6] ipv6: sr: make seg6.h includable without IPv6

2018-05-17 Thread Mathieu Xhonneux
u mean 'ipv4'? return net->ipv6.seg6_data; ^~~~ ipv4 This commit makes seg6_pernet return NULL if IPv6 is not compiled, hence allowing seg6.h to be included regardless of the configuration. Signed-off-by: Mathieu Xhonneux --- include/net/seg6.

[PATCH bpf-next v6 0/6] ipv6: sr: introduce seg6local End.BPF action

2018-05-17 Thread Mathieu Xhonneux
d bugs when CONFIG_IPV6=m v5: fix kbuild sparse warnings when CONFIG_IPV6=m v6: fix skb pointers-related bugs in helpers Thanks. Mathieu Xhonneux (6): ipv6: sr: make seg6.h includable without IPv6 ipv6: sr: export function lookup_nexthop bpf: Add IPv6 Segment Routing helpers bpf: Split lwt

[PATCH bpf-next v6 5/6] ipv6: sr: Add seg6local action End.BPF

2018-05-17 Thread Mathieu Xhonneux
return this value, as the skb's destination is already set and the default lookup should not be performed. - BPF_DROP : the packet will be dropped. Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 1 + include/uapi/linux/

Re: [PATCH bpf-next v5 3/6] bpf: Add IPv6 Segment Routing helpers

2018-05-16 Thread Mathieu Xhonneux
2018-05-14 23:40 GMT+01:00 Daniel Borkmann : > On 05/12/2018 07:25 PM, Mathieu Xhonneux wrote: > [...] >> +BPF_CALL_4(bpf_lwt_seg6_store_bytes, struct sk_buff *, skb, u32, offset, >> +const void *, from, u32, len) >> +{ >> +#if IS_ENABLED(CONFIG_

Re: [PATCH bpf-next v5 0/6] ipv6: sr: introduce seg6local End.BPF action

2018-05-12 Thread Mathieu Xhonneux
Sorry for the v4 still throwing warnings from the kbuild bot, this version should be OK. 2018-05-12 18:25 GMT+01:00 Mathieu Xhonneux : > As of Linux 4.14, it is possible to define advanced local processing for > IPv6 packets with a Segment Routing Header through the seg6local LWT > infra

[PATCH bpf-next v5 4/6] bpf: Split lwt inout verifier structures

2018-05-12 Thread Mathieu Xhonneux
: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 4 +-- net/core/filter.c | 83 +-- 2 files changed, 54 insertions(+), 33 deletions(-) diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index

[PATCH bpf-next v5 5/6] ipv6: sr: Add seg6local action End.BPF

2018-05-12 Thread Mathieu Xhonneux
return this value, as the skb's destination is already set and the default lookup should not be performed. - BPF_DROP : the packet will be dropped. Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 1 + include/uapi/linux/

[PATCH bpf-next v5 2/6] ipv6: sr: export function lookup_nexthop

2018-05-12 Thread Mathieu Xhonneux
ned-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6.h | 3 ++- include/net/seg6_local.h | 24 net/ipv6/seg6_local.c| 20 +++- 3 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 include/net/seg6_local.h d

[PATCH bpf-next v5 6/6] selftests/bpf: test for seg6local End.BPF action

2018-05-12 Thread Mathieu Xhonneux
before the chain. Each End.BPF action validates the previous one, otherwise the packet is dropped. The test succeeds if the last node in the chain receives the packet and the UDP datagram contained can be retrieved from userspace. Signed-off-by: Mathieu Xhonneux --- tools/include/uapi/linux/bpf.h

[PATCH bpf-next v5 0/6] ipv6: sr: introduce seg6local End.BPF action

2018-05-12 Thread Mathieu Xhonneux
d bugs when CONFIG_IPV6=m v5: fix kbuild sparse warnings when CONFIG_IPV6=m Thanks. Mathieu Xhonneux (6): ipv6: sr: make seg6.h includable without IPv6 ipv6: sr: export function lookup_nexthop bpf: Add IPv6 Segment Routing helpers bpf: Split lwt inout verifier structures ipv6: sr: Add seg

[PATCH bpf-next v5 3/6] bpf: Add IPv6 Segment Routing helpers

2018-05-12 Thread Mathieu Xhonneux
route. These helpers require CONFIG_IPV6=y (and not =m). Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6_local.h | 8 ++ include/uapi/linux/bpf.h | 97 +++- net/core/filter.c| 282 +++ net/ipv6/Kc

[PATCH bpf-next v5 1/6] ipv6: sr: make seg6.h includable without IPv6

2018-05-12 Thread Mathieu Xhonneux
u mean 'ipv4'? return net->ipv6.seg6_data; ^~~~ ipv4 This commit makes seg6_pernet return NULL if IPv6 is not compiled, hence allowing seg6.h to be included regardless of the configuration. Signed-off-by: Mathieu Xhonneux --- include/net/seg6.

Re: [bpf-next v3 8/9] bpf: Provide helper to do forwarding lookups in kernel FIB table

2018-05-10 Thread Mathieu Xhonneux
I'm quite interested in this helper to implement OAM features (through other hooks, e.g. the BPF LWT hook). Do you have an idea about how it behaves with ECMP routes (with IPv4 and/or IPv6) ? In IPv6, I'm guessing that the returned gateway address is always a link-local address ? Thanks. 2018-05-

Re: [PATCH bpf-next v4 0/6] ipv6: sr: introduce seg6local End.BPF action

2018-05-09 Thread Mathieu Xhonneux
@Alexei: I created the CONFIG_IPV6_SEG6_BPF symbol, fearing that using ipv6_bpf_stub would be detrimental for the bpf_lwt_seg6_action helper, since all the calls to seg6_* are in the critical path. 2018-05-09 22:16 GMT+01:00 Mathieu Xhonneux : > As of Linux 4.14, it is possible to define advan

[PATCH bpf-next v4 6/6] selftests/bpf: test for seg6local End.BPF action

2018-05-09 Thread Mathieu Xhonneux
before the chain. Each End.BPF action validates the previous one, otherwise the packet is dropped. The test succeeds if the last node in the chain receives the packet and the UDP datagram contained can be retrieved from userspace. Signed-off-by: Mathieu Xhonneux --- tools/include/uapi/linux/bpf.h

[PATCH bpf-next v4 5/6] ipv6: sr: Add seg6local action End.BPF

2018-05-09 Thread Mathieu Xhonneux
return this value, as the skb's destination is already set and the default lookup should not be performed. - BPF_DROP : the packet will be dropped. This action requires CONFIG_IPV6=y (and not =m). Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/

[PATCH bpf-next v4 1/6] ipv6: sr: make seg6.h includable without IPv6

2018-05-09 Thread Mathieu Xhonneux
u mean 'ipv4'? return net->ipv6.seg6_data; ^~~~ ipv4 This commit makes seg6_pernet return NULL if IPv6 is not compiled, hence allowing seg6.h to be included regardless of the configuration. Signed-off-by: Mathieu Xhonneux --- include/net/seg6.

[PATCH bpf-next v4 2/6] ipv6: sr: export function lookup_nexthop

2018-05-09 Thread Mathieu Xhonneux
ned-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6.h | 3 ++- include/net/seg6_local.h | 24 net/ipv6/seg6_local.c| 20 +++- 3 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 include/net/seg6_local.h d

[PATCH bpf-next v4 3/6] bpf: Add IPv6 Segment Routing helpers

2018-05-09 Thread Mathieu Xhonneux
route. Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6_local.h | 8 ++ include/uapi/linux/bpf.h | 95 +++- net/core/filter.c| 282 +++ net/ipv6/Kconfig | 5 + net/ipv6/seg6_local.c| 2

[PATCH bpf-next v4 4/6] bpf: Split lwt inout verifier structures

2018-05-09 Thread Mathieu Xhonneux
: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 4 +-- net/core/filter.c | 83 +-- 2 files changed, 54 insertions(+), 33 deletions(-) diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index

[PATCH bpf-next v4 0/6] ipv6: sr: introduce seg6local End.BPF action

2018-05-09 Thread Mathieu Xhonneux
d bugs when CONFIG_IPV6=m Thanks. Mathieu Xhonneux (6): ipv6: sr: make seg6.h includable without IPv6 ipv6: sr: export function lookup_nexthop bpf: Add IPv6 Segment Routing helpers bpf: Split lwt inout verifier structures ipv6: sr: Add seg6local action End.BPF selftests/bpf: test for seg

Re: [PATCH bpf-next v3 3/6] bpf: Add IPv6 Segment Routing helpers

2018-05-07 Thread Mathieu Xhonneux
-05-07 0:29 GMT+01:00 kbuild test robot : > Hi Mathieu, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on bpf-next/master] > > url: > https://github.com/0day-ci/linux/commits/Mathieu-Xhonneux/ipv6-sr-introduce-seg6local-End-BPF

[PATCH bpf-next v3 4/6] bpf: Split lwt inout verifier structures

2018-05-06 Thread Mathieu Xhonneux
: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 4 +-- net/core/filter.c | 83 +-- 2 files changed, 54 insertions(+), 33 deletions(-) diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index

[PATCH bpf-next v3 1/6] ipv6: sr: make seg6.h includable without IPv6

2018-05-06 Thread Mathieu Xhonneux
u mean 'ipv4'? return net->ipv6.seg6_data; ^~~~ ipv4 This commit makes seg6_pernet return NULL if IPv6 is not compiled, hence allowing seg6.h to be included regardless of the configuration. Signed-off-by: Mathieu Xhonneux --- include/net/seg6.

[PATCH bpf-next v3 3/6] bpf: Add IPv6 Segment Routing helpers

2018-05-06 Thread Mathieu Xhonneux
route. Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6_local.h | 8 ++ include/uapi/linux/bpf.h | 95 +++- net/core/filter.c| 282 +++ net/ipv6/seg6_local.c| 2 + 4 files changed, 363 insertions(+

[PATCH bpf-next v3 0/6] ipv6: sr: introduce seg6local End.BPF action

2018-05-06 Thread Mathieu Xhonneux
the SRH integrity state from skb->cb to a per-cpu buffer v3: - document helpers in man-page style - fix kbuild bugs - un-break BPF LWT out hook - bpf_push_seg6_encap is now static - preempt_enable is now called when the packet is dropped in input_action_end_bpf Thanks. M

[PATCH bpf-next v3 2/6] ipv6: sr: export function lookup_nexthop

2018-05-06 Thread Mathieu Xhonneux
ned-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6.h | 3 ++- include/net/seg6_local.h | 24 net/ipv6/seg6_local.c| 20 +++- 3 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 include/net/seg6_local.h d

[PATCH bpf-next v3 6/6] selftests/bpf: test for seg6local End.BPF action

2018-05-06 Thread Mathieu Xhonneux
before the chain. Each End.BPF action validates the previous one, otherwise the packet is dropped. The test succeeds if the last node in the chain receives the packet and the UDP datagram contained can be retrieved from userspace. Signed-off-by: Mathieu Xhonneux --- tools/include/uapi/linux/bpf.h

[PATCH bpf-next v3 5/6] ipv6: sr: Add seg6local action End.BPF

2018-05-06 Thread Mathieu Xhonneux
return this value, as the skb's destination is already set and the default lookup should not be performed. - BPF_DROP : the packet will be dropped. Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 3 + include/uapi/linux/

Re: [PATCH net-next v2 4/5] ipv6: sr: Add seg6local action End.BPF

2018-04-30 Thread Mathieu Xhonneux
2018-04-28 2:01 GMT+02:00 Alexei Starovoitov : > > On Fri, Apr 27, 2018 at 10:59:19AM -0400, David Miller wrote: > > From: Mathieu Xhonneux > > Date: Tue, 24 Apr 2018 18:44:15 +0100 > > > > > This patch adds the End.BPF action to the LWT seg6local infrastructure.

[PATCH net-next v2 0/5] ipv6: sr: introduce seg6local End.BPF action

2018-04-24 Thread Mathieu Xhonneux
the SRH integrity state from skb->cb to a per-cpu buffer Thanks. Mathieu Xhonneux (5): ipv6: sr: export function lookup_nexthop bpf: Add IPv6 Segment Routing helpers bpf: Split lwt inout verifier structures ipv6: sr: Add seg6local action End.BPF selftests/bpf: test for seg6local E

[PATCH net-next v2 2/5] bpf: Add IPv6 Segment Routing helpers

2018-04-24 Thread Mathieu Xhonneux
route. Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6_local.h | 8 ++ include/uapi/linux/bpf.h | 57 +- net/core/filter.c| 267 +++ 3 files changed, 308 insertions(+), 24 deletions(-) diff --git a/includ

[PATCH net-next v2 4/5] ipv6: sr: Add seg6local action End.BPF

2018-04-24 Thread Mathieu Xhonneux
return this value, as the skb's destination is already set and the default lookup should not be performed. - BPF_DROP : the packet will be dropped. Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 1 + include/uapi/linux/

[PATCH net-next v2 5/5] selftests/bpf: test for seg6local End.BPF action

2018-04-24 Thread Mathieu Xhonneux
before the chain. Each End.BPF action validates the previous one, otherwise the packet is dropped. The test succeeds if the last node in the chain receives the packet and the UDP datagram contained can be retrieved from userspace. Signed-off-by: Mathieu Xhonneux --- tools/include/uapi/linux/bpf.h

[PATCH net-next v2 3/5] bpf: Split lwt inout verifier structures

2018-04-24 Thread Mathieu Xhonneux
: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 3 +- net/core/filter.c | 83 +-- 2 files changed, 53 insertions(+), 33 deletions(-) diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index

[PATCH net-next v2 1/5] ipv6: sr: export function lookup_nexthop

2018-04-24 Thread Mathieu Xhonneux
ned-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6.h | 3 ++- include/net/seg6_local.h | 24 net/ipv6/seg6_local.c| 20 +++- 3 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 include/net/seg6_local.h d

Re: [PATCH net-next RFC 0/5] ipv6: sr: introduce seg6local End.BPF action

2018-04-04 Thread Mathieu Xhonneux
2018-04-03 16:25 GMT+02:00 David Lebrun : > Actually I'm wrong here. dst_input() will call either ip6_input() or > ip6_forward(), not ipv6_rcv(). Both functions expect IP6CB() to be set, > so using skb->cb here will interfere with them. > > What about saving and restoring the IPv6 CB, similarly to

Re: [PATCH net-next RFC 0/5] ipv6: sr: introduce seg6local End.BPF action

2018-04-03 Thread Mathieu Xhonneux
2018-03-31 1:03 GMT+02:00 Alexei Starovoitov : > > On Fri, Mar 23, 2018 at 10:15:59AM +, Mathieu Xhonneux wrote: > > As of Linux 4.14, it is possible to define advanced local processing for > > IPv6 packets with a Segment Routing Header through the seg6local LWT > >

[PATCH net-next RFC 1/5] ipv6: sr: export function lookup_nexthop

2018-03-23 Thread Mathieu Xhonneux
ned-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net/seg6.h | 3 ++- include/net/seg6_local.h | 24 net/ipv6/seg6_local.c| 20 +++- 3 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 include/net/seg6_local.h d

[PATCH net-next RFC 3/5] bpf: Split lwt inout verifier structures

2018-03-23 Thread Mathieu Xhonneux
: Mathieu Xhonneux Acked-by: David Lebrun --- include/linux/bpf_types.h | 4 +-- net/core/filter.c | 85 ++- 2 files changed, 56 insertions(+), 33 deletions(-) diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h index

[PATCH next-next RFC 2/5] bpf: Add IPv6 Segment Routing helpers

2018-03-23 Thread Mathieu Xhonneux
SRH for non-SRv6 packet, as the BPF seg6local hook only works on traffic already containing a SRH. This is the BPF equivalent of the seg6 LWT infrastructure, which achieves the same purpose but with a static SRH per route. Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/net

[PATCH net-next RFC 5/5] selftests/bpf: test for seg6local End.BPF action

2018-03-23 Thread Mathieu Xhonneux
before the chain. Each End.BPF action validates the previous one, otherwise the packet is dropped. The test succeeds if the last node in the chain receives the packet and the UDP datagram contained can be retrieved from userspace. Signed-off-by: Mathieu Xhonneux --- tools/include/uapi/linux/bpf.h

[PATCH net-next RFC 4/5] ipv6: sr: Add seg6local action End.BPF

2018-03-23 Thread Mathieu Xhonneux
the bpf_lwt_seg6_action helper, the BPF program should return this value, as the skb destination is already set and the default lookup shouldn’t be performed. - BPF_DROP : the packet will be dropped. Signed-off-by: Mathieu Xhonneux Acked-by: David Lebrun --- include/li

[PATCH net-next RFC 0/5] ipv6: sr: introduce seg6local End.BPF action

2018-03-23 Thread Mathieu Xhonneux
the patchset are welcome. Thanks. Mathieu Xhonneux (5): ipv6: sr: export function lookup_nexthop bpf: Add IPv6 Segment Routing helpers bpf: Split lwt inout verifier structures ipv6: sr: Add seg6local action End.BPF selftests/bpf: test for seg6local End.BPF action include/linux/bpf_type

[PATCH net v2] ipv6: sr: fix TLVs not being copied using setsockopt

2018-01-10 Thread Mathieu Xhonneux
6: sr: add support for SRH injection through setsockopt") Acked-by: David Lebrun Signed-off-by: Mathieu Xhonneux --- net/ipv6/exthdrs.c | 9 + 1 file changed, 9 insertions(+) diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 83bd75713535..bc68eb661970 100644 --- a/net/ipv6/

Re: [PATCH net] ipv6: sr: fix TLVs not being copied using setsockopt

2018-01-07 Thread Mathieu Xhonneux
Just realized I messed up the justification about sr_has_hmac. The branch will be taken, but its execution will not complete since the TLV's len and type fields aren't copied, hence seg6_get_tlv_hmac will fail, and the HMAC will not be computed. 2018-01-07 17:12 GMT+00:00 Mathie

[PATCH net] ipv6: sr: fix TLVs not being copied using setsockopt

2018-01-07 Thread Mathieu Xhonneux
ommit adds a memcpy in case TLVs have been appended to the SRH. Fixes: a149e7c7ce812561f0fdc7a86ddc42f294e5eb3e ("ipv6: sr: add support for SRH injection through setsockopt") Acked-by: David Lebrun Signed-off-by: Mathieu Xhonneux --- net/ipv6/exthdrs.c | 9 + 1 file change