Skip to contentSkip to conversation

ipv6 sit: Set relay to 0.0.0.0 directly if relay_prefixlen == 0.

PATCH New YOSHIFUJI Hideaki (吉藤 英明) 1 participant 1 message Oct 11, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 ipv6 sit: Set relay to 0.0.0.0 directly if relay_prefixlen == 0.

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.

---
 net/ipv6/sit.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
net/ipv6/sit.c +6 -3
index 193d0c6..510d31f 100644
@@ -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;
 
Signature · 1 line
1.5.6.5