Skip to content

Commit 3616d08

Browse files
dsaherndavem330
authored andcommitted
ipv6: Move ipv6 stubs to a separate header file
The number of stubs is growing and has nothing to do with addrconf. Move the definition of the stubs to a separate header file and update users. In the move, drop the vxlan specific comment before ipv6_stub. Code move only; no functional change intended. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5f4d674 commit 3616d08

15 files changed

Lines changed: 76 additions & 52 deletions

File tree

‎drivers/infiniband/core/addr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#include <net/neighbour.h>
4343
#include <net/route.h>
4444
#include <net/netevent.h>
45-
#include <net/addrconf.h>
45+
#include <net/ipv6_stubs.h>
4646
#include <net/ip6_route.h>
4747
#include <rdma/ib_addr.h>
4848
#include <rdma/ib_sa.h>

‎drivers/net/ethernet/mellanox/mlx5/core/en_tc.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include <net/tc_act/tc_pedit.h>
4545
#include <net/tc_act/tc_csum.h>
4646
#include <net/arp.h>
47+
#include <net/ipv6_stubs.h>
4748
#include "en.h"
4849
#include "en_rep.h"
4950
#include "en_tc.h"

‎drivers/net/geneve.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/module.h>
1515
#include <linux/etherdevice.h>
1616
#include <linux/hash.h>
17+
#include <net/ipv6_stubs.h>
1718
#include <net/dst_metadata.h>
1819
#include <net/gro_cells.h>
1920
#include <net/rtnetlink.h>

‎drivers/net/usb/cdc_mbim.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/usb/cdc_ncm.h>
2424
#include <net/ipv6.h>
2525
#include <net/addrconf.h>
26+
#include <net/ipv6_stubs.h>
2627

2728
/* alternative VLAN for IP session 0 if not untagged */
2829
#define MBIM_IPS0_VID 4094

‎drivers/net/vxlan.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/ethtool.h>
2121
#include <net/arp.h>
2222
#include <net/ndisc.h>
23+
#include <net/ipv6_stubs.h>
2324
#include <net/ip.h>
2425
#include <net/icmp.h>
2526
#include <net/rtnetlink.h>

‎include/net/addrconf.h‎

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -238,53 +238,6 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group,
238238

239239
void ipv6_mc_dad_complete(struct inet6_dev *idev);
240240

241-
/* A stub used by vxlan module. This is ugly, ideally these
242-
* symbols should be built into the core kernel.
243-
*/
244-
struct ipv6_stub {
245-
int (*ipv6_sock_mc_join)(struct sock *sk, int ifindex,
246-
const struct in6_addr *addr);
247-
int (*ipv6_sock_mc_drop)(struct sock *sk, int ifindex,
248-
const struct in6_addr *addr);
249-
int (*ipv6_dst_lookup)(struct net *net, struct sock *sk,
250-
struct dst_entry **dst, struct flowi6 *fl6);
251-
int (*ipv6_route_input)(struct sk_buff *skb);
252-
253-
struct fib6_table *(*fib6_get_table)(struct net *net, u32 id);
254-
struct fib6_info *(*fib6_lookup)(struct net *net, int oif,
255-
struct flowi6 *fl6, int flags);
256-
struct fib6_info *(*fib6_table_lookup)(struct net *net,
257-
struct fib6_table *table,
258-
int oif, struct flowi6 *fl6,
259-
int flags);
260-
struct fib6_info *(*fib6_multipath_select)(const struct net *net,
261-
struct fib6_info *f6i,
262-
struct flowi6 *fl6, int oif,
263-
const struct sk_buff *skb,
264-
int strict);
265-
u32 (*ip6_mtu_from_fib6)(struct fib6_info *f6i, struct in6_addr *daddr,
266-
struct in6_addr *saddr);
267-
268-
void (*udpv6_encap_enable)(void);
269-
void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr,
270-
const struct in6_addr *solicited_addr,
271-
bool router, bool solicited, bool override, bool inc_opt);
272-
struct neigh_table *nd_tbl;
273-
};
274-
extern const struct ipv6_stub *ipv6_stub __read_mostly;
275-
276-
/* A stub used by bpf helpers. Similarly ugly as ipv6_stub */
277-
struct ipv6_bpf_stub {
278-
int (*inet6_bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len,
279-
bool force_bind_address_no_port, bool with_lock);
280-
struct sock *(*udp6_lib_lookup)(struct net *net,
281-
const struct in6_addr *saddr, __be16 sport,
282-
const struct in6_addr *daddr, __be16 dport,
283-
int dif, int sdif, struct udp_table *tbl,
284-
struct sk_buff *skb);
285-
};
286-
extern const struct ipv6_bpf_stub *ipv6_bpf_stub __read_mostly;
287-
288241
/*
289242
* identify MLD packets for MLD filter exceptions
290243
*/

‎include/net/ipv6_stubs.h‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _IPV6_STUBS_H
3+
#define _IPV6_STUBS_H
4+
5+
#include <linux/in6.h>
6+
#include <linux/netdevice.h>
7+
#include <linux/skbuff.h>
8+
#include <net/dst.h>
9+
#include <net/flow.h>
10+
#include <net/neighbour.h>
11+
#include <net/sock.h>
12+
13+
/* structs from net/ip6_fib.h */
14+
struct fib6_info;
15+
16+
/* This is ugly, ideally these symbols should be built
17+
* into the core kernel.
18+
*/
19+
struct ipv6_stub {
20+
int (*ipv6_sock_mc_join)(struct sock *sk, int ifindex,
21+
const struct in6_addr *addr);
22+
int (*ipv6_sock_mc_drop)(struct sock *sk, int ifindex,
23+
const struct in6_addr *addr);
24+
int (*ipv6_dst_lookup)(struct net *net, struct sock *sk,
25+
struct dst_entry **dst, struct flowi6 *fl6);
26+
int (*ipv6_route_input)(struct sk_buff *skb);
27+
28+
struct fib6_table *(*fib6_get_table)(struct net *net, u32 id);
29+
struct fib6_info *(*fib6_lookup)(struct net *net, int oif,
30+
struct flowi6 *fl6, int flags);
31+
struct fib6_info *(*fib6_table_lookup)(struct net *net,
32+
struct fib6_table *table,
33+
int oif, struct flowi6 *fl6,
34+
int flags);
35+
struct fib6_info *(*fib6_multipath_select)(const struct net *net,
36+
struct fib6_info *f6i,
37+
struct flowi6 *fl6, int oif,
38+
const struct sk_buff *skb,
39+
int strict);
40+
u32 (*ip6_mtu_from_fib6)(struct fib6_info *f6i, struct in6_addr *daddr,
41+
struct in6_addr *saddr);
42+
43+
void (*udpv6_encap_enable)(void);
44+
void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr,
45+
const struct in6_addr *solicited_addr,
46+
bool router, bool solicited, bool override, bool inc_opt);
47+
struct neigh_table *nd_tbl;
48+
};
49+
extern const struct ipv6_stub *ipv6_stub __read_mostly;
50+
51+
/* A stub used by bpf helpers. Similarly ugly as ipv6_stub */
52+
struct ipv6_bpf_stub {
53+
int (*inet6_bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len,
54+
bool force_bind_address_no_port, bool with_lock);
55+
struct sock *(*udp6_lib_lookup)(struct net *net,
56+
const struct in6_addr *saddr, __be16 sport,
57+
const struct in6_addr *daddr, __be16 dport,
58+
int dif, int sdif, struct udp_table *tbl,
59+
struct sk_buff *skb);
60+
};
61+
extern const struct ipv6_bpf_stub *ipv6_bpf_stub __read_mostly;
62+
63+
#endif

‎include/net/udp_tunnel.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#if IS_ENABLED(CONFIG_IPV6)
99
#include <net/ipv6.h>
10-
#include <net/addrconf.h>
10+
#include <net/ipv6_stubs.h>
1111
#endif
1212

1313
struct udp_port_cfg {

‎net/bridge/br_arp_nd_proxy.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/if_vlan.h>
2222
#include <linux/inetdevice.h>
2323
#include <net/addrconf.h>
24+
#include <net/ipv6_stubs.h>
2425
#if IS_ENABLED(CONFIG_IPV6)
2526
#include <net/ip6_checksum.h>
2627
#endif

‎net/core/filter.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include <net/seg6.h>
7575
#include <net/seg6_local.h>
7676
#include <net/lwtunnel.h>
77+
#include <net/ipv6_stubs.h>
7778

7879
/**
7980
* sk_filter_trim_cap - run a packet through a socket filter

0 commit comments

Comments
 (0)