Re: [PATCH bpf-next v10 5/7] bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c

2019-02-13 Thread Peter Oskolkov
On Wed, Feb 13, 2019 at 12:11 PM David Ahern wrote: > > On 2/13/19 12:57 PM, Peter Oskolkov wrote: > > Thanks, David! I was not able to reproduce the leak, but based on your > > suggestion and similar code elsewhere I made a change in v11 to explicitly > > release a dst with error. > > ok. Did you

Re: [PATCH bpf-next v10 5/7] bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c

2019-02-13 Thread David Ahern
On 2/13/19 12:57 PM, Peter Oskolkov wrote: > Thanks, David! I was not able to reproduce the leak, but based on your > suggestion and similar code elsewhere I made a change in v11 to explicitly > release a dst with error. ok. Did you run the test with a debug kernel - checking refcount, use after f

Re: [PATCH bpf-next v10 5/7] bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c

2019-02-13 Thread Peter Oskolkov
On Tue, Feb 12, 2019 at 6:58 PM David Ahern wrote: > > On 2/12/19 10:32 AM, Peter Oskolkov wrote: > > @@ -148,6 +174,87 @@ static int xmit_check_hhlen(struct sk_buff *skb) > > return 0; > > } > > > > +static int bpf_lwt_xmit_reroute(struct sk_buff *skb) > > +{ > > + struct net_device *l

Re: [PATCH bpf-next v10 5/7] bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c

2019-02-12 Thread David Ahern
On 2/12/19 10:32 AM, Peter Oskolkov wrote: > @@ -148,6 +174,87 @@ static int xmit_check_hhlen(struct sk_buff *skb) > return 0; > } > > +static int bpf_lwt_xmit_reroute(struct sk_buff *skb) > +{ > + struct net_device *l3mdev = l3mdev_master_dev_rcu(skb_dst(skb)->dev); > + int oif =

[PATCH bpf-next v10 5/7] bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c

2019-02-12 Thread Peter Oskolkov
This patch builds on top of the previous patch in the patchset, which added BPF_LWT_ENCAP_IP mode to bpf_lwt_push_encap. As the encapping can result in the skb needing to go via a different interface/route/dst, bpf programs can indicate this by returning BPF_LWT_REROUTE, which triggers a new route