MPTCP Linux Development
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Gang Yan <yangang@kylinos.cn>, mptcp@lists.linux.dev
Subject: Re: [Patch, v2, 2/2] BCC: python: add a useful tool for mptcp
Date: Wed, 9 Apr 2025 10:26:42 +0200	[thread overview]
Message-ID: <b7eb84ea-97c8-4a00-8a91-8d36a82f8563@kernel.org> (raw)
In-Reply-To: <cde026e8afeec48569765f7590ee0ca8fd14b57f.1744182834.git.yangang@kylinos.cn>

Hi Gang,

On 09/04/2025 09:17, Gang Yan wrote:
> Multipath TCP (MPTCP) is an extension of the standard TCP protocol
> that allows a single transport connection to use multiple network
> interfaces or paths. MPTCP is useful for applications like bandwidth
> aggregation, failover, and more resilient connections.
> 
> Linux kernel starts to support MPTCP since v5.6, this patch provides
> a method which can easily force applications use MPTCP socket without
> modifing its code.
> 
> Signed-off-by: Gang Yan <yangang@kylinos.cn>
> ---
>  tools/mptcpify.py  | 80 ++++++++++++++++++++++++++++++++++++++++++++++
>  tools/mptcpify.txt | 22 +++++++++++++
>  2 files changed, 102 insertions(+)
>  create mode 100644 tools/mptcpify.py
>  create mode 100644 tools/mptcpify.txt
> 
> diff --git a/tools/mptcpify.py b/tools/mptcpify.py
> new file mode 100644
> index 00000000..efdbd910
> --- /dev/null
> +++ b/tools/mptcpify.py
> @@ -0,0 +1,80 @@
> +#!/usr/bin/env python
> +#
> +# mptcpify Make the applications to use MPTCP.
> +#           For Linux, uses BCC, eBPF. Embedded C.
> +#
> +# USAGE: mptcpify -t
> +#
> +# Copyright 2025 Kylin Software, Inc.
> +# Licensed under the Apache License, Version 2.0 (the "License")
> +#
> +# 05-Apr-2025   Gang Yan   Created this.
> +
> +import ctypes as ct
> +import argparse
> +import signal
> +import time
> +
> +from bcc import BPF
> +
> +#arguments
> +parser = argparse.ArgumentParser(
> +         description="mptcpify try to force applications to use MPTCP instead of TCP")
> +parser.add_argument("-t", "--targets", required=True, type=str,
> +                    help="use ',' for multi targets, eg: 'iperf3,rsync'")

If it is easy for you to have this argument optional, don't hesitate to
add this support: I think it will be useful to have this mode
"everything is forced to use MPTCP".

(...)

> +b = BPF(text=prog)
> +b.attach_fmod_ret("update_socket_protocol")
> +
> +support_apps = b.get_table("support_apps")
> +for i in args_list:
> +    app = i.encode()
> +    name = app_name()
> +    name.str = app[:TASK_COMM_LEN-1].ljust(TASK_COMM_LEN, b'\0')
> +    support_apps[name] = ct.c_uint32(1)
> +
> +print("MPTCP is been forced for ", args_list);

Detail: maybe better with "is being forced".

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


  reply	other threads:[~2025-04-09  8:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09  7:17 [Patch, v2, 0/2] BCC: python: support fmod_ret Gang Yan
2025-04-09  7:17 ` [Patch, v2, 1/2] BCC: Python: Support 'fmod_ret' method for eBPF Gang Yan
2025-04-09  8:26   ` Matthieu Baerts
2025-04-09  9:29     ` Gang Yan
2025-04-09  7:17 ` [Patch, v2, 2/2] BCC: python: add a useful tool for mptcp Gang Yan
2025-04-09  8:26   ` Matthieu Baerts [this message]
2025-04-09  8:26 ` [Patch, v2, 0/2] BCC: python: support fmod_ret Matthieu Baerts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b7eb84ea-97c8-4a00-8a91-8d36a82f8563@kernel.org \
    --to=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=yangang@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox