| David Ahern | 3616d08 | 2019-03-22 06:06:09 -0700 | [diff] [blame] | 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; |
| David Ahern | 1aefd3d | 2019-04-05 16:30:24 -0700 | [diff] [blame] | 15 | struct fib6_nh; |
| 16 | struct fib6_config; |
| David Ahern | b1d4099 | 2019-04-16 14:35:59 -0700 | [diff] [blame] | 17 | struct fib6_result; |
| David Ahern | 3616d08 | 2019-03-22 06:06:09 -0700 | [diff] [blame] | 18 | |
| 19 | /* This is ugly, ideally these symbols should be built |
| 20 | * into the core kernel. |
| 21 | */ |
| 22 | struct 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); |
| Sabrina Dubroca | 6c8991f | 2019-12-04 15:35:53 +0100 | [diff] [blame] | 27 | struct dst_entry *(*ipv6_dst_lookup_flow)(struct net *net, |
| 28 | const struct sock *sk, |
| 29 | struct flowi6 *fl6, |
| 30 | const struct in6_addr *final_dst); |
| David Ahern | 3616d08 | 2019-03-22 06:06:09 -0700 | [diff] [blame] | 31 | int (*ipv6_route_input)(struct sk_buff *skb); |
| 32 | |
| 33 | struct fib6_table *(*fib6_get_table)(struct net *net, u32 id); |
| David Ahern | effda4d | 2019-04-16 14:36:10 -0700 | [diff] [blame] | 34 | int (*fib6_lookup)(struct net *net, int oif, struct flowi6 *fl6, |
| 35 | struct fib6_result *res, int flags); |
| 36 | int (*fib6_table_lookup)(struct net *net, struct fib6_table *table, |
| 37 | int oif, struct flowi6 *fl6, |
| 38 | struct fib6_result *res, int flags); |
| David Ahern | b1d4099 | 2019-04-16 14:35:59 -0700 | [diff] [blame] | 39 | void (*fib6_select_path)(const struct net *net, struct fib6_result *res, |
| 40 | struct flowi6 *fl6, int oif, bool oif_match, |
| 41 | const struct sk_buff *skb, int strict); |
| David Ahern | b748f26 | 2019-04-16 14:36:06 -0700 | [diff] [blame] | 42 | u32 (*ip6_mtu_from_fib6)(const struct fib6_result *res, |
| 43 | const struct in6_addr *daddr, |
| 44 | const struct in6_addr *saddr); |
| David Ahern | 3616d08 | 2019-03-22 06:06:09 -0700 | [diff] [blame] | 45 | |
| David Ahern | 1aefd3d | 2019-04-05 16:30:24 -0700 | [diff] [blame] | 46 | int (*fib6_nh_init)(struct net *net, struct fib6_nh *fib6_nh, |
| 47 | struct fib6_config *cfg, gfp_t gfp_flags, |
| 48 | struct netlink_ext_ack *extack); |
| 49 | void (*fib6_nh_release)(struct fib6_nh *fib6_nh); |
| Nikolay Aleksandrov | 3c40584 | 2021-11-22 17:15:12 +0200 | [diff] [blame] | 50 | void (*fib6_nh_release_dsts)(struct fib6_nh *fib6_nh); |
| David Ahern | cdaa16a | 2019-05-22 12:04:40 -0700 | [diff] [blame] | 51 | void (*fib6_update_sernum)(struct net *net, struct fib6_info *rt); |
| Roopa Prabhu | 11dd74b | 2020-04-27 13:56:45 -0700 | [diff] [blame] | 52 | int (*ip6_del_rt)(struct net *net, struct fib6_info *rt, bool skip_notify); |
| David Ahern | 19a3b7e | 2019-05-22 12:04:41 -0700 | [diff] [blame] | 53 | void (*fib6_rt_update)(struct net *net, struct fib6_info *rt, |
| 54 | struct nl_info *info); |
| 55 | |
| David Ahern | 3616d08 | 2019-03-22 06:06:09 -0700 | [diff] [blame] | 56 | void (*udpv6_encap_enable)(void); |
| 57 | void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr, |
| 58 | const struct in6_addr *solicited_addr, |
| 59 | bool router, bool solicited, bool override, bool inc_opt); |
| Sabrina Dubroca | 0146dca | 2020-04-27 17:59:34 +0200 | [diff] [blame] | 60 | #if IS_ENABLED(CONFIG_XFRM) |
| Florian Westphal | 3e50ddd | 2020-05-04 10:06:06 +0200 | [diff] [blame] | 61 | void (*xfrm6_local_rxpmtu)(struct sk_buff *skb, u32 mtu); |
| Sabrina Dubroca | 0146dca | 2020-04-27 17:59:34 +0200 | [diff] [blame] | 62 | int (*xfrm6_udp_encap_rcv)(struct sock *sk, struct sk_buff *skb); |
| Sabrina Dubroca | 26333c3 | 2020-04-27 17:59:35 +0200 | [diff] [blame] | 63 | int (*xfrm6_rcv_encap)(struct sk_buff *skb, int nexthdr, __be32 spi, |
| 64 | int encap_type); |
| Sabrina Dubroca | 0146dca | 2020-04-27 17:59:34 +0200 | [diff] [blame] | 65 | #endif |
| David Ahern | 3616d08 | 2019-03-22 06:06:09 -0700 | [diff] [blame] | 66 | struct neigh_table *nd_tbl; |
| wenxu | 1d97898 | 2020-08-28 23:14:31 +0800 | [diff] [blame] | 67 | |
| 68 | int (*ipv6_fragment)(struct net *net, struct sock *sk, struct sk_buff *skb, |
| 69 | int (*output)(struct net *, struct sock *, struct sk_buff *)); |
| David Ahern | 3616d08 | 2019-03-22 06:06:09 -0700 | [diff] [blame] | 70 | }; |
| 71 | extern const struct ipv6_stub *ipv6_stub __read_mostly; |
| 72 | |
| 73 | /* A stub used by bpf helpers. Similarly ugly as ipv6_stub */ |
| 74 | struct ipv6_bpf_stub { |
| 75 | int (*inet6_bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len, |
| Stanislav Fomichev | cb0721c | 2020-05-08 10:46:10 -0700 | [diff] [blame] | 76 | u32 flags); |
| David Ahern | 3616d08 | 2019-03-22 06:06:09 -0700 | [diff] [blame] | 77 | struct sock *(*udp6_lib_lookup)(struct net *net, |
| 78 | const struct in6_addr *saddr, __be16 sport, |
| 79 | const struct in6_addr *daddr, __be16 dport, |
| 80 | int dif, int sdif, struct udp_table *tbl, |
| 81 | struct sk_buff *skb); |
| 82 | }; |
| 83 | extern const struct ipv6_bpf_stub *ipv6_bpf_stub __read_mostly; |
| 84 | |
| 85 | #endif |