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);
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);
13 static inline unsigned long addrconf_timeout_fixup(u32 timeout,
16 --- a/net/bridge/Kconfig
17 +++ b/net/bridge/Kconfig
18 @@ -6,7 +6,6 @@ config BRIDGE
19 tristate "802.1d Ethernet Bridging"
22 - depends on IPV6 || IPV6=n
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
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 @@ -1111,7 +1111,7 @@ out:
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)
44 @@ -1236,7 +1236,6 @@ try_nextdev:
45 in6_ifa_put(hiscore->ifa);
48 -EXPORT_SYMBOL(ipv6_dev_get_saddr);
50 int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,
51 unsigned char banned_flags)
52 @@ -4818,6 +4817,9 @@ int __init addrconf_init(void)
54 ipv6_addr_label_rtnl_register();
56 + BUG_ON(ipv6_dev_get_saddr_hook != NULL);
57 + rcu_assign_pointer(ipv6_dev_get_saddr_hook, __ipv6_dev_get_saddr);
61 rtnl_af_unregister(&inet6_ops);
62 @@ -4836,6 +4838,9 @@ void addrconf_cleanup(void)
63 struct net_device *dev;
66 + rcu_assign_pointer(ipv6_dev_get_saddr_hook, NULL);
69 unregister_netdevice_notifier(&ipv6_dev_notf);
70 unregister_pernet_subsys(&addrconf_ops);
71 ipv6_addr_label_cleanup();
73 +++ b/net/ipv6/inet6_stubs.c
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.
81 +#include <linux/export.h>
82 +#include <net/ipv6.h>
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);
88 +EXPORT_SYMBOL(ipv6_dev_get_saddr_hook);
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)
94 + int ret = -EADDRNOTAVAIL;
95 + typeof(ipv6_dev_get_saddr_hook) dev_get_saddr;
98 + dev_get_saddr = rcu_dereference(ipv6_dev_get_saddr_hook);
101 + ret = dev_get_saddr(net, dst_dev, daddr, prefs, saddr);
106 +EXPORT_SYMBOL(ipv6_dev_get_saddr);