Loading...
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#include <net/ipv6.h>
13
14/* structs from net/ip6_fib.h */
15struct fib6_info;
16struct fib6_nh;
17struct fib6_config;
18struct fib6_result;
19
20/* This is ugly, ideally these symbols should be built
21 * into the core kernel.
22 */
23struct ipv6_stub {
24 int (*ipv6_sock_mc_join)(struct sock *sk, int ifindex,
25 const struct in6_addr *addr);
26 int (*ipv6_sock_mc_drop)(struct sock *sk, int ifindex,
27 const struct in6_addr *addr);
28 struct dst_entry *(*ipv6_dst_lookup_flow)(struct net *net,
29 const struct sock *sk,
30 struct flowi6 *fl6,
31 const struct in6_addr *final_dst);
32 int (*ipv6_route_input)(struct sk_buff *skb);
33
34 struct fib6_table *(*fib6_get_table)(struct net *net, u32 id);
35 int (*fib6_lookup)(struct net *net, int oif, struct flowi6 *fl6,
36 struct fib6_result *res, int flags);
37 int (*fib6_table_lookup)(struct net *net, struct fib6_table *table,
38 int oif, struct flowi6 *fl6,
39 struct fib6_result *res, int flags);
40 void (*fib6_select_path)(const struct net *net, struct fib6_result *res,
41 struct flowi6 *fl6, int oif, bool oif_match,
42 const struct sk_buff *skb, int strict);
43 u32 (*ip6_mtu_from_fib6)(const struct fib6_result *res,
44 const struct in6_addr *daddr,
45 const struct in6_addr *saddr);
46
47 int (*fib6_nh_init)(struct net *net, struct fib6_nh *fib6_nh,
48 struct fib6_config *cfg, gfp_t gfp_flags,
49 struct netlink_ext_ack *extack);
50 void (*fib6_nh_release)(struct fib6_nh *fib6_nh);
51 void (*fib6_nh_release_dsts)(struct fib6_nh *fib6_nh);
52 void (*fib6_update_sernum)(struct net *net, struct fib6_info *rt);
53 int (*ip6_del_rt)(struct net *net, struct fib6_info *rt, bool skip_notify);
54 void (*fib6_rt_update)(struct net *net, struct fib6_info *rt,
55 struct nl_info *info);
56
57 void (*udpv6_encap_enable)(void);
58 void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr,
59 const struct in6_addr *solicited_addr,
60 bool router, bool solicited, bool override, bool inc_opt);
61#if IS_ENABLED(CONFIG_XFRM)
62 void (*xfrm6_local_rxpmtu)(struct sk_buff *skb, u32 mtu);
63 int (*xfrm6_udp_encap_rcv)(struct sock *sk, struct sk_buff *skb);
64 struct sk_buff *(*xfrm6_gro_udp_encap_rcv)(struct sock *sk,
65 struct list_head *head,
66 struct sk_buff *skb);
67 int (*xfrm6_rcv_encap)(struct sk_buff *skb, int nexthdr, __be32 spi,
68 int encap_type);
69#endif
70 struct neigh_table *nd_tbl;
71
72 int (*ipv6_fragment)(struct net *net, struct sock *sk, struct sk_buff *skb,
73 int (*output)(struct net *, struct sock *, struct sk_buff *));
74 struct net_device *(*ipv6_dev_find)(struct net *net, const struct in6_addr *addr,
75 struct net_device *dev);
76 int (*ip6_xmit)(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
77 __u32 mark, struct ipv6_txoptions *opt, int tclass, u32 priority);
78};
79extern const struct ipv6_stub *ipv6_stub __read_mostly;
80
81/* A stub used by bpf helpers. Similarly ugly as ipv6_stub */
82struct ipv6_bpf_stub {
83 int (*inet6_bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len,
84 u32 flags);
85 struct sock *(*udp6_lib_lookup)(const struct net *net,
86 const struct in6_addr *saddr, __be16 sport,
87 const struct in6_addr *daddr, __be16 dport,
88 int dif, int sdif, struct udp_table *tbl,
89 struct sk_buff *skb);
90 int (*ipv6_setsockopt)(struct sock *sk, int level, int optname,
91 sockptr_t optval, unsigned int optlen);
92 int (*ipv6_getsockopt)(struct sock *sk, int level, int optname,
93 sockptr_t optval, sockptr_t optlen);
94 int (*ipv6_dev_get_saddr)(struct net *net,
95 const struct net_device *dst_dev,
96 const struct in6_addr *daddr,
97 unsigned int prefs,
98 struct in6_addr *saddr);
99};
100extern const struct ipv6_bpf_stub *ipv6_bpf_stub __read_mostly;
101
102#endif
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 */
14struct fib6_info;
15struct fib6_nh;
16struct fib6_config;
17struct fib6_result;
18
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 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);
31 int (*ipv6_route_input)(struct sk_buff *skb);
32
33 struct fib6_table *(*fib6_get_table)(struct net *net, u32 id);
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);
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);
42 u32 (*ip6_mtu_from_fib6)(const struct fib6_result *res,
43 const struct in6_addr *daddr,
44 const struct in6_addr *saddr);
45
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);
50 void (*fib6_nh_release_dsts)(struct fib6_nh *fib6_nh);
51 void (*fib6_update_sernum)(struct net *net, struct fib6_info *rt);
52 int (*ip6_del_rt)(struct net *net, struct fib6_info *rt, bool skip_notify);
53 void (*fib6_rt_update)(struct net *net, struct fib6_info *rt,
54 struct nl_info *info);
55
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);
60#if IS_ENABLED(CONFIG_XFRM)
61 void (*xfrm6_local_rxpmtu)(struct sk_buff *skb, u32 mtu);
62 int (*xfrm6_udp_encap_rcv)(struct sock *sk, struct sk_buff *skb);
63 struct sk_buff *(*xfrm6_gro_udp_encap_rcv)(struct sock *sk,
64 struct list_head *head,
65 struct sk_buff *skb);
66 int (*xfrm6_rcv_encap)(struct sk_buff *skb, int nexthdr, __be32 spi,
67 int encap_type);
68#endif
69 struct neigh_table *nd_tbl;
70
71 int (*ipv6_fragment)(struct net *net, struct sock *sk, struct sk_buff *skb,
72 int (*output)(struct net *, struct sock *, struct sk_buff *));
73 struct net_device *(*ipv6_dev_find)(struct net *net, const struct in6_addr *addr,
74 struct net_device *dev);
75};
76extern const struct ipv6_stub *ipv6_stub __read_mostly;
77
78/* A stub used by bpf helpers. Similarly ugly as ipv6_stub */
79struct ipv6_bpf_stub {
80 int (*inet6_bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len,
81 u32 flags);
82 struct sock *(*udp6_lib_lookup)(struct net *net,
83 const struct in6_addr *saddr, __be16 sport,
84 const struct in6_addr *daddr, __be16 dport,
85 int dif, int sdif, struct udp_table *tbl,
86 struct sk_buff *skb);
87 int (*ipv6_setsockopt)(struct sock *sk, int level, int optname,
88 sockptr_t optval, unsigned int optlen);
89 int (*ipv6_getsockopt)(struct sock *sk, int level, int optname,
90 sockptr_t optval, sockptr_t optlen);
91 int (*ipv6_dev_get_saddr)(struct net *net,
92 const struct net_device *dst_dev,
93 const struct in6_addr *daddr,
94 unsigned int prefs,
95 struct in6_addr *saddr);
96};
97extern const struct ipv6_bpf_stub *ipv6_bpf_stub __read_mostly;
98
99#endif