Skip to content

Commit 5f81bd2

Browse files
Cong Wangdavem330
authored andcommitted
ipv6: export a stub for IPv6 symbols used by vxlan
In case IPv6 is compiled as a module, introduce a stub for ipv6_sock_mc_join and ipv6_sock_mc_drop etc.. It will be used by vxlan module. Suggested by Ben. This is an ugly but easy solution for now. Cc: Ben Hutchings <bhutchings@solarflare.com> Cc: Stephen Hemminger <stephen@networkplumber.org> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 788787b commit 5f81bd2

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎include/net/addrconf.h‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,21 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group,
141141
const struct in6_addr *src_addr);
142142

143143
void ipv6_mc_dad_complete(struct inet6_dev *idev);
144+
145+
/* A stub used by vxlan module. This is ugly, ideally these
146+
* symbols should be built into the core kernel.
147+
*/
148+
struct ipv6_stub {
149+
int (*ipv6_sock_mc_join)(struct sock *sk, int ifindex,
150+
const struct in6_addr *addr);
151+
int (*ipv6_sock_mc_drop)(struct sock *sk, int ifindex,
152+
const struct in6_addr *addr);
153+
int (*ipv6_dst_lookup)(struct sock *sk, struct dst_entry **dst,
154+
struct flowi6 *fl6);
155+
void (*udpv6_encap_enable)(void);
156+
};
157+
extern const struct ipv6_stub *ipv6_stub __read_mostly;
158+
144159
/*
145160
* identify MLD packets for MLD filter exceptions
146161
*/

‎net/ipv6/addrconf_core.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,6 @@ int inet6addr_notifier_call_chain(unsigned long val, void *v)
9898
return atomic_notifier_call_chain(&inet6addr_chain, val, v);
9999
}
100100
EXPORT_SYMBOL(inet6addr_notifier_call_chain);
101+
102+
const struct ipv6_stub *ipv6_stub __read_mostly;
103+
EXPORT_SYMBOL_GPL(ipv6_stub);

‎net/ipv6/af_inet6.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,13 @@ static struct pernet_operations inet6_net_ops = {
810810
.exit = inet6_net_exit,
811811
};
812812

813+
static const struct ipv6_stub ipv6_stub_impl = {
814+
.ipv6_sock_mc_join = ipv6_sock_mc_join,
815+
.ipv6_sock_mc_drop = ipv6_sock_mc_drop,
816+
.ipv6_dst_lookup = ip6_dst_lookup,
817+
.udpv6_encap_enable = udpv6_encap_enable,
818+
};
819+
813820
static int __init inet6_init(void)
814821
{
815822
struct list_head *r;
@@ -884,6 +891,9 @@ static int __init inet6_init(void)
884891
err = igmp6_init();
885892
if (err)
886893
goto igmp_fail;
894+
895+
ipv6_stub = &ipv6_stub_impl;
896+
887897
err = ipv6_netfilter_init();
888898
if (err)
889899
goto netfilter_fail;
@@ -1040,6 +1050,7 @@ static void __exit inet6_exit(void)
10401050
raw6_proc_exit();
10411051
#endif
10421052
ipv6_netfilter_fini();
1053+
ipv6_stub = NULL;
10431054
igmp6_cleanup();
10441055
ndisc_cleanup();
10451056
ip6_mr_cleanup();

0 commit comments

Comments
 (0)