[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100721153531.GN21121@mail.wantstofly.org>
Date: Wed, 21 Jul 2010 17:35:31 +0200
From: Lennert Buytenhek <buytenh@...tstofly.org>
To: Mike Frysinger <vapier.adi@...il.com>
Cc: Karl Beldan <karl.beldan@...il.com>, netdev@...r.kernel.org,
Graf Yang <graf.yang@...log.com>,
uclinux-dist-devel@...ckfin.uclinux.org,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [Uclinux-dist-devel] [PATCH 1/2] net: dsa: introduce STPID switch tagging handling code
On Wed, Jul 21, 2010 at 11:29:30AM -0400, Mike Frysinger wrote:
> >> + source_port = dsa_header[1] & 0x03;
> >> + if (source_port >= DSA_MAX_PORTS || ds->ports[source_port] == NULL)
> >> + goto out_drop;
> >> +
> >> + if (((dsa_header[0] & ETH_P_8021QH) == ETH_P_8021QH) &&
> >
> > This is bogus -- what it does is:
> >
> > if ((dsa_header[0] & 0x81) == 0x81)
> >
> > It doesn't look like you need to mask here at all.
>
> where does it say dsa_header[0] will always have 0x81 set ?
Eh?
This code is checking whether the packet has a STPID tag on it or not.
A STPID tag exists if the first 12 nibbles are 0x810.
You are checking whether the first 8 nibbles of this are equal to 0x81
by doing:
if ((byte & 0x81) == 0x81)
What if the first byte is 0x93? Or 0xc5?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists