Help me build OpenWrt with MPTCP?

I've tried to add MPTCP functionality to Openwrt for some time now, and I have never been able to make it compile. I'm not that familiar with patching kernels at all. Is there someone out there knowledgeable enough who can help me out to build an OpenWrt kernel that support ath79 build target (for D-Link C1), and MPTCP?

Just checking you’ve already seen mwan3? Sounds similar..

If not, can you post a link to the package/implementation you’re trying to compile? What’s the minimum kernel version needed ?

I've looked at mwan3, and yeah, it's similar but this is more advanced. While mwan3 allows load balancing, mptcp has the same functionality, but takes it a step further. You can blend two or more internet connections into one, literally. I've used two internet connections to test, and it's working. When I download a file, stream, browse or do anything that uses TCP, the two connections are used. You can basically mash up together as many interfaces as you can to form one huge internet pipe. I did my testing on my Linux laptop, and now I am trying to get it to work on Openwrt.

There is a version of Openwrt with mptcp support here but it seems to be an abandoned project, uses a very old kernel. I am trying to achieve whatever those guys did, just on a new kernel.

I think the way to achieve this is this:

  1. Download Openwrt sources
  2. Download an apply the patches for the corresponding kernel version from here
  3. Compile and that's it!

I am stuck at step 2. If I try to patch a kernel supported by Openwrt, the mptcp and openwrt-specific patches won't patch. On the other hand, if I try a version higher than what Openwrt supports, it will patch successfully, but won't compile due to various errors. Anyway, even if it did, the kernel wouldn't have Openwrt-specific patches, which mean's it won't even boot up on the router.

Here's some more information on this subject:

Wiki https://en.wikipedia.org/wiki/Multipath_TCP

Website of the MPTCP project https://multipath-tcp.org/pmwiki.php/Main/HomePage

Article https://www.tessares.net/mptcp-deployment-options/

An organization using the tech in Norway https://www.nntb.no/home/

Checking if your device is using MPTCP http://amiusingmptcp.de/

MPTCP Blog http://blog.multipath-tcp.org/blog/html/page3.html

Apple using it http://blog.multipath-tcp.org/blog/html/2018/12/15/apple_and_multipath_tcp.html

2 Likes

This looks cool.

I’ve only dabbled in kernel stuff, but it looks like those patches reference the kernel version (and maybe also a hash commit). openwrt is now on 4.19 so if I’m right you’d need this patch: http://multipath-tcp.org/patches/mptcp-v4.19-dc1745e03e12.patch Is this the patch you’re trying to apply?

If yes, and you’re still getting errors when applying the patch, can you post those within a </> code block ?

1 Like

on a node with Master kernel 4.19.85 mptcp_enabled is not recognized. It is also absent from https://github.com/torvalds/linux/blob/master/Documentation/networking/ip-sysctl.txt

Yup, that's the patch I was trying to apply. I also tried using different kernels with their corresponding patches from multipath-tcp.org but they also would not work. I have tried compiling with the patch, I get this:

make[5]: Entering directory '/home/claymore/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/linux-4.19.79'
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CC      net/ipv4/tcp_output.o
net/ipv4/tcp_output.c:434:8: error: redefinition of 'struct tcp_out_options'
 struct tcp_out_options {
        ^~~~~~~~~~~~~~~
In file included from ./include/net/tcp.h:24,
                 from net/ipv4/tcp_output.c:39:
./include/linux/tcp.h:86:8: note: originally defined here
 struct tcp_out_options {
        ^~~~~~~~~~~~~~~
make[7]: *** [scripts/Makefile.build:304: net/ipv4/tcp_output.o] Error 1
make[6]: *** [scripts/Makefile.build:544: net/ipv4] Error 2
make[5]: *** [Makefile:1046: net] Error 2

Yeah, it's not yet in Openwrt. That's why I am trying to add it in there

Maybe the patch didn't apply correctly? That struct is supposed to be gone from tcp_output.c

I totally have no idea. I get that error after thousands of lines have been printed to the console, I don't even know if the patches got applied? Would you mind trying it on your machine? Once I get to know how you tackle that error, I can just replicate the exact same thing on my computer.

Did you apply the patch to openwrt's 4.19 sources?

Yeah. 4.19

Well anyway the patch doesn't seem to be compatible with the kernel sources that openwrt is using.
I can't tell which version it was made for either. Apparently it's 4.19.80? openwrt uses 4.19.88

That's what I thought too. I know for sure Openwrt uses 4.19.88 but I have no idea what 4.19.xx the MPTCP is using

For resolving kernel-patch issues, see https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem#adding_or_editing_kernel_patches for the steps to walk through the patching sequence.

I'll look at that, thanks!

Well I can't figure out what kernel version that patch was meant for. Here's what I tried:
You need to revert openwrt sources to back when it was using 4.19.80 first (commit 4b2ab533d404784b2c708114032864271f53a062). Then create a diff between sources for linux 4.19.80 and mptcp 0.95. Then use that as a patch for the generic target (I just dropped the file into target/linux/generic/pending-4.19/, didn't use quilt).
It compiled fine.

Damn. Could you just send the patch you created? I have PM'd you my email. I of course will be researching later on to see what you did so I can replicate, but at the moment, I am too "newbie" to really do it properly.

Here's the patch: https://gist.github.com/5685C4A059D5/ef35970f975071f058514ccae1423942/raw/9aed4b6639fc4cdf3f0a49a16fc15f86b1691ece/900-mptcp.patch
Remember you need 4.19.80

I tried that. The patch actually patches, but further down in compilation, I get this error:

make[5]: Entering directory '/home/claymore/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/linux-4.19.80'
  CALL    scripts/checksyscalls.sh
  HOSTCC  scripts/extract-cert
/usr/bin/ld: /home/claymore/openwrt/tmp/ccKn8Vya.o: in function `main':
extract-cert.c:(.text.startup+0x1e): undefined reference to `OPENSSL_add_all_algorithms_noconf'
/usr/bin/ld: extract-cert.c:(.text.startup+0x23): undefined reference to `ERR_load_crypto_strings'
collect2: error: ld returned 1 exit status

No idea then, can you upload your .config file somewhere?
I also forgot to mention that you need to run make kernel_menuconfig and actually enable mptcp.