sock_reuseport.h 863 B

123456789101112131415161718192021222324252627282930
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _SOCK_REUSEPORT_H
  3. #define _SOCK_REUSEPORT_H
  4. #include <linux/filter.h>
  5. #include <linux/skbuff.h>
  6. #include <linux/types.h>
  7. #include <net/sock.h>
  8. struct sock_reuseport {
  9. struct rcu_head rcu;
  10. u16 max_socks; /* length of socks */
  11. u16 num_socks; /* elements in socks */
  12. struct bpf_prog __rcu *prog; /* optional BPF sock selector */
  13. struct sock *socks[0]; /* array of sock pointers */
  14. };
  15. extern int reuseport_alloc(struct sock *sk);
  16. extern int reuseport_add_sock(struct sock *sk, struct sock *sk2);
  17. extern void reuseport_detach_sock(struct sock *sk);
  18. extern struct sock *reuseport_select_sock(struct sock *sk,
  19. u32 hash,
  20. struct sk_buff *skb,
  21. int hdr_len);
  22. extern struct bpf_prog *reuseport_attach_prog(struct sock *sk,
  23. struct bpf_prog *prog);
  24. #endif /* _SOCK_REUSEPORT_H */