18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _IPV6_STUBS_H 38c2ecf20Sopenharmony_ci#define _IPV6_STUBS_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/in6.h> 68c2ecf20Sopenharmony_ci#include <linux/netdevice.h> 78c2ecf20Sopenharmony_ci#include <linux/skbuff.h> 88c2ecf20Sopenharmony_ci#include <net/dst.h> 98c2ecf20Sopenharmony_ci#include <net/flow.h> 108c2ecf20Sopenharmony_ci#include <net/neighbour.h> 118c2ecf20Sopenharmony_ci#include <net/sock.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* structs from net/ip6_fib.h */ 148c2ecf20Sopenharmony_cistruct fib6_info; 158c2ecf20Sopenharmony_cistruct fib6_nh; 168c2ecf20Sopenharmony_cistruct fib6_config; 178c2ecf20Sopenharmony_cistruct fib6_result; 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci/* This is ugly, ideally these symbols should be built 208c2ecf20Sopenharmony_ci * into the core kernel. 218c2ecf20Sopenharmony_ci */ 228c2ecf20Sopenharmony_cistruct ipv6_stub { 238c2ecf20Sopenharmony_ci int (*ipv6_sock_mc_join)(struct sock *sk, int ifindex, 248c2ecf20Sopenharmony_ci const struct in6_addr *addr); 258c2ecf20Sopenharmony_ci int (*ipv6_sock_mc_drop)(struct sock *sk, int ifindex, 268c2ecf20Sopenharmony_ci const struct in6_addr *addr); 278c2ecf20Sopenharmony_ci struct dst_entry *(*ipv6_dst_lookup_flow)(struct net *net, 288c2ecf20Sopenharmony_ci const struct sock *sk, 298c2ecf20Sopenharmony_ci struct flowi6 *fl6, 308c2ecf20Sopenharmony_ci const struct in6_addr *final_dst); 318c2ecf20Sopenharmony_ci int (*ipv6_route_input)(struct sk_buff *skb); 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci struct fib6_table *(*fib6_get_table)(struct net *net, u32 id); 348c2ecf20Sopenharmony_ci int (*fib6_lookup)(struct net *net, int oif, struct flowi6 *fl6, 358c2ecf20Sopenharmony_ci struct fib6_result *res, int flags); 368c2ecf20Sopenharmony_ci int (*fib6_table_lookup)(struct net *net, struct fib6_table *table, 378c2ecf20Sopenharmony_ci int oif, struct flowi6 *fl6, 388c2ecf20Sopenharmony_ci struct fib6_result *res, int flags); 398c2ecf20Sopenharmony_ci void (*fib6_select_path)(const struct net *net, struct fib6_result *res, 408c2ecf20Sopenharmony_ci struct flowi6 *fl6, int oif, bool oif_match, 418c2ecf20Sopenharmony_ci const struct sk_buff *skb, int strict); 428c2ecf20Sopenharmony_ci u32 (*ip6_mtu_from_fib6)(const struct fib6_result *res, 438c2ecf20Sopenharmony_ci const struct in6_addr *daddr, 448c2ecf20Sopenharmony_ci const struct in6_addr *saddr); 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci int (*fib6_nh_init)(struct net *net, struct fib6_nh *fib6_nh, 478c2ecf20Sopenharmony_ci struct fib6_config *cfg, gfp_t gfp_flags, 488c2ecf20Sopenharmony_ci struct netlink_ext_ack *extack); 498c2ecf20Sopenharmony_ci void (*fib6_nh_release)(struct fib6_nh *fib6_nh); 508c2ecf20Sopenharmony_ci void (*fib6_nh_release_dsts)(struct fib6_nh *fib6_nh); 518c2ecf20Sopenharmony_ci void (*fib6_update_sernum)(struct net *net, struct fib6_info *rt); 528c2ecf20Sopenharmony_ci int (*ip6_del_rt)(struct net *net, struct fib6_info *rt, bool skip_notify); 538c2ecf20Sopenharmony_ci void (*fib6_rt_update)(struct net *net, struct fib6_info *rt, 548c2ecf20Sopenharmony_ci struct nl_info *info); 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci void (*udpv6_encap_enable)(void); 578c2ecf20Sopenharmony_ci void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr, 588c2ecf20Sopenharmony_ci const struct in6_addr *solicited_addr, 598c2ecf20Sopenharmony_ci bool router, bool solicited, bool override, bool inc_opt); 608c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_XFRM) 618c2ecf20Sopenharmony_ci void (*xfrm6_local_rxpmtu)(struct sk_buff *skb, u32 mtu); 628c2ecf20Sopenharmony_ci int (*xfrm6_udp_encap_rcv)(struct sock *sk, struct sk_buff *skb); 638c2ecf20Sopenharmony_ci int (*xfrm6_rcv_encap)(struct sk_buff *skb, int nexthdr, __be32 spi, 648c2ecf20Sopenharmony_ci int encap_type); 658c2ecf20Sopenharmony_ci#endif 668c2ecf20Sopenharmony_ci struct neigh_table *nd_tbl; 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci int (*ipv6_fragment)(struct net *net, struct sock *sk, struct sk_buff *skb, 698c2ecf20Sopenharmony_ci int (*output)(struct net *, struct sock *, struct sk_buff *)); 708c2ecf20Sopenharmony_ci}; 718c2ecf20Sopenharmony_ciextern const struct ipv6_stub *ipv6_stub __read_mostly; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci/* A stub used by bpf helpers. Similarly ugly as ipv6_stub */ 748c2ecf20Sopenharmony_cistruct ipv6_bpf_stub { 758c2ecf20Sopenharmony_ci int (*inet6_bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len, 768c2ecf20Sopenharmony_ci u32 flags); 778c2ecf20Sopenharmony_ci struct sock *(*udp6_lib_lookup)(struct net *net, 788c2ecf20Sopenharmony_ci const struct in6_addr *saddr, __be16 sport, 798c2ecf20Sopenharmony_ci const struct in6_addr *daddr, __be16 dport, 808c2ecf20Sopenharmony_ci int dif, int sdif, struct udp_table *tbl, 818c2ecf20Sopenharmony_ci struct sk_buff *skb); 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ciextern const struct ipv6_bpf_stub *ipv6_bpf_stub __read_mostly; 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#endif 86