Skip to content

Commit 91b2a3f

Browse files
yoshfujidavem330
authored andcommitted
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. Signed-off-by: YOSHIFUJI Hideaki <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e7db38c commit 91b2a3f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

net/ipv6/sit.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,9 +1014,12 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
10141014
ip6rd.prefixlen);
10151015
if (!ipv6_addr_equal(&prefix, &ip6rd.prefix))
10161016
goto done;
1017-
relay_prefix = ip6rd.relay_prefix &
1018-
htonl(0xffffffffUL <<
1019-
(32 - ip6rd.relay_prefixlen));
1017+
if (ip6rd.relay_prefixlen)
1018+
relay_prefix = ip6rd.relay_prefix &
1019+
htonl(0xffffffffUL <<
1020+
(32 - ip6rd.relay_prefixlen));
1021+
else
1022+
relay_prefix = 0;
10201023
if (relay_prefix != ip6rd.relay_prefix)
10211024
goto done;
10221025

0 commit comments

Comments
 (0)