[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130814113840.GB2010@order.stressinduktion.org>
Date: Wed, 14 Aug 2013 13:38:40 +0200
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: Alexander Aring <alex.aring@...il.com>
Cc: alex.bluesman.smirnov@...il.com, dbaryshkov@...il.com,
davem@...emloft.net, linux-zigbee-devel@...ts.sourceforge.net,
netdev@...r.kernel.org
Subject: Re: [PATCHv2 net-next] 6lowpan: handle only real link-local addresses
On Wed, Aug 14, 2013 at 01:29:04PM +0200, Alexander Aring wrote:
> Hi Hannes,
>
> On Wed, Aug 14, 2013 at 01:08:21PM +0200, Hannes Frederic Sowa wrote:
> > On Wed, Aug 14, 2013 at 01:01:07PM +0200, Alexander Aring wrote:
> > > diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h
> > > index 4b8f917..61f0ce9 100644
> > > --- a/net/ieee802154/6lowpan.h
> > > +++ b/net/ieee802154/6lowpan.h
> > > @@ -83,8 +83,11 @@
> > > #define ipaddr_prefixcmp(addr1, addr2, length) \
> > > (memcmp(addr1, addr2, length >> 3) == 0)
> > >
> > > -/* local link, i.e. FE80::/10 */
> > > -#define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80))
> > > +/* link-local, i.e. FE80::/64 */
> > > +#define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80) && \
> > > + (((a)->s6_addr16[1]) == 0) && \
> > > + (((a)->s6_addr16[2]) == 0) && \
> > > + (((a)->s6_addr16[3]) == 0))
> > >
> >
> > Can't you use ipv6_addr_type(a)&IPV6_ADDR_LINKLOCAL?
> >
> Of course, thanks for this hint I will take this on the list to change
> it for checking for a multicast address, too.
>
>
> I looked in the implementation of ipv6_addr_type and some little thing
> confusing me.
> A local-link address is FE80::/64, but the __ipv6_addr_type function
> checks for FE80::/32.
This should be a test of fe80::/10 as specified in
http://tools.ietf.org/html/rfc4291#section-2.5.6. Look at the parentheses
between (st & htonl()) == htonl(..)
Yes, we don't seem to care about the zeros padded in the address. As specified
by IANA, these addresses would still count as link-local:
https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml
Greetings,
Hannes
--
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