]> Pileus Git - ~andy/linux/blobdiff - net/ipv6/addrconf.c
netconf: advertise mc_forwarding status
[~andy/linux] / net / ipv6 / addrconf.c
index e21bdb92565d771315f24700e1d858496edda1e2..28e0e627229c3fc28acc94a8f88998e5e49bdeb9 100644 (file)
@@ -469,6 +469,8 @@ static int inet6_netconf_msgsize_devconf(int type)
        /* type -1 is used for ALL */
        if (type == -1 || type == NETCONFA_FORWARDING)
                size += nla_total_size(4);
+       if (type == -1 || type == NETCONFA_MC_FORWARDING)
+               size += nla_total_size(4);
 
        return size;
 }
@@ -496,6 +498,10 @@ static int inet6_netconf_fill_devconf(struct sk_buff *skb, int ifindex,
        if ((type == -1 || type == NETCONFA_FORWARDING) &&
            nla_put_s32(skb, NETCONFA_FORWARDING, devconf->forwarding) < 0)
                goto nla_put_failure;
+       if ((type == -1 || type == NETCONFA_MC_FORWARDING) &&
+           nla_put_s32(skb, NETCONFA_MC_FORWARDING,
+                       devconf->mc_forwarding) < 0)
+               goto nla_put_failure;
 
        return nlmsg_end(skb, nlh);
 
@@ -504,8 +510,8 @@ nla_put_failure:
        return -EMSGSIZE;
 }
 
-static void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex,
-                                        struct ipv6_devconf *devconf)
+void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex,
+                                 struct ipv6_devconf *devconf)
 {
        struct sk_buff *skb;
        int err = -ENOBUFS;
@@ -2413,7 +2419,7 @@ int addrconf_add_ifaddr(struct net *net, void __user *arg)
        struct in6_ifreq ireq;
        int err;
 
-       if (!capable(CAP_NET_ADMIN))
+       if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
                return -EPERM;
 
        if (copy_from_user(&ireq, arg, sizeof(struct in6_ifreq)))
@@ -2432,7 +2438,7 @@ int addrconf_del_ifaddr(struct net *net, void __user *arg)
        struct in6_ifreq ireq;
        int err;
 
-       if (!capable(CAP_NET_ADMIN))
+       if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
                return -EPERM;
 
        if (copy_from_user(&ireq, arg, sizeof(struct in6_ifreq)))
@@ -2988,7 +2994,7 @@ static void addrconf_rs_timer(unsigned long data)
        if (idev->dead || !(idev->if_flags & IF_READY))
                goto out;
 
-       if (idev->cnf.forwarding)
+       if (!ipv6_accept_ra(idev))
                goto out;
 
        /* Announcement received after solicitation was sent */
@@ -3150,8 +3156,7 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
           router advertisements, start sending router solicitations.
         */
 
-       if (((ifp->idev->cnf.accept_ra == 1 && !ifp->idev->cnf.forwarding) ||
-            ifp->idev->cnf.accept_ra == 2) &&
+       if (ipv6_accept_ra(ifp->idev) &&
            ifp->idev->cnf.rtr_solicits > 0 &&
            (dev->flags&IFF_LOOPBACK) == 0 &&
            (ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL)) {
@@ -3514,9 +3519,6 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
        struct in6_addr *pfx;
        int err;
 
-       if (!capable(CAP_NET_ADMIN))
-               return -EPERM;
-
        err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv6_policy);
        if (err < 0)
                return err;
@@ -3587,9 +3589,6 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
        u8 ifa_flags;
        int err;
 
-       if (!capable(CAP_NET_ADMIN))
-               return -EPERM;
-
        err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv6_policy);
        if (err < 0)
                return err;
@@ -4741,10 +4740,6 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name,
                t->addrconf_vars[i].extra2 = net;
        }
 
-       /* Don't export sysctls to unprivileged users */
-       if (net->user_ns != &init_user_ns)
-               t->addrconf_vars[0].procname = NULL;
-
        snprintf(path, sizeof(path), "net/ipv6/conf/%s", dev_name);
 
        t->sysctl_header = register_net_sysctl(net, path, t->addrconf_vars);