Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Wanting to add MPTCP support (Linux only)

176 views
Skip to first unread message

Muhammad Nuzaihan Kamal Luddin

unread,
Mar 12, 2025, 12:53:38 PMMar 12
to Chromium-dev
Hi,

I have been browsing Chromium's source and i am interested in adding MPTCP (Linux platform) support.

Am thinking of adding #ifdef for linux and adding the appropriate code so MPTCP will be used in Chromium.

However, as per contribution guideline, I am asking for second opinion. Are anything against adding #ifdef for linux?

Thanks,
Zaihan

Muhammad Nuzaihan Kamal Luddin

unread,
Mar 14, 2025, 2:36:37 PMMar 14
to Chromium-dev, Muhammad Nuzaihan Kamal Luddin
Hi,

Since no one gave any comments, i proceeded to implement the support on Linux's chromium. I think Chromium for macOS/iOS already has MPTCP support for years but i may be wrong.

Used #if BUILDFLAG(IS_LINUX) to introduce my changes for Linux.

I managed to add MPTCP support to google chromium and it's working great since i can combined my laptop's WiFi and 5G bandwidth, at least for Linux.

Kernel: Linux 6.12.6-stable,
PopOS! 22.04

Comments welcomed. I'm planning to add some tests and submit my patches to upstream Google Chrome.


Screenshot from 2025-03-14 23-24-37.png

Timur Appaev

unread,
Mar 19, 2025, 11:25:16 AMMar 19
to zai...@unrealasia.net, Chromium-dev

Have you published your code?


пт, 14 мар. 2025 г., 22:01 Muhammad Nuzaihan Kamal Luddin <zai...@unrealasia.net>:
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/67a97890-0d9c-46c2-af31-92105d52886cn%40chromium.org.

guest271314

unread,
Mar 20, 2025, 9:30:04 AMMar 20
to Chromium-dev, Timur Appaev, Chromium-dev, zai...@unrealasia.net
Interesting. Can you publish the steps and code as a GitHub repository or gist?

guest271314

unread,
Mar 21, 2025, 9:21:07 AMMar 21
to Chromium-dev, guest271314, Timur Appaev, Chromium-dev, zai...@unrealasia.net
> Hi,
>
> It's at
https://chromium-review.googlesource.com/c/chromium/src/+/6355767
>
> The code is working but just need some improvements as suggested in
that repository and i'm still working on it.
>
> Just slow because building chrome locally even with 14 cores, 64GB RAM
and high performance NVMe still takes 14 hours.

What I have been doing is exploiting the fact that communication between a ServiceWorker and a WindowClient or Client on Chromium-based browsers is a full-duplex stream. So I don't necessarily need to create an HTTP/2 or HTTP/3 server to full duplex stream between any arbotrary Web page and local or remote servers or peers. That allows me to use WHAT Fetch for full duplex streaming to and from the browser, even though WHATWG Fetch still hasn't spelled that out (#1254).

Something like this on the arbitrary Web page

```
var { readable: r, writable: w } = new TransformStream();
var writer = w.getWriter();
var encoder = new TextEncoder();
var { readable, transferableWindow } = await nativeMessageStream(
  "/home/user/half_duplex_stream",
  r,
);
//.then(console.log).catch(console.error);

readable.pipeThrough(new TextDecoderStream()).pipeTo(
  new WritableStream({
    write(v) {
      console.log(v);
    },
    close() {
      console.log("Stream close");
      transferableWindow.remove();
    },
    abort(reason) {
      console.log(reason);
      transferableWindow.remove();
    },
  }),
).then(() => console.log("Done streaming")).catch(console.error);
```

and this in the ServiceWorker, which gets the uploaded readable side of the TransformStream using Transferable Streams

```
addEventListener("fetch", async (e) => {
  console.log(e.request.url, e.request.destination, e.clientId);
  if (e.request.url.includes("stream")) {
    e.respondWith(
      new Response(
        e.request.body
          .pipeThrough(new TextDecoderStream())
          .pipeThrough(
            new TransformStream({
              async start() {
                // getClientState(e.clientId);

                if (globalThis.port === null) {
                  readable = new ReadableStream({
                    start: (_) => {
                      return controller = _;
                    },
                    cancel(reason) {
                      console.log(reason);
                    },
                  });
                  reader = readable.getReader();
                  port = chrome.runtime.connectNative(
                    chrome.runtime.getManifest().short_name,
                  );
                  port.onMessage.addListener((message) => {
                    controller.enqueue(encoder.encode(message));
                  });
                  port.onDisconnect.addListener((e) => {
                    console.log(e);
                    if (chrome.runtime.lastError) {
                      console.log(chrome.runtime.lastError);
                    }
                    controller.close();
                    port = readable = controller = null;
                  });
                }
              },
              async transform(value, c) {
                console.log(value);
                port.postMessage(value);
                const { value: message, done } = await reader.read();
                console.log(message, done);
                c.enqueue(message);
              },
              flush() {
                console.log("flush");
              },
            }),
          ),
      ),
    );
  }
});

await writer.write(new TextEncoder().encode("b"));
// B
await writer.write(new TextEncoder().encode("c"));
// C
```

So, technically any number of streams can be piped to that single connection in the ServiceWorker

What I'm interestested in doing now is implementing either h2c and/or HTTP/3 for WebTransport server implementation in an Isolated Web App using Direct Sockets API TCPServerSocket and/or UDPSocket. 

guest271314

unread,
Mar 21, 2025, 9:40:31 AMMar 21
to Muhammad Nuzaihan Kamal Luddin, Chromium-dev, Timur Appaev
My idea is to full-duplex stream using WHATWG Fetch - any any means necessary. 

WebTransport works, though has the added requirement of TLS - unless HTTP/2 with prior knowledge or h2c is used, which I don't think any browser provides a means to upgrade from HTTP/1.1 to HTTP/2.

Basically what I'm doing now is creating an iframe to transfer the uploaded ReadableStream to a Web extension where I can utilize the fact that on Chromium-based browsers the fetch() from a WindowClient and the ServiceWorker is full-duplex, meaning I can upload a ReadableStream, write to that stream and get the response back on a single connection, that can remain established, in theory, indefinitely. 

Since WHATWG Streams has pipeTo() it's possible to pipe multiple streams to the same stream and send the response to multiple endpoints.

On Fri, Mar 21, 2025 at 1:25 PM Muhammad Nuzaihan Kamal Luddin <zai...@unrealasia.net> wrote:
I am sorry.

You are talking about getting parallel data transfer at a different layer. MPTCP works are layer 4 and your idea works at a layer higher UP and either a UDP or TCP (or MPTCP) transport
Sent from my iPhone

On 21 Mar 2025, at 9:21 PM, guest271314 <guest...@gmail.com> wrote:

> Hi,

guest271314

unread,
Mar 21, 2025, 9:43:43 AMMar 21
to Muhammad Nuzaihan Kamal Luddin, Chromium-dev, Timur Appaev
Here's HTTP and WebSocket server implementations in the browser using
WICG Direct Sockets
https://github.com/guest271314/direct-sockets-http-ws-server.

You should be able to implement MPTCP there - without building
Chromium. Just installing the IWA.

On Fri, Mar 21, 2025 at 1:25 PM Muhammad Nuzaihan Kamal Luddin
<zai...@unrealasia.net> wrote:
>
> I am sorry.
>
> You are talking about getting parallel data transfer at a different layer. MPTCP works are layer 4 and your idea works at a layer higher UP and either a UDP or TCP (or MPTCP) transport
> Sent from my iPhone
>
> On 21 Mar 2025, at 9:21 PM, guest271314 <guest...@gmail.com> wrote:
>
> > Hi,

guest271314

unread,
Mar 21, 2025, 9:52:06 AMMar 21
to Muhammad Nuzaihan, Chromium-dev, Timur Appaev
Oh, alright. I thought you might be interested in using UDP if TCP is
down or using TCP if UDP is down for the same purpose.

Anyway, good luck!

On Fri, Mar 21, 2025 at 1:43 PM Muhammad Nuzaihan <zai...@unrealasia.net> wrote:
>
> Again I am sorry, this has nothing to do with WHATWG and you do not
> have understanding about what is MPTCP. It's is two different thing.
>
> With MPTCP, my computer can have two interfaces with two different IPs
> (think WiFi and 5G in phones) and MPTCP downloads website concurrently
> ACROSS thw two interfaces.
>
> WHATWG could not do that and can only work with ONE interface at a time.
>
> And if ONE of my internet interfaces is down, the download still
> happens (because of the other interface is up)
>
> WHATWG is on another layer which usually runs ON TOP OF TCP/MPTCP or
> UDP/QUIC.
>
> I don't want to discuss about this as this has nothing to do with MPTCP
> and i'm already tired of discussing about something not related to my
> work.

guest271314

unread,
Mar 21, 2025, 10:18:54 AMMar 21
to Chromium-dev, guest271314, Chromium-dev, Timur Appaev, Muhammad Nuzaihan
If you don't mind me asking, how do you use Native Client from the browser circa 2025?

guest271314

unread,
Mar 21, 2025, 10:38:43 AMMar 21
to Muhammad Nuzaihan, Chromium-dev, Timur Appaev
Right. I'm on Debian. I'm referring to your code review link that
appears to use Native Client, which I thought was deprecated, in part,
in lieu of WebAssembly.

Do you use Native Client from the browser?

On Fri, Mar 21, 2025 at 2:32 PM Muhammad Nuzaihan <zai...@unrealasia.net> wrote:
>
> I'm only implementing IPPROTO_MTCP which is a feature in the OS
> (currently only Linux)
>
> There is no MPTCP support for Windows as Microsoft has not implemented
> them. Sorry.

Muhammad Nuzaihan

unread,
Mar 24, 2025, 12:07:23 PMMar 24
to guest271314, Chromium-dev, Timur Appaev
Again I am sorry, this has nothing to do with WHATWG and you do not
have understanding about what is MPTCP. It's is two different thing.

With MPTCP, my computer can have two interfaces with two different IPs
(think WiFi and 5G in phones) and MPTCP downloads website concurrently
ACROSS thw two interfaces.

WHATWG could not do that and can only work with ONE interface at a time.

And if ONE of my internet interfaces is down, the download still
happens (because of the other interface is up)

WHATWG is on another layer which usually runs ON TOP OF TCP/MPTCP or
UDP/QUIC.

I don't want to discuss about this as this has nothing to do with MPTCP
and i'm already tired of discussing about something not related to my
work.

On Fri, Mar 21 2025 at 01:38:02 PM +0000, guest271314
<guest...@gmail.com> wrote:

Muhammad Nuzaihan

unread,
Mar 24, 2025, 12:07:29 PMMar 24
to guest271314, Chromium-dev, Timur Appaev
I am sorry. i have no interest in this, you can try if you want.

Muhammad Nuzaihan

unread,
Mar 24, 2025, 12:07:48 PMMar 24
to guest271314, Chromium-dev, Timur Appaev
Hi,

It's at
https://chromium-review.googlesource.com/c/chromium/src/+/6355767

The code is working but just need some improvements as suggested in
that repository and i'm still working on it.

Just slow because building chrome locally even with 14 cores, 64GB RAM
and high performance NVMe still takes 14 hours.

On Thu, Mar 20 2025 at 06:30:03 AM -0700, guest271314
<guest...@gmail.com> wrote:
> Interesting. Can you publish the steps and code as a GitHub
> repository or gist?
>
> On Wednesday, March 19, 2025 at 3:25:16 PM UTC Timur Appaev wrote:
>> Have you published your code?
>>
>>
>> пт, 14 мар. 2025 г., 22:01 Muhammad Nuzaihan Kamal Luddin
>> <zai...@unrealasia.net>:
>>>
>>> Hi,
>>>
>>> Since no one gave any comments, i proceeded to implement the
>>> support on Linux's chromium. I think Chromium for macOS/iOS already
>>> has MPTCP support for years but i may be wrong.
>>>
>>> Used #if BUILDFLAG(IS_LINUX) to introduce my changes for Linux.
>>>
>>> I managed to add MPTCP support to google chromium and it's working
>>> great since i can combined my laptop's WiFi and 5G bandwidth, at
>>> least for Linux.
>>>
>>> Kernel: Linux 6.12.6-stable,
>>> PopOS! 22.04
>>>
>>> Comments welcomed. I'm planning to add some tests and submit my
>>> patches to upstream Google Chrome.
>>>
>>>
>>>
>>>
>>>
>>>

Muhammad Nuzaihan Kamal Luddin

unread,
Mar 24, 2025, 12:07:55 PMMar 24
to guest271314, Chromium-dev, Timur Appaev, guest271314
I am sorry.

You are talking about getting parallel data transfer at a different layer. MPTCP works are layer 4 and your idea works at a layer higher UP and either a UDP or TCP (or MPTCP) transport
Sent from my iPhone

On 21 Mar 2025, at 9:21 PM, guest271314 <guest...@gmail.com> wrote:

> Hi,

Muhammad Nuzaihan

unread,
Mar 24, 2025, 12:08:17 PMMar 24
to guest271314, Chromium-dev, Timur Appaev
I'm only implementing IPPROTO_MTCP which is a feature in the OS
(currently only Linux)

There is no MPTCP support for Windows as Microsoft has not implemented
them. Sorry.

On Fri, Mar 21, 2025 at 10:18 PM guest271314 <guest...@gmail.com> wrote:
>

Muhammad Nuzaihan Kamal Luddin

unread,
Mar 24, 2025, 12:08:26 PMMar 24
to guest271314, Chromium-dev, Timur Appaev
Hi,

Unfortunately no. I intend to remove that code.

It was an initial concept to get a working Chromium build that supports MPTCP, which works. That is it, no nativeclient, just Chromium with MPTCP that is supported by OS.

I am currently cleaning up the code (and removing parts of it), adding a special option to enable MPTCP on the UI.

Sent from my iPhone

> On 21 Mar 2025, at 10:35 PM, guest271314 <guest...@gmail.com> wrote:
>
> Right. I'm on Debian. I'm referring to your code review link that
Reply all
Reply to author
Forward
0 new messages