Re: [PATCH net-next] net: filter: rename 'struct sk_filter' to 'struct bpf_prog'

From: David Miller
Date: Mon Jul 28 2014 - 20:12:22 EST

From: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
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.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at