From: Eric Dumazet <eric.dumazet@gmail.com>
To: Daniel Borkmann <dborkman@redhat.com>
Cc: David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, Ani Sinha <ani@aristanetworks.com>,
Jiri Pirko <jpirko@redhat.com>
Subject: Re: [PATCH net 1/2] net: dev_queue_xmit_nit: fix skb->vlan_tci field value
Date: Tue, 08 Jan 2013 12:04:52 -0800 [thread overview]
Message-ID: <1357675492.18156.420.camel@edumazet-glaptop> (raw)
In-Reply-To: <1357671093-9605-2-git-send-email-dborkman@redhat.com>
On Tue, 2013-01-08 at 19:51 +0100, Daniel Borkmann wrote:
> VLAN packets that are locally injected through taps will loose their
> skb->vlan_tci value when they pass dev_hard_start_xmit and get looped
> back to a packet sniffer via dev_queue_xmit_nit. Besides others, this
> meta data is used in Linux socket filtering for VLANs. Tested with a
> VLAN ancillary ops filter.
>
> Patch is based on a previous version by Jiri Pirko.
>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Ani Sinha <ani@aristanetworks.com>
> Cc: Jiri Pirko <jpirko@redhat.com>
> Reported-by: Paul Pearce <pearce@cs.berkeley.edu>
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> ---
> net/core/dev.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 515473e..723dcd0 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1775,6 +1775,19 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
> struct packet_type *ptype;
> struct sk_buff *skb2 = NULL;
> struct packet_type *pt_prev = NULL;
> + struct ethhdr *ehdr;
> +
> + /* Network taps could make use of skb->vlan_tci, which got wiped
> + * out. Hence, we need to reset it correctly.
> + */
> + skb_reset_mac_header(skb);
> + ehdr = eth_hdr(skb);
> +
> + if (ehdr->h_proto == __constant_htons(ETH_P_8021Q)) {
> + skb2 = vlan_untag(skb);
> + if (likely(skb2))
> + skb = skb2;
> + }
>
> rcu_read_lock();
> list_for_each_entry_rcu(ptype, &ptype_all, list) {
This patch is wrong (it adds a leak), and not needed.
If a packet has no vlan_tci, its for a good reason.
We want sniffer see the packet content as is.
next prev parent reply other threads:[~2013-01-08 20:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-08 18:51 [PATCH net 0/2] net: dev_queue_xmit_nit fixes Daniel Borkmann
2013-01-08 18:51 ` [PATCH net 1/2] net: dev_queue_xmit_nit: fix skb->vlan_tci field value Daniel Borkmann
2013-01-08 19:54 ` Ani Sinha
2013-01-08 20:04 ` Eric Dumazet [this message]
2013-01-08 20:22 ` Jiri Pirko
2013-01-08 20:42 ` Eric Dumazet
2013-01-08 20:14 ` Jiri Pirko
2013-01-08 18:51 ` [PATCH net 2/2] net: dev_queue_xmit_nit: fix potential NULL ptr dereference Daniel Borkmann
2013-01-08 19:22 ` Eric Dumazet
2013-01-08 19:38 ` Daniel Borkmann
-- strict thread matches above, loose matches on Subject: below --
2013-01-09 5:15 [PATCH net 1/2] net: dev_queue_xmit_nit: fix skb->vlan_tci field value Paul Pearce
2013-01-09 6:06 ` Ani Sinha
2013-01-09 6:27 ` Eric Dumazet
2013-01-09 6:34 ` Ani Sinha
2013-01-09 19:27 ` Ani Sinha
2013-01-09 19:51 ` Eric Dumazet
2013-01-09 20:01 ` Ani Sinha
2013-01-09 20:06 ` Ani Sinha
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=1357675492.18156.420.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=ani@aristanetworks.com \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=jpirko@redhat.com \
--cc=netdev@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