From: Lennert Buytenhek <buytenh@math.leidenuniv.nl>
To: "David S. Miller" <davem@redhat.com>
Cc: bart.de.schuymer@pandora.be, linux-kernel@vger.kernel.org
Subject: Re: bridge-netfilter patch
Date: Sun, 15 Sep 2002 23:27:06 +0200 [thread overview]
Message-ID: <20020915232706.A21527@math.leidenuniv.nl> (raw)
In-Reply-To: <20020913.112235.27948638.davem@redhat.com>; from davem@redhat.com on Fri, Sep 13, 2002 at 11:22:35AM -0700
On Fri, Sep 13, 2002 at 11:22:35AM -0700, David S. Miller wrote:
> > You need to remove the IPv4 bits, that copy of the MAC has to happen
> > at a different layer, it does not belong in IPv4. At best, everyone
> > shouldn't eat that header copy.
>
> What if I make the memcpy conditional on "if (skb->physindev != NULL)"?
>
> First explain to me why the copy is needed for.
This is just to elaborate upon what Bart said earlier.
In the "L2 switched frame" case, we have a bit of a nasty problem
with IP fragmentation. And in the "L3 'switched' frame" case
(brouted frame), we have an ordering problem with IP fragmentation
and neighbor resolution.
This is what the call stack looks like when we have a purely
bridged frame (that needs to be netfiltered):
net_rx_action
-> br_handle_frame
-> PF_BRIDGE/PRE_ROUTING
-> br_handle_frame_finish
-> br_forward
-> PF_BRIDGE/FORWARD
-> __br_forward_finish
-> PF_BRIDGE/POST_ROUTING
-> dev_queue_xmit
This case is easy to see. With ip_conntrack enabled, packets
are reassembled in PRE_ROUTING and refragmented in POST_ROUTING.
This refragmenting messes up the hardware header, so the fragments
will leave the box with incorrect HW headers.
The broute case is a bit harder to see. If L3 (routed) packets
are destined for a bridge device, we don't know what subdevice
(slave port) they will go to until the bridge layer's br_dev_xmit
has its way. However, we would like to be able to use the real
outgoing interface (physoutdev) in FORWARD and POST_ROUTING.
To be able to do this, we postpone calling IPv4/FORWARD and
IPv4/POST_ROUTING until after PF_BRIDGE/POST_ROUTING has happened,
because at that point we know physoutdev so we can feed it to
said IPv4 hooks.
But. Packet refragmentation normally happens in IPv4/POST_ROUTING.
We don't want to do it there though, because that would cause the
eventual call to IPv4/FORWARD and IPv4/POST_ROUTING to see all
fragments instead of one packet (which goes against the idea of
conntrack).
So if we postpone FORWARD and POST_ROUTING until after br_dev_xmit,
we effectively reverse refragmentation and neighbor resolution.
But refragmentation messes up the hardware header.
The 16byte hardware header copy fixes this by copying to each
fragment the hardware header that was tacked onto or was already
present on the bigger packet. It's ugly, I admit. There's
currently no better way though.
(And Bart, I chose 16 because 16-byte aligned 16-byte copies
should be cheaper than 2-byte aligned 14-byte copies, and there
should be at least 16 bytes before skb->data at this point
anyway. That is, if I understood the code correctly.)
cheers,
Lennert
next prev parent reply other threads:[~2002-09-15 21:22 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-11 22:32 802.1q + device removal causing hang Simon Kirby
2002-09-11 22:31 ` David S. Miller
2002-09-12 6:36 ` [PATCH] ebtables - Ethernet bridge tables, for 2.5.34 Bart De Schuymer
2002-09-12 23:04 ` David S. Miller
2002-09-13 3:20 ` Bart De Schuymer
2002-09-13 4:29 ` David S. Miller
2002-09-13 6:12 ` Bart De Schuymer
2002-09-13 6:09 ` David S. Miller
2002-09-13 12:45 ` bridge-netfilter patch (was: Re: [PATCH] ebtables - Ethernet bridge tables, for 2.5.34) Lennert Buytenhek
2002-09-13 18:22 ` bridge-netfilter patch David S. Miller
2002-09-14 7:05 ` Bart De Schuymer
2002-09-16 3:35 ` David S. Miller
2002-09-16 21:41 ` Bart De Schuymer
2002-09-16 23:21 ` David S. Miller
2002-09-17 19:10 ` Bart De Schuymer
2002-09-17 19:35 ` David S. Miller
2002-09-15 21:27 ` Lennert Buytenhek [this message]
2002-09-16 6:50 ` [PATCH] ebtables - Ethernet bridge tables, for 2.5.35 Bart De Schuymer
2002-09-16 23:01 ` David S. Miller
2002-10-14 18:05 ` [RFC] bridge-nf -- map IPv4 hooks onto bridge hooks, vs 2.5.42 Bart De Schuymer
2002-10-14 18:01 ` David S. Miller
2002-10-14 18:32 ` bert hubert
2002-10-14 18:58 ` Bart De Schuymer
2002-10-14 19:02 ` David S. Miller
2002-10-14 19:29 ` Bart De Schuymer
2002-10-14 19:26 ` David S. Miller
2002-10-20 22:20 ` [RFC] bridge-nf -- map IPv4 hooks onto bridge hooks, vs 2.5.44 Bart De Schuymer
2002-10-20 22:19 ` David S. Miller
2002-10-22 23:40 ` Bart De Schuymer
2002-10-25 6:01 ` [PATCH][RFC] bridge-nf -- map IPv4 hooks onto bridge hooks - try 3, " Bart De Schuymer
2002-10-25 6:22 ` [netfilter-core] " Harald Welte
2002-10-28 13:02 ` David S. Miller
[not found] ` <200210141953.38933.bart.de.schuymer@pandora.be>
2002-10-14 19:59 ` [RFC] place to put bridge-netfilter specific data in the skbuff Bart De Schuymer
2002-10-24 8:16 ` [netfilter-core] " Harald Welte
2002-10-24 8:15 ` David S. Miller
2002-10-24 12:22 ` Harald Welte
2002-09-12 23:49 ` 802.1q + device removal causing hang Simon Kirby
2002-09-12 23:53 ` David S. Miller
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=20020915232706.A21527@math.leidenuniv.nl \
--to=buytenh@math.leidenuniv.nl \
--cc=bart.de.schuymer@pandora.be \
--cc=davem@redhat.com \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.