addrconf.c (244b7f4324895e7c796cc94e8a8f70288ed20bdc) addrconf.c (d5566fd72ec1924958fcfd48b65c022c8f7eae64)
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 *

--- 4715 unchanged lines hidden (view full) ---

4724 offsetof(struct ipstats_mib, syncp));
4725 break;
4726 case IFLA_INET6_ICMP6STATS:
4727 __snmp6_fill_statsdev(stats, idev->stats.icmpv6dev->mibs, ICMP6_MIB_MAX, bytes);
4728 break;
4729 }
4730}
4731
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 *

--- 4715 unchanged lines hidden (view full) ---

4724 offsetof(struct ipstats_mib, syncp));
4725 break;
4726 case IFLA_INET6_ICMP6STATS:
4727 __snmp6_fill_statsdev(stats, idev->stats.icmpv6dev->mibs, ICMP6_MIB_MAX, bytes);
4728 break;
4729 }
4730}
4731
4732static int inet6_fill_ifla6_attrs(struct sk_buff *skb, struct inet6_dev *idev)
4732static int inet6_fill_ifla6_attrs(struct sk_buff *skb, struct inet6_dev *idev,
4733 u32 ext_filter_mask)
4733{
4734 struct nlattr *nla;
4735 struct ifla_cacheinfo ci;
4736
4737 if (nla_put_u32(skb, IFLA_INET6_FLAGS, idev->if_flags))
4738 goto nla_put_failure;
4739 ci.max_reasm_len = IPV6_MAXPLEN;
4740 ci.tstamp = cstamp_delta(idev->tstamp);
4741 ci.reachable_time = jiffies_to_msecs(idev->nd_parms->reachable_time);
4742 ci.retrans_time = jiffies_to_msecs(NEIGH_VAR(idev->nd_parms, RETRANS_TIME));
4743 if (nla_put(skb, IFLA_INET6_CACHEINFO, sizeof(ci), &ci))
4744 goto nla_put_failure;
4745 nla = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32));
4746 if (!nla)
4747 goto nla_put_failure;
4748 ipv6_store_devconf(&idev->cnf, nla_data(nla), nla_len(nla));
4749
4750 /* XXX - MC not implemented */
4751
4734{
4735 struct nlattr *nla;
4736 struct ifla_cacheinfo ci;
4737
4738 if (nla_put_u32(skb, IFLA_INET6_FLAGS, idev->if_flags))
4739 goto nla_put_failure;
4740 ci.max_reasm_len = IPV6_MAXPLEN;
4741 ci.tstamp = cstamp_delta(idev->tstamp);
4742 ci.reachable_time = jiffies_to_msecs(idev->nd_parms->reachable_time);
4743 ci.retrans_time = jiffies_to_msecs(NEIGH_VAR(idev->nd_parms, RETRANS_TIME));
4744 if (nla_put(skb, IFLA_INET6_CACHEINFO, sizeof(ci), &ci))
4745 goto nla_put_failure;
4746 nla = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32));
4747 if (!nla)
4748 goto nla_put_failure;
4749 ipv6_store_devconf(&idev->cnf, nla_data(nla), nla_len(nla));
4750
4751 /* XXX - MC not implemented */
4752
4753 if (ext_filter_mask & RTEXT_FILTER_SKIP_STATS)
4754 return 0;
4755
4752 nla = nla_reserve(skb, IFLA_INET6_STATS, IPSTATS_MIB_MAX * sizeof(u64));
4753 if (!nla)
4754 goto nla_put_failure;
4755 snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla));
4756
4757 nla = nla_reserve(skb, IFLA_INET6_ICMP6STATS, ICMP6_MIB_MAX * sizeof(u64));
4758 if (!nla)
4759 goto nla_put_failure;

--- 19 unchanged lines hidden (view full) ---

4779static size_t inet6_get_link_af_size(const struct net_device *dev)
4780{
4781 if (!__in6_dev_get(dev))
4782 return 0;
4783
4784 return inet6_ifla6_size();
4785}
4786
4756 nla = nla_reserve(skb, IFLA_INET6_STATS, IPSTATS_MIB_MAX * sizeof(u64));
4757 if (!nla)
4758 goto nla_put_failure;
4759 snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla));
4760
4761 nla = nla_reserve(skb, IFLA_INET6_ICMP6STATS, ICMP6_MIB_MAX * sizeof(u64));
4762 if (!nla)
4763 goto nla_put_failure;

--- 19 unchanged lines hidden (view full) ---

4783static size_t inet6_get_link_af_size(const struct net_device *dev)
4784{
4785 if (!__in6_dev_get(dev))
4786 return 0;
4787
4788 return inet6_ifla6_size();
4789}
4790
4787static int inet6_fill_link_af(struct sk_buff *skb, const struct net_device *dev)
4791static int inet6_fill_link_af(struct sk_buff *skb, const struct net_device *dev,
4792 u32 ext_filter_mask)
4788{
4789 struct inet6_dev *idev = __in6_dev_get(dev);
4790
4791 if (!idev)
4792 return -ENODATA;
4793
4793{
4794 struct inet6_dev *idev = __in6_dev_get(dev);
4795
4796 if (!idev)
4797 return -ENODATA;
4798
4794 if (inet6_fill_ifla6_attrs(skb, idev) < 0)
4799 if (inet6_fill_ifla6_attrs(skb, idev, ext_filter_mask) < 0)
4795 return -EMSGSIZE;
4796
4797 return 0;
4798}
4799
4800static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
4801{
4802 struct inet6_ifaddr *ifp;

--- 138 unchanged lines hidden (view full) ---

4941 nla_put_u32(skb, IFLA_LINK, dev_get_iflink(dev))) ||
4942 nla_put_u8(skb, IFLA_OPERSTATE,
4943 netif_running(dev) ? dev->operstate : IF_OPER_DOWN))
4944 goto nla_put_failure;
4945 protoinfo = nla_nest_start(skb, IFLA_PROTINFO);
4946 if (!protoinfo)
4947 goto nla_put_failure;
4948
4800 return -EMSGSIZE;
4801
4802 return 0;
4803}
4804
4805static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
4806{
4807 struct inet6_ifaddr *ifp;

--- 138 unchanged lines hidden (view full) ---

4946 nla_put_u32(skb, IFLA_LINK, dev_get_iflink(dev))) ||
4947 nla_put_u8(skb, IFLA_OPERSTATE,
4948 netif_running(dev) ? dev->operstate : IF_OPER_DOWN))
4949 goto nla_put_failure;
4950 protoinfo = nla_nest_start(skb, IFLA_PROTINFO);
4951 if (!protoinfo)
4952 goto nla_put_failure;
4953
4949 if (inet6_fill_ifla6_attrs(skb, idev) < 0)
4954 if (inet6_fill_ifla6_attrs(skb, idev, 0) < 0)
4950 goto nla_put_failure;
4951
4952 nla_nest_end(skb, protoinfo);
4953 nlmsg_end(skb, nlh);
4954 return 0;
4955
4956nla_put_failure:
4957 nlmsg_cancel(skb, nlh);

--- 164 unchanged lines hidden (view full) ---

5122 if (ifp->idev->cnf.forwarding)
5123 addrconf_leave_anycast(ifp);
5124 addrconf_leave_solict(ifp->idev, &ifp->addr);
5125 if (!ipv6_addr_any(&ifp->peer_addr)) {
5126 struct rt6_info *rt;
5127
5128 rt = addrconf_get_prefix_route(&ifp->peer_addr, 128,
5129 ifp->idev->dev, 0, 0);
4955 goto nla_put_failure;
4956
4957 nla_nest_end(skb, protoinfo);
4958 nlmsg_end(skb, nlh);
4959 return 0;
4960
4961nla_put_failure:
4962 nlmsg_cancel(skb, nlh);

--- 164 unchanged lines hidden (view full) ---

5127 if (ifp->idev->cnf.forwarding)
5128 addrconf_leave_anycast(ifp);
5129 addrconf_leave_solict(ifp->idev, &ifp->addr);
5130 if (!ipv6_addr_any(&ifp->peer_addr)) {
5131 struct rt6_info *rt;
5132
5133 rt = addrconf_get_prefix_route(&ifp->peer_addr, 128,
5134 ifp->idev->dev, 0, 0);
5130 if (rt)
5131 ip6_del_rt(rt);
5135 if (rt && ip6_del_rt(rt))
5136 dst_free(&rt->dst);
5132 }
5133 dst_hold(&ifp->rt->dst);
5134
5137 }
5138 dst_hold(&ifp->rt->dst);
5139
5135 ip6_del_rt(ifp->rt);
5140 if (ip6_del_rt(ifp->rt))
5141 dst_free(&ifp->rt->dst);
5136
5137 rt_genid_bump_ipv6(net);
5138 break;
5139 }
5140 atomic_inc(&net->ipv6.dev_addr_genid);
5141}
5142
5143static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)

--- 845 unchanged lines hidden ---
5142
5143 rt_genid_bump_ipv6(net);
5144 break;
5145 }
5146 atomic_inc(&net->ipv6.dev_addr_genid);
5147}
5148
5149static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)

--- 845 unchanged lines hidden ---