Re: [RFC 1/3] bpf/wireless: add wifimon program type

2017-04-18 Thread Johannes Berg
So actually, come to think of it ... > > The mapping in samples/bpf/bpf_helpers.h, for example, for > > mentioned > > bpf_skb_load_bytes() would also work out of the box, since it takes > > a > > void *ctx as an argument, so you can just pass the __wifi_sk_buff > > pointer as ctx there from

Re: [RFC 1/3] bpf/wireless: add wifimon program type

2017-04-18 Thread Johannes Berg
On Tue, 2017-04-18 at 12:58 +0200, Daniel Borkmann wrote: > > Note that for skbs the data / data_end model (aka direct read / > write) is also supported. There's also a bpf_skb_pull_data() helper > that pulls in data from non-linear parts if necessary (f.e. if data / > data_end test in the

Re: [RFC 1/3] bpf/wireless: add wifimon program type

2017-04-18 Thread Daniel Borkmann
On 04/18/2017 11:55 AM, Johannes Berg wrote: On Fri, 2017-04-14 at 11:51 -0700, Alexei Starovoitov wrote: so today only 'len' field is needed, Correct, the other __sk_buff fields don't apply. It's more of an XDP model (with data/data_end), but as the SKB might be non-linear at this point I

Re: [RFC 1/3] bpf/wireless: add wifimon program type

2017-04-18 Thread Johannes Berg
On Fri, 2017-04-14 at 11:51 -0700, Alexei Starovoitov wrote: > > so today only 'len' field is needed, Correct, the other __sk_buff fields don't apply. It's more of an XDP model (with data/data_end), but as the SKB might be non-linear at this point I prefer to have the SKB so that skb data

Re: [RFC 1/3] bpf/wireless: add wifimon program type

2017-04-14 Thread Alexei Starovoitov
On Wed, Apr 12, 2017 at 05:30:40PM +0200, Johannes Berg wrote: > On Wed, 2017-04-12 at 11:19 -0400, David Miller wrote: > > > > > Instead it may make more sense to just have a "wifi_info(skb, > > info)" > > > function you can call, e.g. with a structure that has various > > fields > > > and flags

Re: [RFC 1/3] bpf/wireless: add wifimon program type

2017-04-12 Thread Marcel Holtmann
Hi Johannes, > Add a new program type for wifi monitor interfaces. This program > type can > * access __sk_buff, but only skb->len > * call bpf_skb_load_bytes() > > The program type is only enabled when something selects the new > Kconfig symbol WANT_BPF_WIFIMON, which will be done by mac80211 >

Re: [RFC 1/3] bpf/wireless: add wifimon program type

2017-04-12 Thread Johannes Berg
On Wed, 2017-04-12 at 11:19 -0400, David Miller wrote: > > > Instead it may make more sense to just have a "wifi_info(skb, > info)" > > function you can call, e.g. with a structure that has various > fields > > and flags to see which you care about. > > I would advise against this, let the

Re: [RFC 1/3] bpf/wireless: add wifimon program type

2017-04-12 Thread David Miller
From: Johannes Berg Date: Wed, 12 Apr 2017 16:27:34 +0200 > This works. An example BPF program is here: > https://p.sipsolutions.net/ca32264f2b705e5e.txt ... > One thing I'm not so sure about is the usage of __sk_buff. ... > Instead it may make more sense to just

Re: [RFC 1/3] bpf/wireless: add wifimon program type

2017-04-12 Thread Johannes Berg
On Wed, 2017-04-12 at 13:07 +0200, Johannes Berg wrote: > From: Johannes Berg > > Add a new program type for wifi monitor interfaces. This program > type can >  * access __sk_buff, but only skb->len >  * call bpf_skb_load_bytes() > > The program type is only enabled

[RFC 1/3] bpf/wireless: add wifimon program type

2017-04-12 Thread Johannes Berg
From: Johannes Berg Add a new program type for wifi monitor interfaces. This program type can * access __sk_buff, but only skb->len * call bpf_skb_load_bytes() The program type is only enabled when something selects the new Kconfig symbol WANT_BPF_WIFIMON, which will