From: Bart De Schuymer <bdschuym@pandora.be>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org, Jiri Pirko <jpirko@redhat.com>,
Jesse Gross <jesse@nicira.com>
Subject: Re: [PATCH] bridge: netfilter: don't call iptables on vlan packets if sysctl is off
Date: Fri, 02 Mar 2012 22:11:11 +0100 [thread overview]
Message-ID: <4F51376F.3050704@pandora.be> (raw)
In-Reply-To: <1330638154-1142-1-git-send-email-fw@strlen.de>
Op 1/03/2012 22:42, Florian Westphal schreef:
> When net.bridge.bridge-nf-filter-vlan-tagged is 0 (default), vlan packets
> arriving should not be sent to ip(6)tables by bridge netfilter.
>
> However, it turns out that we currently always send VLAN packets to
> netfilter, if ..
> a), CONFIG_VLAN_8021Q is enabled ; or
> b), CONFIG_VLAN_8021Q is not set but rx vlan offload is enabled
> on the bridge port.
>
> This is because bridge netfilter treats skb with
> skb->protocol == ETH_P_IP{V6} as "non-vlan packet".
> - else if (skb->protocol == htons(ETH_P_IPV6) || IS_VLAN_IPV6(skb) ||
> - IS_PPPOE_IPV6(skb))
> + else if (IS_IPV6(skb) || IS_PPPOE_IPV6(skb))
> - if (skb->protocol != htons(ETH_P_ARP)) {
> - if (!IS_VLAN_ARP(skb))
> - return NF_ACCEPT;
> - nf_bridge_pull_encap_header(skb);
> - }
> + if (!IS_ARP(skb))
> + return NF_ACCEPT;
> + nf_bridge_pull_encap_header(skb);
> - if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP(skb) ||
> - IS_PPPOE_IP(skb))
> + if (IS_IP(skb) || IS_PPPOE_IP(skb))
I think the above is quite unclear to read. I would prefer something
like this:
if (IS_IP(skb) || IS_VLAN_IP(skb) || IS_PPPOE_IP(skb))
The compiler should easily remove any redundant checks that this would
produce. The same idea goes for the IS_ARP and IS_IPV6 macros you define...
Apart from that the patch looks fine to me.
cheers,
Bart
next prev parent reply other threads:[~2012-03-02 21:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-01 21:42 [PATCH] bridge: netfilter: don't call iptables on vlan packets if sysctl is off Florian Westphal
2012-03-02 21:11 ` Bart De Schuymer [this message]
2012-03-03 10:20 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F51376F.3050704@pandora.be \
--to=bdschuym@pandora.be \
--cc=fw@strlen.de \
--cc=jesse@nicira.com \
--cc=jpirko@redhat.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).