ipv6_stubs.h 3.9 KB

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