9203e017424dc5f6d54f15b30e42eb86031f47f3
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-3.2 / 643-bridge_remove_ipv6_dependency.patch
1 --- a/include/net/addrconf.h
2 +++ b/include/net/addrconf.h
3 @@ -91,6 +91,12 @@ extern void addrconf_join_solict(struc
4 extern void addrconf_leave_solict(struct inet6_dev *idev,
5 const struct in6_addr *addr);
6
7 +extern int (*ipv6_dev_get_saddr_hook)(struct net *net,
8 + struct net_device *dev,
9 + const struct in6_addr *daddr,
10 + unsigned int srcprefs,
11 + struct in6_addr *saddr);
12 +
13 static inline unsigned long addrconf_timeout_fixup(u32 timeout,
14 unsigned unit)
15 {
16 --- a/net/bridge/Kconfig
17 +++ b/net/bridge/Kconfig
18 @@ -6,7 +6,6 @@ config BRIDGE
19 tristate "802.1d Ethernet Bridging"
20 select LLC
21 select STP
22 - depends on IPV6 || IPV6=n
23 ---help---
24 If you say Y here, then your Linux box will be able to act as an
25 Ethernet bridge, which means that the different Ethernet segments it
26 --- a/net/ipv6/Makefile
27 +++ b/net/ipv6/Makefile
28 @@ -40,3 +40,4 @@ obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.
29 obj-y += addrconf_core.o exthdrs_core.o
30
31 obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_hashtables.o
32 +obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_stubs.o
33 --- a/net/ipv6/addrconf.c
34 +++ b/net/ipv6/addrconf.c
35 @@ -1107,7 +1107,7 @@ out:
36 return ret;
37 }
38
39 -int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
40 +static int __ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
41 const struct in6_addr *daddr, unsigned int prefs,
42 struct in6_addr *saddr)
43 {
44 @@ -1232,7 +1232,6 @@ try_nextdev:
45 in6_ifa_put(hiscore->ifa);
46 return 0;
47 }
48 -EXPORT_SYMBOL(ipv6_dev_get_saddr);
49
50 int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,
51 unsigned char banned_flags)
52 @@ -4814,6 +4813,9 @@ int __init addrconf_init(void)
53
54 ipv6_addr_label_rtnl_register();
55
56 + BUG_ON(ipv6_dev_get_saddr_hook != NULL);
57 + rcu_assign_pointer(ipv6_dev_get_saddr_hook, __ipv6_dev_get_saddr);
58 +
59 return 0;
60 errout:
61 rtnl_af_unregister(&inet6_ops);
62 @@ -4832,6 +4834,9 @@ void addrconf_cleanup(void)
63 struct net_device *dev;
64 int i;
65
66 + rcu_assign_pointer(ipv6_dev_get_saddr_hook, NULL);
67 + synchronize_rcu();
68 +
69 unregister_netdevice_notifier(&ipv6_dev_notf);
70 unregister_pernet_subsys(&addrconf_ops);
71 ipv6_addr_label_cleanup();
72 --- /dev/null
73 +++ b/net/ipv6/inet6_stubs.c
74 @@ -0,0 +1,33 @@
75 +/*
76 + * This program is free software; you can redistribute it and/or
77 + * modify it under the terms of the GNU General Public License
78 + * as published by the Free Software Foundation; either version
79 + * 2 of the License, or (at your option) any later version.
80 + */
81 +#include <linux/export.h>
82 +#include <net/ipv6.h>
83 +
84 +int (*ipv6_dev_get_saddr_hook)(struct net *net, struct net_device *dev,
85 + const struct in6_addr *daddr, unsigned int srcprefs,
86 + struct in6_addr *saddr);
87 +
88 +EXPORT_SYMBOL(ipv6_dev_get_saddr_hook);
89 +
90 +int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
91 + const struct in6_addr *daddr, unsigned int prefs,
92 + struct in6_addr *saddr)
93 +{
94 + int ret = -EADDRNOTAVAIL;
95 + typeof(ipv6_dev_get_saddr_hook) dev_get_saddr;
96 +
97 + rcu_read_lock();
98 + dev_get_saddr = rcu_dereference(ipv6_dev_get_saddr_hook);
99 +
100 + if (dev_get_saddr)
101 + ret = dev_get_saddr(net, dst_dev, daddr, prefs, saddr);
102 +
103 + rcu_read_unlock();
104 + return ret;
105 +}
106 +EXPORT_SYMBOL(ipv6_dev_get_saddr);
107 +