Florian Westphal
2015-Feb-13 16:37 UTC
[Bridge] [PATCH] bridge: make it possible for packets to traverse the bridge withour hitting netfilter
Imre Palik <imrep.amz at gmail.com> wrote:> On 02/11/15 23:29, David Miller wrote: > > If I apply this, someone is going to try to submit a patch for every > > damn protocol layer to add a stupid hack like this. > > Actually this is one of those patches. There is already a "stupid hack like this" for iptables and arptables. (Implemented before git history, and giving me 10% speedup. Many thanks, whoever did it.) > > I also searched various LKML archives, and it seems the existing "stupid hacks" for iptables and arptables haven't resulted in any related patch submission in the last ten years. (Or my google-fu is weak.) > > Moreover, I cannot imagine any other reasonable on/off switch for bridge-netfilter than these three. Of course, my imagination might be lacking there.Why do you load the bridge netfilter module if you don't want it? Loading it registers the internal hooks for the call-ip(6)tables and sabotage hooks with NF_BRIDGE protocol so most of the NF_HOOK(NF_BRIDGE, ... calls become active.
Imre Palik
2015-Feb-13 17:45 UTC
[Bridge] [PATCH] bridge: make it possible for packets to traverse the bridge withour hitting netfilter
On 02/13/15 17:37, Florian Westphal wrote:> Imre Palik <imrep.amz at gmail.com> wrote: >> On 02/11/15 23:29, David Miller wrote: >>> If I apply this, someone is going to try to submit a patch for every >>> damn protocol layer to add a stupid hack like this. >> >> Actually this is one of those patches. There is already a "stupid hack like this" for iptables and arptables. (Implemented before git history, and giving me 10% speedup. Many thanks, whoever did it.) >> >> I also searched various LKML archives, and it seems the existing "stupid hacks" for iptables and arptables haven't resulted in any related patch submission in the last ten years. (Or my google-fu is weak.) >> >> Moreover, I cannot imagine any other reasonable on/off switch for bridge-netfilter than these three. Of course, my imagination might be lacking there. > > Why do you load the bridge netfilter module if you don't want it? > Loading it registers the internal hooks for the call-ip(6)tables and > sabotage hooks with NF_BRIDGE protocol so most of the NF_HOOK(NF_BRIDGE, ... > calls become active. >The trouble is that there are some bridges (with low traffic) where I need netfilter, and some other bridges (carrying lots of traffic), where I don't. Being able to set things up on a per bridge basis is a powerful thing. I only implemented the global switch because the iptables and arptables support also have one. If this is what bugs people here, I can remove it, and resubmit.
Florian Westphal
2015-Feb-13 19:03 UTC
[Bridge] [PATCH] bridge: make it possible for packets to traverse the bridge withour hitting netfilter
Imre Palik <imrep.amz at gmail.com> wrote:> The trouble is that there are some bridges (with low traffic) where I need netfilter, and some other bridges (carrying lots of traffic), where I don't. Being able to set things up on a per bridge basis is a powerful thing. > > I only implemented the global switch because the iptables and arptables support also have one. If this is what bugs people here, I can remove it, and resubmit.I see. But I agree with David, accepting such patch would pave way for all kinds of ugly hacks. It seems that technically the best solution would be to allow attaching filter rules to devices, but alas, netfilter doesn't support that. Alternatively, you patch *might* be ok iff you can get rid of the extra userspace-visible configuration knobs, we already have way too many of these. You'll also have to figure out how to avoid any run-time dependency on br_netfilter module from the bridge core. If you can do this, you might be able to get similar effect as your patch by replacing NF_HOOK with NF_HOOK_COND(..., !(br->flags & NO_NETFILTER)) or something like this. I don't know how invasive this would be, though.