ipv6 sit: Set relay to 0.0.0.0 directly if relay_prefixlen == 0.
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Sun, 11 Oct 2009 03:45:13 +0000 (03:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Oct 2009 06:41:10 +0000 (23:41 -0700)
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@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/sit.c

index 193d0c6c5ce2a1abbb04bd68a00808f24ae8790c..510d31f3cb9689e35eff467667764671f68686a6 100644 (file)
@@ -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;