blob: 5c93e942c50b2c69c0a443fbbbc62b4df2594cf7 [file] [log] [blame]
David Ahern3616d082019-03-22 06:06:09 -07001/* 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 */
14struct fib6_info;
David Ahern1aefd3d2019-04-05 16:30:24 -070015struct fib6_nh;
16struct fib6_config;
David Ahernb1d40992019-04-16 14:35:59 -070017struct fib6_result;
David Ahern3616d082019-03-22 06:06:09 -070018
19/* This is ugly, ideally these symbols should be built
20 * into the core kernel.
21 */
22struct ipv6_stub {
23 int (*ipv6_sock_mc_join)(struct sock *sk, int ifindex,
24 const struct in6_addr *addr);
25 int (*ipv6_sock_mc_drop)(struct sock *sk, int ifindex,
26 const struct in6_addr *addr);
27 int (*ipv6_dst_lookup)(struct net *net, struct sock *sk,
28 struct dst_entry **dst, struct flowi6 *fl6);
29 int (*ipv6_route_input)(struct sk_buff *skb);
30
31 struct fib6_table *(*fib6_get_table)(struct net *net, u32 id);
David Aherneffda4d2019-04-16 14:36:10 -070032 int (*fib6_lookup)(struct net *net, int oif, struct flowi6 *fl6,
33 struct fib6_result *res, int flags);
34 int (*fib6_table_lookup)(struct net *net, struct fib6_table *table,
35 int oif, struct flowi6 *fl6,
36 struct fib6_result *res, int flags);
David Ahernb1d40992019-04-16 14:35:59 -070037 void (*fib6_select_path)(const struct net *net, struct fib6_result *res,
38 struct flowi6 *fl6, int oif, bool oif_match,
39 const struct sk_buff *skb, int strict);
David Ahernb748f262019-04-16 14:36:06 -070040 u32 (*ip6_mtu_from_fib6)(const struct fib6_result *res,
41 const struct in6_addr *daddr,
42 const struct in6_addr *saddr);
David Ahern3616d082019-03-22 06:06:09 -070043
David Ahern1aefd3d2019-04-05 16:30:24 -070044 int (*fib6_nh_init)(struct net *net, struct fib6_nh *fib6_nh,
45 struct fib6_config *cfg, gfp_t gfp_flags,
46 struct netlink_ext_ack *extack);
47 void (*fib6_nh_release)(struct fib6_nh *fib6_nh);
David Aherncdaa16a2019-05-22 12:04:40 -070048 void (*fib6_update_sernum)(struct net *net, struct fib6_info *rt);
David Ahern68a9b132019-05-22 12:04:39 -070049 int (*ip6_del_rt)(struct net *net, struct fib6_info *rt);
David Ahern19a3b7e2019-05-22 12:04:41 -070050 void (*fib6_rt_update)(struct net *net, struct fib6_info *rt,
51 struct nl_info *info);
52
David Ahern3616d082019-03-22 06:06:09 -070053 void (*udpv6_encap_enable)(void);
54 void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr,
55 const struct in6_addr *solicited_addr,
56 bool router, bool solicited, bool override, bool inc_opt);
57 struct neigh_table *nd_tbl;
58};
59extern const struct ipv6_stub *ipv6_stub __read_mostly;
60
61/* A stub used by bpf helpers. Similarly ugly as ipv6_stub */
62struct ipv6_bpf_stub {
63 int (*inet6_bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len,
64 bool force_bind_address_no_port, bool with_lock);
65 struct sock *(*udp6_lib_lookup)(struct net *net,
66 const struct in6_addr *saddr, __be16 sport,
67 const struct in6_addr *daddr, __be16 dport,
68 int dif, int sdif, struct udp_table *tbl,
69 struct sk_buff *skb);
70};
71extern const struct ipv6_bpf_stub *ipv6_bpf_stub __read_mostly;
72
73#endif