hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/include/net/sock_reuseport.h
....@@ -24,7 +24,7 @@
2424 unsigned int bind_inany:1;
2525 unsigned int has_conns:1;
2626 struct bpf_prog __rcu *prog; /* optional BPF sock selector */
27
- struct sock *socks[0]; /* array of sock pointers */
27
+ struct sock *socks[]; /* array of sock pointers */
2828 };
2929
3030 extern int reuseport_alloc(struct sock *sk, bool bind_inany);
....@@ -36,24 +36,22 @@
3636 struct sk_buff *skb,
3737 int hdr_len);
3838 extern int reuseport_attach_prog(struct sock *sk, struct bpf_prog *prog);
39
+extern int reuseport_detach_prog(struct sock *sk);
3940
40
-static inline bool reuseport_has_conns(struct sock *sk, bool set)
41
+static inline bool reuseport_has_conns(struct sock *sk)
4142 {
4243 struct sock_reuseport *reuse;
4344 bool ret = false;
4445
4546 rcu_read_lock();
4647 reuse = rcu_dereference(sk->sk_reuseport_cb);
47
- if (reuse) {
48
- if (set)
49
- reuse->has_conns = 1;
50
- ret = reuse->has_conns;
51
- }
48
+ if (reuse && reuse->has_conns)
49
+ ret = true;
5250 rcu_read_unlock();
5351
5452 return ret;
5553 }
5654
57
-int reuseport_get_id(struct sock_reuseport *reuse);
55
+void reuseport_has_conns_set(struct sock *sk);
5856
5957 #endif /* _SOCK_REUSEPORT_H */