Skip to content

Commit c974dd2

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
Squash to "bpf: Extend bpf_skc_to_mptcp_sock to MPTCP sock"
Set msk->bpf_iter_task in bpf_mptcp_sock_from_sock() to allow mptcp_subflow bpt_iter can be used in cgroup/getsockopt, otherwise, the selftest in this set fails. Signed-off-by: Geliang Tang <[email protected]>
1 parent c56c31a commit c974dd2

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

net/mptcp/bpf.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,22 @@ static struct bpf_struct_ops bpf_mptcp_sched_ops = {
197197

198198
struct mptcp_sock *bpf_mptcp_sock_from_sock(struct sock *sk)
199199
{
200+
struct mptcp_sock *msk;
201+
200202
if (unlikely(!sk || !sk_fullsock(sk)))
201203
return NULL;
202204

203-
if (sk->sk_protocol == IPPROTO_MPTCP)
204-
return mptcp_sk(sk);
205+
if (sk->sk_protocol == IPPROTO_MPTCP) {
206+
msk = mptcp_sk(sk);
207+
mptcp_set_bpf_iter_task(msk);
208+
return msk;
209+
}
205210

206-
if (sk->sk_protocol == IPPROTO_TCP && sk_is_mptcp(sk))
207-
return mptcp_sk(mptcp_subflow_ctx(sk)->conn);
211+
if (sk->sk_protocol == IPPROTO_TCP && sk_is_mptcp(sk)) {
212+
msk = mptcp_sk(mptcp_subflow_ctx(sk)->conn);
213+
mptcp_set_bpf_iter_task(msk);
214+
return msk;
215+
}
208216

209217
return NULL;
210218
}

0 commit comments

Comments
 (0)