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