Commit 929c9cf3 authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller

sit: fix prefix length of ll and v4mapped addresses

When the local IPv4 endpoint is wilcard (0.0.0.0), the prefix length is
correctly set, ie 64 if the address is a link local one or 96 if the address is
a v4 mapped one.
But when the local endpoint is specified, the prefix length is set to 128 for
both kind of address. This patch fix this wrong prefix length.
Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f9a23c84
...@@ -2528,7 +2528,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) ...@@ -2528,7 +2528,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
struct in6_addr addr; struct in6_addr addr;
struct net_device *dev; struct net_device *dev;
struct net *net = dev_net(idev->dev); struct net *net = dev_net(idev->dev);
int scope; int scope, plen;
ASSERT_RTNL(); ASSERT_RTNL();
...@@ -2538,12 +2538,14 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) ...@@ -2538,12 +2538,14 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
if (idev->dev->flags&IFF_POINTOPOINT) { if (idev->dev->flags&IFF_POINTOPOINT) {
addr.s6_addr32[0] = htonl(0xfe800000); addr.s6_addr32[0] = htonl(0xfe800000);
scope = IFA_LINK; scope = IFA_LINK;
plen = 64;
} else { } else {
scope = IPV6_ADDR_COMPATv4; scope = IPV6_ADDR_COMPATv4;
plen = 96;
} }
if (addr.s6_addr32[3]) { if (addr.s6_addr32[3]) {
add_addr(idev, &addr, 128, scope); add_addr(idev, &addr, plen, scope);
return; return;
} }
...@@ -2555,7 +2557,6 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) ...@@ -2555,7 +2557,6 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
int flag = scope; int flag = scope;
for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
int plen;
addr.s6_addr32[3] = ifa->ifa_local; addr.s6_addr32[3] = ifa->ifa_local;
...@@ -2566,10 +2567,6 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) ...@@ -2566,10 +2567,6 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
continue; continue;
flag |= IFA_HOST; flag |= IFA_HOST;
} }
if (idev->dev->flags&IFF_POINTOPOINT)
plen = 64;
else
plen = 96;
add_addr(idev, &addr, plen, flag); add_addr(idev, &addr, plen, flag);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment