bpf.c 482 B

123456789101112131415161718192021
  1. // SPDX-License-Identifier: GPL-2.0
  2. /* Multipath TCP
  3. *
  4. * Copyright (c) 2020, Tessares SA.
  5. * Copyright (c) 2022, SUSE.
  6. *
  7. * Author: Nicolas Rybowski <[email protected]>
  8. */
  9. #define pr_fmt(fmt) "MPTCP: " fmt
  10. #include <linux/bpf.h>
  11. #include "protocol.h"
  12. struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
  13. {
  14. if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP && sk_is_mptcp(sk))
  15. return mptcp_sk(mptcp_subflow_ctx(sk)->conn);
  16. return NULL;
  17. }