diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2013-11-14 07:51:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-11-14 16:59:16 -0500 |
commit | 929c9cf310565a97ec9bc685abbfeaed5fceb557 (patch) | |
tree | 147f8d155639aa11d87c0cfa7b6f2f5cd65e1be3 /net/ipv6/addrconf.c | |
parent | f9a23c84486ed350cce7bb1b2828abd1f6658796 (diff) |
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: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r-- | net/ipv6/addrconf.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 542d09561ed6..27fedc3e4449 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2528,7 +2528,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) | |||
2528 | struct in6_addr addr; | 2528 | struct in6_addr addr; |
2529 | struct net_device *dev; | 2529 | struct net_device *dev; |
2530 | struct net *net = dev_net(idev->dev); | 2530 | struct net *net = dev_net(idev->dev); |
2531 | int scope; | 2531 | int scope, plen; |
2532 | 2532 | ||
2533 | ASSERT_RTNL(); | 2533 | ASSERT_RTNL(); |
2534 | 2534 | ||
@@ -2538,12 +2538,14 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) | |||
2538 | if (idev->dev->flags&IFF_POINTOPOINT) { | 2538 | if (idev->dev->flags&IFF_POINTOPOINT) { |
2539 | addr.s6_addr32[0] = htonl(0xfe800000); | 2539 | addr.s6_addr32[0] = htonl(0xfe800000); |
2540 | scope = IFA_LINK; | 2540 | scope = IFA_LINK; |
2541 | plen = 64; | ||
2541 | } else { | 2542 | } else { |
2542 | scope = IPV6_ADDR_COMPATv4; | 2543 | scope = IPV6_ADDR_COMPATv4; |
2544 | plen = 96; | ||
2543 | } | 2545 | } |
2544 | 2546 | ||
2545 | if (addr.s6_addr32[3]) { | 2547 | if (addr.s6_addr32[3]) { |
2546 | add_addr(idev, &addr, 128, scope); | 2548 | add_addr(idev, &addr, plen, scope); |
2547 | return; | 2549 | return; |
2548 | } | 2550 | } |
2549 | 2551 | ||
@@ -2555,7 +2557,6 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) | |||
2555 | int flag = scope; | 2557 | int flag = scope; |
2556 | 2558 | ||
2557 | for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { | 2559 | for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { |
2558 | int plen; | ||
2559 | 2560 | ||
2560 | addr.s6_addr32[3] = ifa->ifa_local; | 2561 | addr.s6_addr32[3] = ifa->ifa_local; |
2561 | 2562 | ||
@@ -2566,10 +2567,6 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) | |||
2566 | continue; | 2567 | continue; |
2567 | flag |= IFA_HOST; | 2568 | flag |= IFA_HOST; |
2568 | } | 2569 | } |
2569 | if (idev->dev->flags&IFF_POINTOPOINT) | ||
2570 | plen = 64; | ||
2571 | else | ||
2572 | plen = 96; | ||
2573 | 2570 | ||
2574 | add_addr(idev, &addr, plen, flag); | 2571 | add_addr(idev, &addr, plen, flag); |
2575 | } | 2572 | } |