Re: [PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields

2015-03-13 Thread Alexei Starovoitov
On 3/13/15 9:43 AM, Daniel Borkmann wrote: On 03/13/2015 05:22 PM, Alexei Starovoitov wrote: On 3/13/15 2:57 AM, Daniel Borkmann wrote: On 03/13/2015 03:21 AM, Alexei Starovoitov wrote: introduce user accessible mirror of in-kernel 'struct sk_buff': For each member, I'd also add

Re: [PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields

2015-03-13 Thread Daniel Borkmann
On 03/13/2015 05:22 PM, Alexei Starovoitov wrote: On 3/13/15 2:57 AM, Daniel Borkmann wrote: On 03/13/2015 03:21 AM, Alexei Starovoitov wrote: introduce user accessible mirror of in-kernel 'struct sk_buff': For each member, I'd also add BUILD_BUG_ON()s similarly as we have in

Re: [PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields

2015-03-13 Thread Alexei Starovoitov
On 3/13/15 2:57 AM, Daniel Borkmann wrote: On 03/13/2015 03:21 AM, Alexei Starovoitov wrote: introduce user accessible mirror of in-kernel 'struct sk_buff': For each member, I'd also add BUILD_BUG_ON()s similarly as we have in convert_bpf_extensions(). That way, people won't forget to adjust

Re: [PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields

2015-03-13 Thread Daniel Borkmann
On 03/13/2015 03:21 AM, Alexei Starovoitov wrote: introduce user accessible mirror of in-kernel 'struct sk_buff': struct __sk_buff { __u32 len; __u32 pkt_type; __u32 mark; __u32 ifindex; __u32 queue_mapping; }; bpf programs can do: struct __sk_buff *ptr; var =

Re: [PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields

2015-03-13 Thread Alexei Starovoitov
On 3/13/15 9:43 AM, Daniel Borkmann wrote: On 03/13/2015 05:22 PM, Alexei Starovoitov wrote: On 3/13/15 2:57 AM, Daniel Borkmann wrote: On 03/13/2015 03:21 AM, Alexei Starovoitov wrote: introduce user accessible mirror of in-kernel 'struct sk_buff': For each member, I'd also add

Re: [PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields

2015-03-13 Thread Daniel Borkmann
On 03/13/2015 03:21 AM, Alexei Starovoitov wrote: introduce user accessible mirror of in-kernel 'struct sk_buff': struct __sk_buff { __u32 len; __u32 pkt_type; __u32 mark; __u32 ifindex; __u32 queue_mapping; }; bpf programs can do: struct __sk_buff *ptr; var =

Re: [PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields

2015-03-13 Thread Alexei Starovoitov
On 3/13/15 2:57 AM, Daniel Borkmann wrote: On 03/13/2015 03:21 AM, Alexei Starovoitov wrote: introduce user accessible mirror of in-kernel 'struct sk_buff': For each member, I'd also add BUILD_BUG_ON()s similarly as we have in convert_bpf_extensions(). That way, people won't forget to adjust

Re: [PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields

2015-03-13 Thread Daniel Borkmann
On 03/13/2015 05:22 PM, Alexei Starovoitov wrote: On 3/13/15 2:57 AM, Daniel Borkmann wrote: On 03/13/2015 03:21 AM, Alexei Starovoitov wrote: introduce user accessible mirror of in-kernel 'struct sk_buff': For each member, I'd also add BUILD_BUG_ON()s similarly as we have in

[PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields

2015-03-12 Thread Alexei Starovoitov
introduce user accessible mirror of in-kernel 'struct sk_buff': struct __sk_buff { __u32 len; __u32 pkt_type; __u32 mark; __u32 ifindex; __u32 queue_mapping; }; bpf programs can do: struct __sk_buff *ptr; var = ptr->pkt_type; which will be compiled to bpf assembler as:

[PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields

2015-03-12 Thread Alexei Starovoitov
introduce user accessible mirror of in-kernel 'struct sk_buff': struct __sk_buff { __u32 len; __u32 pkt_type; __u32 mark; __u32 ifindex; __u32 queue_mapping; }; bpf programs can do: struct __sk_buff *ptr; var = ptr-pkt_type; which will be compiled to bpf assembler as: dst_reg