lkml.org 
[lkml]   [2014]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH net-next] net: filter: rename 'struct sk_filter' to 'struct bpf_prog'
From
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Mon, 28 Jul 2014 23:45:52 +0200

> By renaming this, you're not fixing up things the semantics. It seems
> to me you just want to find a quick path to solve inconsistencies in
> your code.

Agreed, this looks just like messing around with naming to me.

But to the original issue, that of xt_bpf, I wonder about a few things:

1) If we have a kernel pointer embedded in a user provided datastructure,
what takes care of 32-bit compat applications uploading xt_bpf rules
on a 64-bit kernel? Won't the size be wrong or does it not matter
and is in some way helped by that 8-byte alignment thing there?

2) The user can't care about the type of "filter" in xt_bpf_info, so
we can use whatever name we want for the type.

Therefore you can just do something like:


struct bpf_prog;

struct xt_bpf_info {
__u16 bpf_program_num_elem;
struct sock_filter bpf_program[XT_BPF_MAX_NUM_INSTR];

/* only used in the kernel */
struct bpf_prog *filter __attribute__((aligned(8)));
};

and then you won't need any casting.


\
 
 \ /
  Last update: 2014-07-29 03:01    [W:0.185 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site