]> err.no Git - linux-2.6/blobdiff - net/ipv6/addrconf.c
[IPV6]: Sparse: Reuse previous delaration where appropriate.
[linux-2.6] / net / ipv6 / addrconf.c
index 87f688857adea7bf5f4ee78725eebfc90df83531..924158393d048f89c6168b7c505ce0719bbbdbd7 100644 (file)
@@ -412,7 +412,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
        return ndev;
 }
 
-static struct inet6_dev * ipv6_find_idev(struct net_device *dev)
+struct inet6_dev * ipv6_find_idev(struct net_device *dev)
 {
        struct inet6_dev *idev;
 
@@ -1265,6 +1265,31 @@ int ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
        return ifp != NULL;
 }
 
+int ipv6_chk_prefix(struct in6_addr *addr, struct net_device *dev)
+{
+       struct inet6_dev *idev;
+       struct inet6_ifaddr *ifa;
+       int     onlink;
+
+       onlink = 0;
+       rcu_read_lock();
+       idev = __in6_dev_get(dev);
+       if (idev) {
+               read_lock_bh(&idev->lock);
+               for (ifa = idev->addr_list; ifa; ifa = ifa->if_next) {
+                       onlink = ipv6_prefix_equal(addr, &ifa->addr,
+                                                  ifa->prefix_len);
+                       if (onlink)
+                               break;
+               }
+               read_unlock_bh(&idev->lock);
+       }
+       rcu_read_unlock();
+       return onlink;
+}
+
+EXPORT_SYMBOL(ipv6_chk_prefix);
+
 struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, struct in6_addr *addr,
                                     struct net_device *dev, int strict)
 {
@@ -3547,6 +3572,9 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
 #ifdef CONFIG_IPV6_OPTIMISTIC_DAD
        array[DEVCONF_OPTIMISTIC_DAD] = cnf->optimistic_dad;
 #endif
+#ifdef CONFIG_IPV6_MROUTE
+       array[DEVCONF_MC_FORWARDING] = cnf->mc_forwarding;
+#endif
 }
 
 static inline size_t inet6_if_nlmsg_size(void)
@@ -3877,7 +3905,7 @@ static int addrconf_sysctl_forward_strategy(ctl_table *table,
 static struct addrconf_sysctl_table
 {
        struct ctl_table_header *sysctl_header;
-       ctl_table addrconf_vars[__NET_IPV6_MAX];
+       ctl_table addrconf_vars[DEVCONF_MAX+1];
        char *dev_name;
 } addrconf_sysctl __read_mostly = {
        .sysctl_header = NULL,
@@ -4094,6 +4122,16 @@ static struct addrconf_sysctl_table
                        .proc_handler   =       &proc_dointvec,
 
                },
+#endif
+#ifdef CONFIG_IPV6_MROUTE
+               {
+                       .ctl_name       =       CTL_UNNUMBERED,
+                       .procname       =       "mc_forwarding",
+                       .data           =       &ipv6_devconf.mc_forwarding,
+                       .maxlen         =       sizeof(int),
+                       .mode           =       0644,
+                       .proc_handler   =       &proc_dointvec,
+               },
 #endif
                {
                        .ctl_name       =       0,      /* sentinel */