[PATCH] generic: Remove IPv6 depependency of bridge in 2.6.38+
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-2.6.39 / 643-bridge_remove_ipv6_dependency.patch
1 --- a/include/net/addrconf.h
2 +++ b/include/net/addrconf.h
3 @@ -93,6 +93,12 @@ extern void addrconf_join_solict(struc
4 extern void addrconf_leave_solict(struct inet6_dev *idev,
5 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 @@ -1116,7 +1116,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 @@ -1241,7 +1241,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 @@ -4715,6 +4714,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 @@ -4733,6 +4735,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,27 @@
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 <net/ipv6.h>
82 +
83 +int (*ipv6_dev_get_saddr_hook)(struct net *net, struct net_device *dev,
84 + const struct in6_addr *daddr, unsigned int srcprefs,
85 + struct in6_addr *saddr);
86 +
87 +EXPORT_SYMBOL(ipv6_dev_get_saddr_hook);
88 +
89 +int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
90 + const struct in6_addr *daddr, unsigned int prefs,
91 + struct in6_addr *saddr)
92 +{
93 + typeof(ipv6_dev_get_saddr_hook) dev_get_saddr = rcu_dereference(ipv6_dev_get_saddr_hook);
94 +
95 + if (dev_get_saddr)
96 + return dev_get_saddr(net, dst_dev, daddr, prefs, saddr);
97 +
98 + return -EADDRNOTAVAIL;
99 +}
100 +EXPORT_SYMBOL(ipv6_dev_get_saddr);
101 +