aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5658d9d51637..12c97d8aa6bb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1996,23 +1996,6 @@ static void addrconf_add_mroute(struct net_device *dev)
1996 ip6_route_add(&cfg); 1996 ip6_route_add(&cfg);
1997} 1997}
1998 1998
1999#if IS_ENABLED(CONFIG_IPV6_SIT)
2000static void sit_route_add(struct net_device *dev)
2001{
2002 struct fib6_config cfg = {
2003 .fc_table = RT6_TABLE_MAIN,
2004 .fc_metric = IP6_RT_PRIO_ADDRCONF,
2005 .fc_ifindex = dev->ifindex,
2006 .fc_dst_len = 96,
2007 .fc_flags = RTF_UP | RTF_NONEXTHOP,
2008 .fc_nlinfo.nl_net = dev_net(dev),
2009 };
2010
2011 /* prefix length - 96 bits "::d.d.d.d" */
2012 ip6_route_add(&cfg);
2013}
2014#endif
2015
2016static struct inet6_dev *addrconf_add_dev(struct net_device *dev) 1999static struct inet6_dev *addrconf_add_dev(struct net_device *dev)
2017{ 2000{
2018 struct inet6_dev *idev; 2001 struct inet6_dev *idev;
@@ -2542,7 +2525,8 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2542 struct in6_addr addr; 2525 struct in6_addr addr;
2543 struct net_device *dev; 2526 struct net_device *dev;
2544 struct net *net = dev_net(idev->dev); 2527 struct net *net = dev_net(idev->dev);
2545 int scope; 2528 int scope, plen;
2529 u32 pflags = 0;
2546 2530
2547 ASSERT_RTNL(); 2531 ASSERT_RTNL();
2548 2532
@@ -2552,12 +2536,16 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2552 if (idev->dev->flags&IFF_POINTOPOINT) { 2536 if (idev->dev->flags&IFF_POINTOPOINT) {
2553 addr.s6_addr32[0] = htonl(0xfe800000); 2537 addr.s6_addr32[0] = htonl(0xfe800000);
2554 scope = IFA_LINK; 2538 scope = IFA_LINK;
2539 plen = 64;
2555 } else { 2540 } else {
2556 scope = IPV6_ADDR_COMPATv4; 2541 scope = IPV6_ADDR_COMPATv4;
2542 plen = 96;
2543 pflags |= RTF_NONEXTHOP;
2557 } 2544 }
2558 2545
2559 if (addr.s6_addr32[3]) { 2546 if (addr.s6_addr32[3]) {
2560 add_addr(idev, &addr, 128, scope); 2547 add_addr(idev, &addr, plen, scope);
2548 addrconf_prefix_route(&addr, plen, idev->dev, 0, pflags);
2561 return; 2549 return;
2562 } 2550 }
2563 2551
@@ -2569,7 +2557,6 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2569 int flag = scope; 2557 int flag = scope;
2570 2558
2571 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { 2559 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
2572 int plen;
2573 2560
2574 addr.s6_addr32[3] = ifa->ifa_local; 2561 addr.s6_addr32[3] = ifa->ifa_local;
2575 2562
@@ -2580,12 +2567,10 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2580 continue; 2567 continue;
2581 flag |= IFA_HOST; 2568 flag |= IFA_HOST;
2582 } 2569 }
2583 if (idev->dev->flags&IFF_POINTOPOINT)
2584 plen = 64;
2585 else
2586 plen = 96;
2587 2570
2588 add_addr(idev, &addr, plen, flag); 2571 add_addr(idev, &addr, plen, flag);
2572 addrconf_prefix_route(&addr, plen, idev->dev, 0,
2573 pflags);
2589 } 2574 }
2590 } 2575 }
2591 } 2576 }
@@ -2711,7 +2696,6 @@ static void addrconf_sit_config(struct net_device *dev)
2711 struct in6_addr addr; 2696 struct in6_addr addr;
2712 2697
2713 ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0); 2698 ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0);
2714 addrconf_prefix_route(&addr, 64, dev, 0, 0);
2715 if (!ipv6_generate_eui64(addr.s6_addr + 8, dev)) 2699 if (!ipv6_generate_eui64(addr.s6_addr + 8, dev))
2716 addrconf_add_linklocal(idev, &addr); 2700 addrconf_add_linklocal(idev, &addr);
2717 return; 2701 return;
@@ -2721,8 +2705,6 @@ static void addrconf_sit_config(struct net_device *dev)
2721 2705
2722 if (dev->flags&IFF_POINTOPOINT) 2706 if (dev->flags&IFF_POINTOPOINT)
2723 addrconf_add_mroute(dev); 2707 addrconf_add_mroute(dev);
2724 else
2725 sit_route_add(dev);
2726} 2708}
2727#endif 2709#endif
2728 2710
@@ -2740,8 +2722,6 @@ static void addrconf_gre_config(struct net_device *dev)
2740 } 2722 }
2741 2723
2742 ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0); 2724 ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0);
2743 addrconf_prefix_route(&addr, 64, dev, 0, 0);
2744
2745 if (!ipv6_generate_eui64(addr.s6_addr + 8, dev)) 2725 if (!ipv6_generate_eui64(addr.s6_addr + 8, dev))
2746 addrconf_add_linklocal(idev, &addr); 2726 addrconf_add_linklocal(idev, &addr);
2747} 2727}