[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1255337454.2878.7.camel@cirrhata.linux-ipv6.org>
Date: Mon, 12 Oct 2009 17:50:54 +0900
From: YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [RESEND PATCH net-next-2.6 3/3] ipv6 sit: Set relay to 0.0.0.0
directly if relay_prefixlen == 0.
Eric Dumazet wrote:
> YOSHIFUJI Hideaki a écrit :
> > ipv6 sit: Set relay to 0.0.0.0 directly if relay_prefixlen == 0.
> >
> > Do not use bit-shift if relay_prefixlen == 0;
> > relay_prefix << 32 does not result in 0.
> >
> > Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>
> > ---
> > net/ipv6/sit.c | 9 ++++++---
> > 1 files changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
> > index 193d0c6..510d31f 100644
> > --- a/net/ipv6/sit.c
> > +++ b/net/ipv6/sit.c
> > @@ -1014,9 +1014,12 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
> > ip6rd.prefixlen);
> > if (!ipv6_addr_equal(&prefix, &ip6rd.prefix))
> > goto done;
> > - relay_prefix = ip6rd.relay_prefix &
> > - htonl(0xffffffffUL <<
> > - (32 - ip6rd.relay_prefixlen));
> > + if (ip6rd.relay_prefixlen)
> > + relay_prefix = ip6rd.relay_prefix &
> > + htonl(0xffffffffUL <<
> > + (32 - ip6rd.relay_prefixlen));
> > + else
> > + relay_prefix = 0;
> > if (relay_prefix != ip6rd.relay_prefix)
> > goto done;
> >
>
>
> Sorry I dont get it
>
> u32 val = any_value ;
> u32 relay_prefix = val & htonl(0xffffffffUL << 32) should give 0
>
> If not, something is broken and should be fixed.
Unfortunately, on x86 architecture (80286 and later at least),
lower 5 bits (& 0x1f) are used for shift operation.
Thus, 0xffffffffUL << 32 gives 0xffffffffUL.
--yoshfuji
--
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