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 64