addrconf.c (fae6ec69c84d71b1d5bda9ede1a262c1681684aa) | addrconf.c (0d51aa80a9b1db43920c0770c3bb842dd823c005) |
---|---|
1/* 2 * IPv6 Address [auto]configuration 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 8 * --- 681 unchanged lines hidden (view full) --- 690 struct in6_addr prefix; 691 struct rt6_info *rt; 692 693 ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len); 694 rt = rt6_lookup(&prefix, NULL, ifp->idev->dev->ifindex, 1); 695 696 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 697 if (onlink == 0) { | 1/* 2 * IPv6 Address [auto]configuration 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 8 * --- 681 unchanged lines hidden (view full) --- 690 struct in6_addr prefix; 691 struct rt6_info *rt; 692 693 ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len); 694 rt = rt6_lookup(&prefix, NULL, ifp->idev->dev->ifindex, 1); 695 696 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 697 if (onlink == 0) { |
698 ip6_del_rt(rt, NULL, NULL); | 698 ip6_del_rt(rt, NULL, NULL, NULL); |
699 rt = NULL; 700 } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { 701 rt->rt6i_expires = expires; 702 rt->rt6i_flags |= RTF_EXPIRES; 703 } 704 } 705 dst_release(&rt->u.dst); 706 } --- 628 unchanged lines hidden (view full) --- 1335 1336 /* Prevent useless cloning on PtP SIT. 1337 This thing is done here expecting that the whole 1338 class of non-broadcast devices need not cloning. 1339 */ 1340 if (dev->type == ARPHRD_SIT && (dev->flags&IFF_POINTOPOINT)) 1341 rtmsg.rtmsg_flags |= RTF_NONEXTHOP; 1342 | 699 rt = NULL; 700 } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { 701 rt->rt6i_expires = expires; 702 rt->rt6i_flags |= RTF_EXPIRES; 703 } 704 } 705 dst_release(&rt->u.dst); 706 } --- 628 unchanged lines hidden (view full) --- 1335 1336 /* Prevent useless cloning on PtP SIT. 1337 This thing is done here expecting that the whole 1338 class of non-broadcast devices need not cloning. 1339 */ 1340 if (dev->type == ARPHRD_SIT && (dev->flags&IFF_POINTOPOINT)) 1341 rtmsg.rtmsg_flags |= RTF_NONEXTHOP; 1342 |
1343 ip6_route_add(&rtmsg, NULL, NULL); | 1343 ip6_route_add(&rtmsg, NULL, NULL, NULL); |
1344} 1345 1346/* Create "default" multicast route to the interface */ 1347 1348static void addrconf_add_mroute(struct net_device *dev) 1349{ 1350 struct in6_rtmsg rtmsg; 1351 1352 memset(&rtmsg, 0, sizeof(rtmsg)); 1353 ipv6_addr_set(&rtmsg.rtmsg_dst, 1354 htonl(0xFF000000), 0, 0, 0); 1355 rtmsg.rtmsg_dst_len = 8; 1356 rtmsg.rtmsg_metric = IP6_RT_PRIO_ADDRCONF; 1357 rtmsg.rtmsg_ifindex = dev->ifindex; 1358 rtmsg.rtmsg_flags = RTF_UP; 1359 rtmsg.rtmsg_type = RTMSG_NEWROUTE; | 1344} 1345 1346/* Create "default" multicast route to the interface */ 1347 1348static void addrconf_add_mroute(struct net_device *dev) 1349{ 1350 struct in6_rtmsg rtmsg; 1351 1352 memset(&rtmsg, 0, sizeof(rtmsg)); 1353 ipv6_addr_set(&rtmsg.rtmsg_dst, 1354 htonl(0xFF000000), 0, 0, 0); 1355 rtmsg.rtmsg_dst_len = 8; 1356 rtmsg.rtmsg_metric = IP6_RT_PRIO_ADDRCONF; 1357 rtmsg.rtmsg_ifindex = dev->ifindex; 1358 rtmsg.rtmsg_flags = RTF_UP; 1359 rtmsg.rtmsg_type = RTMSG_NEWROUTE; |
1360 ip6_route_add(&rtmsg, NULL, NULL); | 1360 ip6_route_add(&rtmsg, NULL, NULL, NULL); |
1361} 1362 1363static void sit_route_add(struct net_device *dev) 1364{ 1365 struct in6_rtmsg rtmsg; 1366 1367 memset(&rtmsg, 0, sizeof(rtmsg)); 1368 1369 rtmsg.rtmsg_type = RTMSG_NEWROUTE; 1370 rtmsg.rtmsg_metric = IP6_RT_PRIO_ADDRCONF; 1371 1372 /* prefix length - 96 bits "::d.d.d.d" */ 1373 rtmsg.rtmsg_dst_len = 96; 1374 rtmsg.rtmsg_flags = RTF_UP|RTF_NONEXTHOP; 1375 rtmsg.rtmsg_ifindex = dev->ifindex; 1376 | 1361} 1362 1363static void sit_route_add(struct net_device *dev) 1364{ 1365 struct in6_rtmsg rtmsg; 1366 1367 memset(&rtmsg, 0, sizeof(rtmsg)); 1368 1369 rtmsg.rtmsg_type = RTMSG_NEWROUTE; 1370 rtmsg.rtmsg_metric = IP6_RT_PRIO_ADDRCONF; 1371 1372 /* prefix length - 96 bits "::d.d.d.d" */ 1373 rtmsg.rtmsg_dst_len = 96; 1374 rtmsg.rtmsg_flags = RTF_UP|RTF_NONEXTHOP; 1375 rtmsg.rtmsg_ifindex = dev->ifindex; 1376 |
1377 ip6_route_add(&rtmsg, NULL, NULL); | 1377 ip6_route_add(&rtmsg, NULL, NULL, NULL); |
1378} 1379 1380static void addrconf_add_lroute(struct net_device *dev) 1381{ 1382 struct in6_addr addr; 1383 1384 ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0); 1385 addrconf_prefix_route(&addr, 64, dev, 0, 0); --- 76 unchanged lines hidden (view full) --- 1462 1463 if (pinfo->onlink) { 1464 struct rt6_info *rt; 1465 rt = rt6_lookup(&pinfo->prefix, NULL, dev->ifindex, 1); 1466 1467 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 1468 if (rt->rt6i_flags&RTF_EXPIRES) { 1469 if (valid_lft == 0) { | 1378} 1379 1380static void addrconf_add_lroute(struct net_device *dev) 1381{ 1382 struct in6_addr addr; 1383 1384 ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0); 1385 addrconf_prefix_route(&addr, 64, dev, 0, 0); --- 76 unchanged lines hidden (view full) --- 1462 1463 if (pinfo->onlink) { 1464 struct rt6_info *rt; 1465 rt = rt6_lookup(&pinfo->prefix, NULL, dev->ifindex, 1); 1466 1467 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 1468 if (rt->rt6i_flags&RTF_EXPIRES) { 1469 if (valid_lft == 0) { |
1470 ip6_del_rt(rt, NULL, NULL); | 1470 ip6_del_rt(rt, NULL, NULL, NULL); |
1471 rt = NULL; 1472 } else { 1473 rt->rt6i_expires = rt_expires; 1474 } 1475 } 1476 } else if (valid_lft) { 1477 addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len, 1478 dev, rt_expires, RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT); --- 1610 unchanged lines hidden (view full) --- 3089 3090static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) 3091{ 3092 inet6_ifa_notify(event ? : RTM_NEWADDR, ifp); 3093 3094 switch (event) { 3095 case RTM_NEWADDR: 3096 dst_hold(&ifp->rt->u.dst); | 1471 rt = NULL; 1472 } else { 1473 rt->rt6i_expires = rt_expires; 1474 } 1475 } 1476 } else if (valid_lft) { 1477 addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len, 1478 dev, rt_expires, RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT); --- 1610 unchanged lines hidden (view full) --- 3089 3090static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) 3091{ 3092 inet6_ifa_notify(event ? : RTM_NEWADDR, ifp); 3093 3094 switch (event) { 3095 case RTM_NEWADDR: 3096 dst_hold(&ifp->rt->u.dst); |
3097 if (ip6_ins_rt(ifp->rt, NULL, NULL)) | 3097 if (ip6_ins_rt(ifp->rt, NULL, NULL, NULL)) |
3098 dst_release(&ifp->rt->u.dst); 3099 if (ifp->idev->cnf.forwarding) 3100 addrconf_join_anycast(ifp); 3101 break; 3102 case RTM_DELADDR: 3103 if (ifp->idev->cnf.forwarding) 3104 addrconf_leave_anycast(ifp); 3105 addrconf_leave_solict(ifp->idev, &ifp->addr); 3106 dst_hold(&ifp->rt->u.dst); | 3098 dst_release(&ifp->rt->u.dst); 3099 if (ifp->idev->cnf.forwarding) 3100 addrconf_join_anycast(ifp); 3101 break; 3102 case RTM_DELADDR: 3103 if (ifp->idev->cnf.forwarding) 3104 addrconf_leave_anycast(ifp); 3105 addrconf_leave_solict(ifp->idev, &ifp->addr); 3106 dst_hold(&ifp->rt->u.dst); |
3107 if (ip6_del_rt(ifp->rt, NULL, NULL)) | 3107 if (ip6_del_rt(ifp->rt, NULL, NULL, NULL)) |
3108 dst_free(&ifp->rt->u.dst); 3109 else 3110 dst_release(&ifp->rt->u.dst); 3111 break; 3112 } 3113} 3114 3115static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) --- 498 unchanged lines hidden --- | 3108 dst_free(&ifp->rt->u.dst); 3109 else 3110 dst_release(&ifp->rt->u.dst); 3111 break; 3112 } 3113} 3114 3115static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) --- 498 unchanged lines hidden --- |