ipv6_stubs.h 3.4 KB

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