• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/net/ipv6/

Lines Matching refs:idev

102 static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf *p);
107 static int __ipv6_regen_rndid(struct inet6_dev *idev);
108 static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr);
114 static int ipv6_count_addresses(struct inet6_dev *idev);
135 static void addrconf_dad_run(struct inet6_dev *idev);
140 static void inet6_prefix_notify(int event, struct inet6_dev *idev,
254 static int snmp6_alloc_dev(struct inet6_dev *idev)
258 if (!idev || !idev->dev)
261 if (snmp_mib_init((void **)idev->stats.ipv6,
265 if (snmp_mib_init((void **)idev->stats.icmpv6,
273 snmp_mib_free((void **)idev->stats.ipv6);
278 static int snmp6_free_dev(struct inet6_dev *idev)
280 snmp_mib_free((void **)idev->stats.icmpv6);
281 snmp_mib_free((void **)idev->stats.ipv6);
289 struct inet6_dev *idev = container_of(head, struct inet6_dev, rcu);
290 kfree(idev);
293 void in6_dev_finish_destroy(struct inet6_dev *idev)
295 struct net_device *dev = idev->dev;
296 BUG_TRAP(idev->addr_list==NULL);
297 BUG_TRAP(idev->mc_list==NULL);
302 if (!idev->dead) {
303 printk("Freeing alive inet6 device %p\n", idev);
306 snmp6_free_dev(idev);
307 call_rcu(&idev->rcu, in6_dev_finish_destroy_rcu);
409 struct inet6_dev *idev;
413 if ((idev = __in6_dev_get(dev)) == NULL) {
414 if ((idev = ipv6_add_dev(dev)) == NULL)
419 ipv6_mc_up(idev);
420 return idev;
424 static void dev_forward_change(struct inet6_dev *idev)
430 if (!idev)
432 dev = idev->dev;
436 if (idev->cnf.forwarding)
441 for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) {
444 if (idev->cnf.forwarding)
455 struct inet6_dev *idev;
460 idev = __in6_dev_get(dev);
461 if (idev) {
462 int changed = (!idev->cnf.forwarding) ^ (!ipv6_devconf.forwarding);
463 idev->cnf.forwarding = ipv6_devconf.forwarding;
465 dev_forward_change(idev);
483 in6_dev_put(ifp->idev);
498 ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp)
507 for (ifap = &idev->addr_list; (ifa = *ifap) != NULL;
520 ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
529 if (idev->dead) {
537 if (ipv6_chk_same_addr(addr, idev->dev)) {
551 rt = addrconf_dst_alloc(idev, addr, 0);
579 ifa->idev = idev;
580 in6_dev_hold(idev);
592 write_lock(&idev->lock);
594 ipv6_link_dev_addr(idev, ifa);
598 ifa->tmp_next = idev->tempaddr_list;
599 idev->tempaddr_list = ifa;
605 write_unlock(&idev->lock);
627 struct inet6_dev *idev = ifp->idev;
648 write_lock_bh(&idev->lock);
651 for (ifap = &idev->tempaddr_list; (ifa=*ifap) != NULL;
667 for (ifap = &idev->addr_list; (ifa=*ifap) != NULL;) {
701 write_unlock_bh(&idev->lock);
729 rt = rt6_lookup(&prefix, NULL, ifp->idev->dev->ifindex, 1);
749 struct inet6_dev *idev = ifp->idev;
757 write_lock(&idev->lock);
767 in6_dev_hold(idev);
768 if (idev->cnf.use_tempaddr <= 0) {
769 write_unlock(&idev->lock);
772 in6_dev_put(idev);
777 if (ifp->regen_count++ >= idev->cnf.regen_max_retry) {
778 idev->cnf.use_tempaddr = -1;
780 write_unlock(&idev->lock);
783 in6_dev_put(idev);
789 if (__ipv6_try_regen_rndid(idev, tmpaddr) < 0) {
791 write_unlock(&idev->lock);
795 in6_dev_put(idev);
799 memcpy(&addr.s6_addr[8], idev->rndid, 8);
802 idev->cnf.temp_valid_lft);
805 idev->cnf.temp_prefered_lft - desync_factor / HZ);
807 max_addresses = idev->cnf.max_addresses;
812 write_unlock(&idev->lock);
820 ipv6_count_addresses(idev) < max_addresses ?
821 ipv6_add_addr(idev, &addr, tmp_plen,
826 in6_dev_put(idev);
830 write_lock(&idev->lock);
844 in6_dev_put(idev);
921 struct inet6_dev *idev;
941 idev = __in6_dev_get(dev);
942 if (!idev)
945 read_lock_bh(&idev->lock);
946 for (ifa = idev->addr_list; ifa; ifa = ifa->if_next) {
1067 daddr_dev == ifa_result->idev->dev)
1072 daddr_dev == ifa->idev->dev) {
1106 (ifa_result->idev->cnf.use_tempaddr >= 2))
1111 (ifa->idev->cnf.use_tempaddr >= 2)) {
1145 read_unlock_bh(&idev->lock);
1170 struct inet6_dev *idev;
1174 if ((idev = __in6_dev_get(dev)) != NULL) {
1177 read_lock_bh(&idev->lock);
1178 for (ifp=idev->addr_list; ifp; ifp=ifp->if_next) {
1185 read_unlock_bh(&idev->lock);
1191 static int ipv6_count_addresses(struct inet6_dev *idev)
1196 read_lock_bh(&idev->lock);
1197 for (ifp=idev->addr_list; ifp; ifp=ifp->if_next)
1199 read_unlock_bh(&idev->lock);
1212 if (dev == NULL || ifp->idev->dev == dev ||
1231 if (dev == NULL || ifp->idev->dev == dev)
1246 if (dev == NULL || ifp->idev->dev == dev ||
1316 if (strcmp(ifp->idev->dev->name, lan_if_name) == 0)
1319 ifp->idev->cnf.forwarding = 0;
1322 else if (strcmp(ifp->idev->dev->name, wan_if_name) == 0)
1325 ifp->idev->cnf.forwarding = 0;
1363 printk(KERN_INFO "%s: duplicate address detected!\n", ifp->idev->dev->name);
1380 void addrconf_leave_solict(struct inet6_dev *idev, struct in6_addr *addr)
1384 if (idev->dev->flags&(IFF_LOOPBACK|IFF_NOARP))
1388 __ipv6_dev_mc_dec(idev, &maddr);
1397 ipv6_dev_ac_inc(ifp->idev->dev, &addr);
1406 __ipv6_dev_ac_dec(ifp->idev, &addr);
1473 static int ipv6_inherit_eui64(u8 *eui, struct inet6_dev *idev)
1478 read_lock_bh(&idev->lock);
1479 for (ifp=idev->addr_list; ifp; ifp=ifp->if_next) {
1486 read_unlock_bh(&idev->lock);
1492 static int __ipv6_regen_rndid(struct inet6_dev *idev)
1495 get_random_bytes(idev->rndid, sizeof(idev->rndid));
1496 idev->rndid[0] &= ~0x02;
1498 if (idev->rndid[0] == 0xfd &&
1499 (idev->rndid[1]&idev->rndid[2]&idev->rndid[3]&idev->rndid[4]&idev->rndid[5]&idev->rndid[6]) == 0xff &&
1500 (idev->rndid[7]&0x80))
1502 if ((idev->rndid[0]|idev->rndid[1]) == 0) {
1503 if (idev->rndid[2] == 0x5e && idev->rndid[3] == 0xfe)
1505 if ((idev->rndid[2]|idev->rndid[3]|idev->rndid[4]|idev->rndid[5]|idev->rndid[6]|idev->rndid[7]) == 0x00)
1514 struct inet6_dev *idev = (struct inet6_dev *) data;
1518 write_lock_bh(&idev->lock);
1520 if (idev->dead)
1523 if (__ipv6_regen_rndid(idev) < 0)
1527 idev->cnf.temp_prefered_lft * HZ -
1528 idev->cnf.regen_max_retry * idev->cnf.dad_transmits * idev->nd_parms->retrans_time - desync_factor;
1532 idev->dev->name);
1536 if (!mod_timer(&idev->regen_timer, expires))
1537 in6_dev_hold(idev);
1540 write_unlock_bh(&idev->lock);
1542 in6_dev_put(idev);
1545 static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr) {
1548 if (tmpaddr && memcmp(idev->rndid, &tmpaddr->s6_addr[8], 8) == 0)
1549 ret = __ipv6_regen_rndid(idev);
1628 struct inet6_dev *idev;
1632 if ((idev = ipv6_find_idev(dev)) == NULL)
1640 return idev;
1938 struct inet6_dev *idev;
1952 if ((idev = addrconf_add_dev(dev)) == NULL)
1969 ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags);
1997 struct inet6_dev *idev;
2003 if ((idev = __in6_dev_get(dev)) == NULL)
2006 read_lock_bh(&idev->lock);
2007 for (ifp = idev->addr_list; ifp; ifp=ifp->if_next) {
2011 read_unlock_bh(&idev->lock);
2021 if (strcmp(ifp->idev->dev->name, wan_if_name) == 0) {
2027 ifp->idev->cnf.forwarding = 1;
2036 if (idev->addr_list == NULL)
2037 addrconf_ifdown(idev->dev, 1);
2041 read_unlock_bh(&idev->lock);
2082 static void sit_add_v4_addrs(struct inet6_dev *idev)
2092 memcpy(&addr.s6_addr32[3], idev->dev->dev_addr, 4);
2094 if (idev->dev->flags&IFF_POINTOPOINT) {
2102 ifp = ipv6_add_addr(idev, &addr, 128, scope, IFA_F_PERMANENT);
2128 if (idev->dev->flags&IFF_POINTOPOINT)
2132 if (idev->dev->flags&IFF_POINTOPOINT)
2137 ifp = ipv6_add_addr(idev, &addr, plen, flag,
2154 struct inet6_dev *idev;
2161 if ((idev = ipv6_find_idev(dev)) == NULL) {
2166 ifp = ipv6_add_addr(idev, &in6addr_loopback, 128, IFA_HOST, IFA_F_PERMANENT);
2176 static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr)
2182 if (idev->cnf.optimistic_dad &&
2188 ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, addr_flags);
2190 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0);
2199 struct inet6_dev * idev;
2212 idev = addrconf_add_dev(dev);
2213 if (idev == NULL)
2220 addrconf_add_linklocal(idev, &addr);
2226 struct inet6_dev *idev;
2236 if ((idev = ipv6_find_idev(dev)) == NULL) {
2241 sit_add_v4_addrs(idev);
2252 ipv6_inherit_linklocal(struct inet6_dev *idev, struct net_device *link_dev)
2257 addrconf_add_linklocal(idev, &lladdr);
2263 static void ip6_tnl_add_linklocal(struct inet6_dev *idev)
2268 if (idev->dev->iflink &&
2269 (link_dev = __dev_get_by_index(idev->dev->iflink))) {
2270 if (!ipv6_inherit_linklocal(idev, link_dev))
2275 if (!ipv6_inherit_linklocal(idev, link_dev))
2288 struct inet6_dev *idev;
2292 if ((idev = addrconf_add_dev(dev)) == NULL) {
2296 ip6_tnl_add_linklocal(idev);
2303 struct inet6_dev *idev = __in6_dev_get(dev);
2308 if (!idev && dev->mtu >= IPV6_MIN_MTU) {
2309 idev = ipv6_add_dev(dev);
2310 if (!idev)
2327 if (idev)
2328 idev->if_flags |= IF_READY;
2335 if (idev) {
2336 if (idev->if_flags & IF_READY) {
2340 idev->if_flags |= IF_READY;
2368 if (idev) {
2370 addrconf_dad_run(idev);
2374 idev as well as routers.
2376 if (idev->cnf.mtu6 != dev->mtu && dev->mtu >= IPV6_MIN_MTU) {
2378 idev->cnf.mtu6 = dev->mtu;
2380 idev->tstamp = jiffies;
2381 inet6_ifinfo_notify(RTM_NEWLINK, idev);
2391 if ( idev && dev->mtu >= IPV6_MIN_MTU) {
2393 idev->cnf.mtu6 = dev->mtu;
2408 if (idev) {
2409 snmp6_unregister_dev(idev);
2411 addrconf_sysctl_unregister(&idev->cnf);
2412 neigh_sysctl_unregister(idev->nd_parms);
2413 neigh_sysctl_register(dev, idev->nd_parms,
2417 addrconf_sysctl_register(idev, &idev->cnf);
2419 snmp6_register_dev(idev);
2437 struct inet6_dev *idev;
2449 idev = __in6_dev_get(dev);
2450 if (idev == NULL)
2457 idev->dead = 1;
2463 snmp6_unregister_dev(idev);
2473 if (ifa->idev == idev) {
2485 write_lock_bh(&idev->lock);
2489 idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY);
2493 if (how == 1 && del_timer(&idev->regen_timer))
2494 in6_dev_put(idev);
2497 while ((ifa = idev->tempaddr_list) != NULL) {
2498 idev->tempaddr_list = ifa->tmp_next;
2501 write_unlock_bh(&idev->lock);
2510 write_lock_bh(&idev->lock);
2513 while ((ifa = idev->addr_list) != NULL) {
2514 idev->addr_list = ifa->if_next;
2518 write_unlock_bh(&idev->lock);
2523 write_lock_bh(&idev->lock);
2525 write_unlock_bh(&idev->lock);
2530 ipv6_mc_destroy_dev(idev);
2532 ipv6_mc_down(idev);
2535 idev->tstamp = jiffies;
2536 inet6_ifinfo_notify(RTM_DELLINK, idev);
2542 addrconf_sysctl_unregister(&idev->cnf);
2543 neigh_sysctl_unregister(idev->nd_parms);
2545 neigh_parms_release(&nd_tbl, idev->nd_parms);
2547 in6_dev_put(idev);
2556 if (ifp->idev->cnf.forwarding)
2559 if (ifp->idev->if_flags & IF_RA_RCVD) {
2568 if (ifp->probes++ < ifp->idev->cnf.rtr_solicits) {
2573 (ifp->probes == ifp->idev->cnf.rtr_solicits) ?
2574 ifp->idev->cnf.rtr_solicit_delay :
2575 ifp->idev->cnf.rtr_solicit_interval);
2580 ndisc_send_rs(ifp->idev->dev, &ifp->addr, &all_routers);
2588 ifp->idev->dev->name);
2601 struct inet6_dev *idev = ifp->idev;
2606 rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1);
2608 ifp->probes = idev->cnf.dad_transmits;
2614 struct inet6_dev *idev = ifp->idev;
2615 struct net_device *dev = idev->dev;
2621 read_lock_bh(&idev->lock);
2631 read_unlock_bh(&idev->lock);
2637 if (!(idev->if_flags & IF_READY)) {
2639 read_unlock_bh(&idev->lock);
2660 read_unlock_bh(&idev->lock);
2666 struct inet6_dev *idev = ifp->idev;
2670 read_lock_bh(&idev->lock);
2671 if (idev->dead) {
2672 read_unlock_bh(&idev->lock);
2683 read_unlock_bh(&idev->lock);
2691 addrconf_mod_timer(ifp, AC_DAD, ifp->idev->nd_parms->retrans_time);
2693 read_unlock_bh(&idev->lock);
2698 ndisc_send_ns(ifp->idev->dev, NULL, &ifp->addr, &mcaddr, &unspec);
2705 struct net_device * dev = ifp->idev->dev;
2717 if (ifp->idev->cnf.forwarding == 0 &&
2718 ifp->idev->cnf.rtr_solicits > 0 &&
2730 ndisc_send_rs(ifp->idev->dev, &ifp->addr, &all_routers);
2734 ifp->idev->if_flags |= IF_RS_SENT;
2735 addrconf_mod_timer(ifp, AC_RS, ifp->idev->cnf.rtr_solicit_interval);
2740 static void addrconf_dad_run(struct inet6_dev *idev) {
2743 read_lock_bh(&idev->lock);
2744 for (ifp = idev->addr_list; ifp; ifp = ifp->if_next) {
2753 read_unlock_bh(&idev->lock);
2823 ifp->idev->dev->ifindex,
2827 ifp->idev->dev->name);
2934 regen_advance = ifp->idev->cnf.regen_max_retry *
2935 ifp->idev->cnf.dad_transmits *
2936 ifp->idev->nd_parms->retrans_time / HZ;
3084 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev,
3209 ifa->idev->dev->ifindex);
3239 int ifindex = ifmca->idev->dev->ifindex;
3298 struct inet6_dev *idev = NULL;
3313 if ((idev = in6_dev_get(dev)) == NULL)
3315 read_lock_bh(&idev->lock);
3319 for (ifa = idev->addr_list; ifa;
3332 for (ifmca = idev->mc_list; ifmca;
3345 for (ifaca = idev->ac_list; ifaca;
3359 read_unlock_bh(&idev->lock);
3360 in6_dev_put(idev);
3366 read_unlock_bh(&idev->lock);
3367 in6_dev_put(idev);
3540 static void snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int attrtype,
3545 __snmp6_fill_stats(stats, (void **)idev->stats.ipv6, IPSTATS_MIB_MAX, bytes);
3548 __snmp6_fill_stats(stats, (void **)idev->stats.icmpv6, ICMP6_MIB_MAX, bytes);
3553 static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
3556 struct net_device *dev = idev->dev;
3588 NLA_PUT_U32(skb, IFLA_INET6_FLAGS, idev->if_flags);
3591 ci.tstamp = (__u32)(TIME_DELTA(idev->tstamp, INITIAL_JIFFIES) / HZ * 100
3592 + TIME_DELTA(idev->tstamp, INITIAL_JIFFIES) % HZ * 100 / HZ);
3593 ci.reachable_time = idev->nd_parms->reachable_time;
3594 ci.retrans_time = idev->nd_parms->retrans_time;
3600 ipv6_store_devconf(&idev->cnf, nla_data(nla), nla_len(nla));
3606 snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla));
3611 snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_ICMP6STATS, nla_len(nla));
3626 struct inet6_dev *idev;
3633 if ((idev = in6_dev_get(dev)) == NULL)
3635 err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid,
3637 in6_dev_put(idev);
3649 void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
3658 err = inet6_fill_ifinfo(skb, idev, 0, 0, event, 0);
3678 static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
3694 pmsg->prefix_ifindex = idev->dev->ifindex;
3717 static void inet6_prefix_notify(int event, struct inet6_dev *idev,
3727 err = inet6_fill_prefix(skb, idev, pinfo, 0, 0, event, 0);
3754 if (ifp->idev->cnf.forwarding)
3758 if (ifp->idev->cnf.forwarding)
3760 addrconf_leave_solict(ifp->idev, &ifp->addr);
3771 if (likely(ifp->idev->dead == 0))
3791 struct inet6_dev *idev = (struct inet6_dev *)ctl->extra1;
3792 if (idev == NULL)
3794 dev_forward_change(idev);
3840 struct inet6_dev *idev = (struct inet6_dev *)table->extra1;
3842 if (unlikely(idev == NULL))
3847 dev_forward_change(idev);
4145 static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf *p)
4148 struct net_device *dev = idev ? idev->dev : NULL;
4157 t->addrconf_vars[i].extra1 = idev; /* embedded; no ref */
4301 struct inet6_dev *idev;
4319 if ((idev = __in6_dev_get(dev)) == NULL)
4356 struct inet6_dev *idev;
4357 idev = ipv6_find_idev(dev);
4358 if (idev)
4361 idev->cnf.forwarding = 1;