[Tutorial] Build OpenWrt with Multipath TCP

It should work, you might have to tweak the patch a bit if it will refuse to apply though.

Hi,

I tried to follow the instructions to build for 19.07-8. I am building for x86-64, to be run in a proxmox vm. The build seemed successful and I can see that the kernel was built with mptcp in the file openwrt-x86-64-vmlinuz. However, the packed rom file openwrt-x86-64-combined-ext4.img.gz doesn't contain the kernel with MPTCP patches. I tried to copy the kernel openwrt-x86-64-vmlinuz to a running image in /boot directory, but after reboot I got a kernel panic (failsafe mode still works though).

May I know what are the steps needed to troubleshoot? Thanks!

Francisco

I never tried it on x86_64 so I honestly don't know what's wrong or how to debug, sorry.

I've been trying to compile an image for a while but I'm kind of stuck since it keeps failing to apply the patches to tcp_ipv6.c
I'm using the 5.4.101 kernel if that matters. Any idea on what I could try to get it to compile properly?

You have to set up quilt on the build directory and force apply the patch

make target/linux/prepare QUILT=1
cd build_dir/target-<your-target>/linux-<your-subtarget>/linux-5.4.x
quilt push -af

Open the newly created reject file

Find where it fails on the file it tries to patch

Manually put the rejected code at the correct location (assuming the code wouldn't need to be changed)

Run quilt refresh to apply your changes

cd back to the root directory and run make target/linux/update package/index to have the fixed patch put back from the build directory.

I'm putting out a lot of irrelevant information under the thread to get you going. Read OpenWrt wiki for more information.

I think I figured out where the patch fails, there is a line that is completely different between the files. The same happens with tcp_ipv4.c too, where I get another rejection. Should I keep the original line or should I replace it with the .rej's line?


Keep the original line

Okay.
Another thing: from what I'm seeing, in your patch, something like pic related happens for a number of times and I believe it might be a mistake: you make a static method non-static and then try to modify it, but the patch won't find it since it's not static anymore. Am I reading this right?

diff calculates the difference between files, if that's how diff created the patch (it is) then patch will apply it just fine.

So, no.

I see lol, I gotta up my git game.
Do you think it's feasible for me to make my own patch? Do I just have to diff my version of the kernel against MPTCP's one? It's not possible to just copypaste MPTCP's kernel and use that is it?
I realized that some parts of your patch got ignored for whatever reason and, while I can just add the stuff that's missing manually, I'd probably be missing something else that went wrong and that would break things in the OS despite compiling just fine.

I plan to turn this thread into an OpenWrt wiki page including creating patches by yourself. Until then these are the steps to do so:

git clone https://github.com/multipath-tcp/mptcp.git
git remote add stable git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
git checkout mptcp_v0.96 && git pull
git fetch stable --tags
git diff v$(make kernelversion)..HEAD > mptcp_v0.96.patch

It's easier to just put a patch which modifies the kernel for out-of-tree MPTCP support.

Please explain how did you come to this conclusion.

Let's say that I wanted to diff the Linux kernel against the last commit in MPTCP's repo where the 5.4.101 version was used (I wrote a Bash script for that and that'd be the commit whose hash is 07c4c2e2bcd38896762f29e74abb57bdd3a2a4d1 apparently).

git clone -b mptcp_v0.96 https://github.com/multipath-tcp/mptcp.git
git checkout 07c4c2e2bcd38896762f29e74abb57bdd3a2a4d1
[?????]
git diff v5.4.101..HEAD > mptcp_patch.patch

What do I need to write in the middle to make it work? I've been trying for a while with no luck.

Please explain how did you come to this conclusion.

I got some errors in the final part of the compilation (the last make to be clear). Turns out that the patch was supposed to turn certain static functions into non-static and, after giving a look at the bodies of those functions and comparing them to the patch, I realized a lot of other things didn't get patched properly.

Why don't you add and fetch the stable remote?

I honestly don't know how that's possible. Check the output from quilt for any fuzz, ignore or errors.

Hi,

When I do an iperf test between OpenWRT and VPS mptcp works as intended but when I set up v2ray proxy and iptables it works but doesn't use mptcp, nothing in the headers.

followed this guide, redirect method:

but join connection packets sent to 127.0.0.1 and multipath capable to the VPS address sent from the master interface but no reply.

Not sure how to fix.

The firewall configuration is for tproxy method. That’s likely why it won’t work.

hey. i have one question.
in this link https://arinc9.com/Transparent-Proxy-Using-v2ray-c6bfee7be82f4084a73a132e362c6a10 is the left config supposed to be for the OpenWRT client and the left for the VPS?

Both are for client configuration.

which one am i supposed to use then? and what about the server's config?

I suggest TPROXY. The rest, you need to figure out yourself.

Hi, @arinc9. Was the file linux-image-5.4.169-generic-mptcp_5.4.169-generic-mptcp-1_amd64.deb correctly uploaded?
There is an error during installation process -

dpkg-deb (subprocess): cannot copy archive member from 'linux-image-5.4.169-generic-mptcp_5.4.169-generic-mptcp-1_amd64.deb' to decompressor pipe: unexpected end of file or stream
dpkg-deb (subprocess): decompressing archive member: lzma error: unexpected end of input
dpkg-deb: error: <decompress> subprocess returned error exit status 2
dpkg: error processing archive linux-image-5.4.169-generic-mptcp_5.4.169-generic-mptcp-1_amd64.deb (--install):
 cannot copy extracted data for './lib/modules/5.4.169-generic-mptcp/kernel/drivers/misc/mei/mei.ko' to '/lib/modules/5.4.169-generic-mptcp/kernel/drivers/misc/mei/mei.ko.dpkg-new': unexpected end of file or stream

And i see that size of the downloaded file is about 26 Mb. Tried many times using different PCs.