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.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 2720899d516c..47a30c3188ea 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -131,7 +131,7 @@ static void addrconf_leave_anycast(struct inet6_ifaddr *ifp);
131 131
132static int addrconf_ifdown(struct net_device *dev, int how); 132static int addrconf_ifdown(struct net_device *dev, int how);
133 133
134static void addrconf_dad_start(struct inet6_ifaddr *ifp, int flags); 134static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags);
135static void addrconf_dad_timer(unsigned long data); 135static void addrconf_dad_timer(unsigned long data);
136static void addrconf_dad_completed(struct inet6_ifaddr *ifp); 136static void addrconf_dad_completed(struct inet6_ifaddr *ifp);
137static void addrconf_rs_timer(unsigned long data); 137static void addrconf_rs_timer(unsigned long data);
@@ -492,7 +492,7 @@ void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp)
492 492
493static struct inet6_ifaddr * 493static struct inet6_ifaddr *
494ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, 494ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
495 int scope, unsigned flags) 495 int scope, u32 flags)
496{ 496{
497 struct inet6_ifaddr *ifa = NULL; 497 struct inet6_ifaddr *ifa = NULL;
498 struct rt6_info *rt; 498 struct rt6_info *rt;
@@ -1320,7 +1320,7 @@ static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpad
1320 1320
1321static void 1321static void
1322addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev, 1322addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev,
1323 unsigned long expires, unsigned flags) 1323 unsigned long expires, u32 flags)
1324{ 1324{
1325 struct in6_rtmsg rtmsg; 1325 struct in6_rtmsg rtmsg;
1326 1326
@@ -2229,7 +2229,7 @@ out:
2229/* 2229/*
2230 * Duplicate Address Detection 2230 * Duplicate Address Detection
2231 */ 2231 */
2232static void addrconf_dad_start(struct inet6_ifaddr *ifp, int flags) 2232static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags)
2233{ 2233{
2234 struct inet6_dev *idev = ifp->idev; 2234 struct inet6_dev *idev = ifp->idev;
2235 struct net_device *dev = idev->dev; 2235 struct net_device *dev = idev->dev;
@@ -2622,15 +2622,14 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
2622} 2622}
2623 2623
2624static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, 2624static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
2625 u32 pid, u32 seq, int event) 2625 u32 pid, u32 seq, int event, unsigned int flags)
2626{ 2626{
2627 struct ifaddrmsg *ifm; 2627 struct ifaddrmsg *ifm;
2628 struct nlmsghdr *nlh; 2628 struct nlmsghdr *nlh;
2629 struct ifa_cacheinfo ci; 2629 struct ifa_cacheinfo ci;
2630 unsigned char *b = skb->tail; 2630 unsigned char *b = skb->tail;
2631 2631
2632 nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*ifm)); 2632 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*ifm), flags);
2633 if (pid) nlh->nlmsg_flags |= NLM_F_MULTI;
2634 ifm = NLMSG_DATA(nlh); 2633 ifm = NLMSG_DATA(nlh);
2635 ifm->ifa_family = AF_INET6; 2634 ifm->ifa_family = AF_INET6;
2636 ifm->ifa_prefixlen = ifa->prefix_len; 2635 ifm->ifa_prefixlen = ifa->prefix_len;
@@ -2672,15 +2671,14 @@ rtattr_failure:
2672} 2671}
2673 2672
2674static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca, 2673static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca,
2675 u32 pid, u32 seq, int event) 2674 u32 pid, u32 seq, int event, u16 flags)
2676{ 2675{
2677 struct ifaddrmsg *ifm; 2676 struct ifaddrmsg *ifm;
2678 struct nlmsghdr *nlh; 2677 struct nlmsghdr *nlh;
2679 struct ifa_cacheinfo ci; 2678 struct ifa_cacheinfo ci;
2680 unsigned char *b = skb->tail; 2679 unsigned char *b = skb->tail;
2681 2680
2682 nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*ifm)); 2681 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*ifm), flags);
2683 if (pid) nlh->nlmsg_flags |= NLM_F_MULTI;
2684 ifm = NLMSG_DATA(nlh); 2682 ifm = NLMSG_DATA(nlh);
2685 ifm->ifa_family = AF_INET6; 2683 ifm->ifa_family = AF_INET6;
2686 ifm->ifa_prefixlen = 128; 2684 ifm->ifa_prefixlen = 128;
@@ -2709,15 +2707,14 @@ rtattr_failure:
2709} 2707}
2710 2708
2711static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca, 2709static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca,
2712 u32 pid, u32 seq, int event) 2710 u32 pid, u32 seq, int event, unsigned int flags)
2713{ 2711{
2714 struct ifaddrmsg *ifm; 2712 struct ifaddrmsg *ifm;
2715 struct nlmsghdr *nlh; 2713 struct nlmsghdr *nlh;
2716 struct ifa_cacheinfo ci; 2714 struct ifa_cacheinfo ci;
2717 unsigned char *b = skb->tail; 2715 unsigned char *b = skb->tail;
2718 2716
2719 nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*ifm)); 2717 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*ifm), flags);
2720 if (pid) nlh->nlmsg_flags |= NLM_F_MULTI;
2721 ifm = NLMSG_DATA(nlh); 2718 ifm = NLMSG_DATA(nlh);
2722 ifm->ifa_family = AF_INET6; 2719 ifm->ifa_family = AF_INET6;
2723 ifm->ifa_prefixlen = 128; 2720 ifm->ifa_prefixlen = 128;
@@ -2786,7 +2783,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
2786 continue; 2783 continue;
2787 if ((err = inet6_fill_ifaddr(skb, ifa, 2784 if ((err = inet6_fill_ifaddr(skb, ifa,
2788 NETLINK_CB(cb->skb).pid, 2785 NETLINK_CB(cb->skb).pid,
2789 cb->nlh->nlmsg_seq, RTM_NEWADDR)) <= 0) 2786 cb->nlh->nlmsg_seq, RTM_NEWADDR,
2787 NLM_F_MULTI)) <= 0)
2790 goto done; 2788 goto done;
2791 } 2789 }
2792 /* temp addr */ 2790 /* temp addr */
@@ -2797,7 +2795,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
2797 continue; 2795 continue;
2798 if ((err = inet6_fill_ifaddr(skb, ifa, 2796 if ((err = inet6_fill_ifaddr(skb, ifa,
2799 NETLINK_CB(cb->skb).pid, 2797 NETLINK_CB(cb->skb).pid,
2800 cb->nlh->nlmsg_seq, RTM_NEWADDR)) <= 0) 2798 cb->nlh->nlmsg_seq, RTM_NEWADDR,
2799 NLM_F_MULTI)) <= 0)
2801 goto done; 2800 goto done;
2802 } 2801 }
2803#endif 2802#endif
@@ -2810,7 +2809,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
2810 continue; 2809 continue;
2811 if ((err = inet6_fill_ifmcaddr(skb, ifmca, 2810 if ((err = inet6_fill_ifmcaddr(skb, ifmca,
2812 NETLINK_CB(cb->skb).pid, 2811 NETLINK_CB(cb->skb).pid,
2813 cb->nlh->nlmsg_seq, RTM_GETMULTICAST)) <= 0) 2812 cb->nlh->nlmsg_seq, RTM_GETMULTICAST,
2813 NLM_F_MULTI)) <= 0)
2814 goto done; 2814 goto done;
2815 } 2815 }
2816 break; 2816 break;
@@ -2822,7 +2822,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
2822 continue; 2822 continue;
2823 if ((err = inet6_fill_ifacaddr(skb, ifaca, 2823 if ((err = inet6_fill_ifacaddr(skb, ifaca,
2824 NETLINK_CB(cb->skb).pid, 2824 NETLINK_CB(cb->skb).pid,
2825 cb->nlh->nlmsg_seq, RTM_GETANYCAST)) <= 0) 2825 cb->nlh->nlmsg_seq, RTM_GETANYCAST,
2826 NLM_F_MULTI)) <= 0)
2826 goto done; 2827 goto done;
2827 } 2828 }
2828 break; 2829 break;
@@ -2872,7 +2873,7 @@ static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
2872 netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, ENOBUFS); 2873 netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, ENOBUFS);
2873 return; 2874 return;
2874 } 2875 }
2875 if (inet6_fill_ifaddr(skb, ifa, 0, 0, event) < 0) { 2876 if (inet6_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) {
2876 kfree_skb(skb); 2877 kfree_skb(skb);
2877 netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, EINVAL); 2878 netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFADDR, EINVAL);
2878 return; 2879 return;
@@ -2907,7 +2908,7 @@ static void inline ipv6_store_devconf(struct ipv6_devconf *cnf,
2907} 2908}
2908 2909
2909static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, 2910static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
2910 u32 pid, u32 seq, int event) 2911 u32 pid, u32 seq, int event, unsigned int flags)
2911{ 2912{
2912 struct net_device *dev = idev->dev; 2913 struct net_device *dev = idev->dev;
2913 __s32 *array = NULL; 2914 __s32 *array = NULL;
@@ -2918,8 +2919,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
2918 __u32 mtu = dev->mtu; 2919 __u32 mtu = dev->mtu;
2919 struct ifla_cacheinfo ci; 2920 struct ifla_cacheinfo ci;
2920 2921
2921 nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*r)); 2922 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags);
2922 if (pid) nlh->nlmsg_flags |= NLM_F_MULTI;
2923 r = NLMSG_DATA(nlh); 2923 r = NLMSG_DATA(nlh);
2924 r->ifi_family = AF_INET6; 2924 r->ifi_family = AF_INET6;
2925 r->ifi_type = dev->type; 2925 r->ifi_type = dev->type;
@@ -2986,7 +2986,7 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
2986 if ((idev = in6_dev_get(dev)) == NULL) 2986 if ((idev = in6_dev_get(dev)) == NULL)
2987 continue; 2987 continue;
2988 err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid, 2988 err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid,
2989 cb->nlh->nlmsg_seq, RTM_NEWLINK); 2989 cb->nlh->nlmsg_seq, RTM_NEWLINK, NLM_F_MULTI);
2990 in6_dev_put(idev); 2990 in6_dev_put(idev);
2991 if (err <= 0) 2991 if (err <= 0)
2992 break; 2992 break;
@@ -3008,7 +3008,7 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
3008 netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, ENOBUFS); 3008 netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, ENOBUFS);
3009 return; 3009 return;
3010 } 3010 }
3011 if (inet6_fill_ifinfo(skb, idev, 0, 0, event) < 0) { 3011 if (inet6_fill_ifinfo(skb, idev, current->pid, 0, event, 0) < 0) {
3012 kfree_skb(skb); 3012 kfree_skb(skb);
3013 netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, EINVAL); 3013 netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFINFO, EINVAL);
3014 return; 3014 return;
@@ -3018,18 +3018,15 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
3018} 3018}
3019 3019
3020static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev, 3020static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
3021 struct prefix_info *pinfo, u32 pid, u32 seq, int event) 3021 struct prefix_info *pinfo, u32 pid, u32 seq,
3022 int event, unsigned int flags)
3022{ 3023{
3023 struct prefixmsg *pmsg; 3024 struct prefixmsg *pmsg;
3024 struct nlmsghdr *nlh; 3025 struct nlmsghdr *nlh;
3025 unsigned char *b = skb->tail; 3026 unsigned char *b = skb->tail;
3026 struct prefix_cacheinfo ci; 3027 struct prefix_cacheinfo ci;
3027 3028
3028 nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*pmsg)); 3029 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*pmsg), flags);
3029
3030 if (pid)
3031 nlh->nlmsg_flags |= NLM_F_MULTI;
3032
3033 pmsg = NLMSG_DATA(nlh); 3030 pmsg = NLMSG_DATA(nlh);
3034 pmsg->prefix_family = AF_INET6; 3031 pmsg->prefix_family = AF_INET6;
3035 pmsg->prefix_ifindex = idev->dev->ifindex; 3032 pmsg->prefix_ifindex = idev->dev->ifindex;
@@ -3068,7 +3065,7 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev,
3068 netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, ENOBUFS); 3065 netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, ENOBUFS);
3069 return; 3066 return;
3070 } 3067 }
3071 if (inet6_fill_prefix(skb, idev, pinfo, 0, 0, event) < 0) { 3068 if (inet6_fill_prefix(skb, idev, pinfo, current->pid, 0, event, 0) < 0) {
3072 kfree_skb(skb); 3069 kfree_skb(skb);
3073 netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, EINVAL); 3070 netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, EINVAL);
3074 return; 3071 return;