^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _IPV6_STUBS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _IPV6_STUBS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/in6.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/skbuff.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <net/dst.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <net/flow.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <net/neighbour.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <net/sock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /* structs from net/ip6_fib.h */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct fib6_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct fib6_nh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct fib6_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct fib6_result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /* This is ugly, ideally these symbols should be built
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * into the core kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct ipv6_stub {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int (*ipv6_sock_mc_join)(struct sock *sk, int ifindex,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) const struct in6_addr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) int (*ipv6_sock_mc_drop)(struct sock *sk, int ifindex,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) const struct in6_addr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct dst_entry *(*ipv6_dst_lookup_flow)(struct net *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) const struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct flowi6 *fl6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) const struct in6_addr *final_dst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) int (*ipv6_route_input)(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct fib6_table *(*fib6_get_table)(struct net *net, u32 id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int (*fib6_lookup)(struct net *net, int oif, struct flowi6 *fl6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct fib6_result *res, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int (*fib6_table_lookup)(struct net *net, struct fib6_table *table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) int oif, struct flowi6 *fl6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) struct fib6_result *res, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void (*fib6_select_path)(const struct net *net, struct fib6_result *res,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct flowi6 *fl6, int oif, bool oif_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) const struct sk_buff *skb, int strict);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) u32 (*ip6_mtu_from_fib6)(const struct fib6_result *res,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) const struct in6_addr *daddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) const struct in6_addr *saddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) int (*fib6_nh_init)(struct net *net, struct fib6_nh *fib6_nh,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct fib6_config *cfg, gfp_t gfp_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct netlink_ext_ack *extack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void (*fib6_nh_release)(struct fib6_nh *fib6_nh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) void (*fib6_update_sernum)(struct net *net, struct fib6_info *rt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int (*ip6_del_rt)(struct net *net, struct fib6_info *rt, bool skip_notify);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) void (*fib6_rt_update)(struct net *net, struct fib6_info *rt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct nl_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) void (*udpv6_encap_enable)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) const struct in6_addr *solicited_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) bool router, bool solicited, bool override, bool inc_opt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #if IS_ENABLED(CONFIG_XFRM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) void (*xfrm6_local_rxpmtu)(struct sk_buff *skb, u32 mtu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) int (*xfrm6_udp_encap_rcv)(struct sock *sk, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int (*xfrm6_rcv_encap)(struct sk_buff *skb, int nexthdr, __be32 spi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) int encap_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) struct neigh_table *nd_tbl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) int (*ipv6_fragment)(struct net *net, struct sock *sk, struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) int (*output)(struct net *, struct sock *, struct sk_buff *));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) extern const struct ipv6_stub *ipv6_stub __read_mostly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /* A stub used by bpf helpers. Similarly ugly as ipv6_stub */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct ipv6_bpf_stub {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) int (*inet6_bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) u32 flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct sock *(*udp6_lib_lookup)(struct net *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) const struct in6_addr *saddr, __be16 sport,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) const struct in6_addr *daddr, __be16 dport,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) int dif, int sdif, struct udp_table *tbl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) extern const struct ipv6_bpf_stub *ipv6_bpf_stub __read_mostly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #endif