Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _IPV6_STUBS_H
0003 #define _IPV6_STUBS_H
0004 
0005 #include <linux/in6.h>
0006 #include <linux/netdevice.h>
0007 #include <linux/skbuff.h>
0008 #include <net/dst.h>
0009 #include <net/flow.h>
0010 #include <net/neighbour.h>
0011 #include <net/sock.h>
0012 
0013 /* structs from net/ip6_fib.h */
0014 struct fib6_info;
0015 struct fib6_nh;
0016 struct fib6_config;
0017 struct fib6_result;
0018 
0019 /* This is ugly, ideally these symbols should be built
0020  * into the core kernel.
0021  */
0022 struct ipv6_stub {
0023     int (*ipv6_sock_mc_join)(struct sock *sk, int ifindex,
0024                  const struct in6_addr *addr);
0025     int (*ipv6_sock_mc_drop)(struct sock *sk, int ifindex,
0026                  const struct in6_addr *addr);
0027     struct dst_entry *(*ipv6_dst_lookup_flow)(struct net *net,
0028                           const struct sock *sk,
0029                           struct flowi6 *fl6,
0030                           const struct in6_addr *final_dst);
0031     int (*ipv6_route_input)(struct sk_buff *skb);
0032 
0033     struct fib6_table *(*fib6_get_table)(struct net *net, u32 id);
0034     int (*fib6_lookup)(struct net *net, int oif, struct flowi6 *fl6,
0035                struct fib6_result *res, int flags);
0036     int (*fib6_table_lookup)(struct net *net, struct fib6_table *table,
0037                  int oif, struct flowi6 *fl6,
0038                  struct fib6_result *res, int flags);
0039     void (*fib6_select_path)(const struct net *net, struct fib6_result *res,
0040                  struct flowi6 *fl6, int oif, bool oif_match,
0041                  const struct sk_buff *skb, int strict);
0042     u32 (*ip6_mtu_from_fib6)(const struct fib6_result *res,
0043                  const struct in6_addr *daddr,
0044                  const struct in6_addr *saddr);
0045 
0046     int (*fib6_nh_init)(struct net *net, struct fib6_nh *fib6_nh,
0047                 struct fib6_config *cfg, gfp_t gfp_flags,
0048                 struct netlink_ext_ack *extack);
0049     void (*fib6_nh_release)(struct fib6_nh *fib6_nh);
0050     void (*fib6_nh_release_dsts)(struct fib6_nh *fib6_nh);
0051     void (*fib6_update_sernum)(struct net *net, struct fib6_info *rt);
0052     int (*ip6_del_rt)(struct net *net, struct fib6_info *rt, bool skip_notify);
0053     void (*fib6_rt_update)(struct net *net, struct fib6_info *rt,
0054                    struct nl_info *info);
0055 
0056     void (*udpv6_encap_enable)(void);
0057     void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr,
0058                   const struct in6_addr *solicited_addr,
0059                   bool router, bool solicited, bool override, bool inc_opt);
0060 #if IS_ENABLED(CONFIG_XFRM)
0061     void (*xfrm6_local_rxpmtu)(struct sk_buff *skb, u32 mtu);
0062     int (*xfrm6_udp_encap_rcv)(struct sock *sk, struct sk_buff *skb);
0063     int (*xfrm6_rcv_encap)(struct sk_buff *skb, int nexthdr, __be32 spi,
0064                    int encap_type);
0065 #endif
0066     struct neigh_table *nd_tbl;
0067 
0068     int (*ipv6_fragment)(struct net *net, struct sock *sk, struct sk_buff *skb,
0069                  int (*output)(struct net *, struct sock *, struct sk_buff *));
0070     struct net_device *(*ipv6_dev_find)(struct net *net, const struct in6_addr *addr,
0071                         struct net_device *dev);
0072 };
0073 extern const struct ipv6_stub *ipv6_stub __read_mostly;
0074 
0075 /* A stub used by bpf helpers. Similarly ugly as ipv6_stub */
0076 struct ipv6_bpf_stub {
0077     int (*inet6_bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len,
0078               u32 flags);
0079     struct sock *(*udp6_lib_lookup)(struct net *net,
0080                      const struct in6_addr *saddr, __be16 sport,
0081                      const struct in6_addr *daddr, __be16 dport,
0082                      int dif, int sdif, struct udp_table *tbl,
0083                      struct sk_buff *skb);
0084 };
0085 extern const struct ipv6_bpf_stub *ipv6_bpf_stub __read_mostly;
0086 
0087 #endif