1 --- a/include/net/addrconf.h
2 +++ b/include/net/addrconf.h
3 @@ -88,6 +88,12 @@ int ipv6_rcv_saddr_equal(const struct so
4 void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr);
5 void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr);
7 +extern int (*ipv6_dev_get_saddr_hook)(struct net *net,
8 + const struct net_device *dev,
9 + const struct in6_addr *daddr,
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 @@ -45,6 +45,7 @@ obj-y += addrconf_core.o exthdrs_core.o
29 obj-$(CONFIG_INET) += output_core.o protocol.o $(ipv6-offload)
31 obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_hashtables.o
32 +obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_stubs.o
34 ifneq ($(CONFIG_IPV6),)
35 obj-$(CONFIG_NET_UDP_TUNNEL) += ip6_udp_tunnel.o
36 --- a/net/ipv6/addrconf.c
37 +++ b/net/ipv6/addrconf.c
38 @@ -1317,7 +1317,7 @@ out:
42 -int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
43 +static int __ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
44 const struct in6_addr *daddr, unsigned int prefs,
45 struct in6_addr *saddr)
47 @@ -1442,7 +1442,6 @@ try_nextdev:
48 in6_ifa_put(hiscore->ifa);
51 -EXPORT_SYMBOL(ipv6_dev_get_saddr);
53 int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr,
55 @@ -5434,6 +5433,9 @@ int __init addrconf_init(void)
57 ipv6_addr_label_rtnl_register();
59 + BUG_ON(ipv6_dev_get_saddr_hook != NULL);
60 + rcu_assign_pointer(ipv6_dev_get_saddr_hook, __ipv6_dev_get_saddr);
64 rtnl_af_unregister(&inet6_ops);
65 @@ -5453,6 +5455,9 @@ void addrconf_cleanup(void)
66 struct net_device *dev;
69 + rcu_assign_pointer(ipv6_dev_get_saddr_hook, NULL);
72 unregister_netdevice_notifier(&ipv6_dev_notf);
73 unregister_pernet_subsys(&addrconf_ops);
74 ipv6_addr_label_cleanup();
76 +++ b/net/ipv6/inet6_stubs.c
79 + * This program is free software; you can redistribute it and/or
80 + * modify it under the terms of the GNU General Public License
81 + * as published by the Free Software Foundation; either version
82 + * 2 of the License, or (at your option) any later version.
84 +#include <linux/export.h>
85 +#include <net/ipv6.h>
87 +int (*ipv6_dev_get_saddr_hook)(struct net *net, const struct net_device *dev,
88 + const struct in6_addr *daddr, unsigned int prefs,
89 + struct in6_addr *saddr);
91 +EXPORT_SYMBOL(ipv6_dev_get_saddr_hook);
93 +int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
94 + const struct in6_addr *daddr, unsigned int prefs,
95 + struct in6_addr *saddr)
97 + int ret = -EADDRNOTAVAIL;
98 + typeof(ipv6_dev_get_saddr_hook) dev_get_saddr;
101 + dev_get_saddr = rcu_dereference(ipv6_dev_get_saddr_hook);
104 + ret = dev_get_saddr(net, dst_dev, daddr, prefs, saddr);
109 +EXPORT_SYMBOL(ipv6_dev_get_saddr);