netfilter: ebtables: try native set/getsockopt handlers, too
authorFlorian Westphal <fw@strlen.de>
Sun, 7 Feb 2010 02:19:12 +0000 (03:19 +0100)
committerFlorian Westphal <fw@strlen.de>
Tue, 16 Feb 2010 16:27:19 +0000 (17:27 +0100)
commit90b89af7e15143c8ea22f5c8818f5a2eec9e75c1
tree28e259c073054635c3cf5db638eb48c94274ced0
parent81e675c227ec60a0bdcbb547dc530ebee23ff931
netfilter: ebtables: try native set/getsockopt handlers, too

ebtables can be compiled to perform userspace-side padding of
structures. In that case, all the structures are already in the
'native' format expected by the kernel.

This tries to determine what format the userspace program is
using.

For most set/getsockopts, this can be done by checking
the len argument for sizeof(compat_ebt_replace) and
re-trying the native handler on error.

In case of EBT_SO_GET_ENTRIES, the native handler is tried first,
it will error out early when checking the *len argument
(the compat version has to defer this check until after
 iterating over the kernel data set once, to adjust for all
 the structure size differences).

As this would cause error printks, remove those as well, as
recommended by Bart de Schuymer.

Signed-off-by: Florian Westphal <fw@strlen.de>
net/bridge/netfilter/ebtables.c