Adding MPTCP and 0-RTT Converter Protocol Support to the Xiaomi Pocophone F1

A step-by-step guide on how to Enable open source MPTCP and 0-RTT support on the Xiaomi Pocophone F1…

To get the same environment as the one used to do the experiments presented in our blog Demonstrating Wi-Fi Cellular Convergence, you will need to set up a smartphone with MultiPath TCP (MPTCP) and 0-RTT Converter Protocol support.

Smartphone selection

First, we need to select a smartphone. Most smartphones today do not support MPTCP out-of-the-box. Some models support it — some Samsung, LG, Huawei, etc. — but very likely, its usage is restricted to specific applications. Unless you have  “root permissions”, you will not be able to use MPTCP with your apps.

For this experiment, it is necessary to modify an existing phone to add MPTCP support in the kernel. We picked the Xiaomi Pocophone F1 because it is known to be developer friendly, it has a recent enough kernel (4.9) and it is available on the market.

 

Here are the instructions to enable MPTCP support on this phone:

Add MPTCP support

On this PocoF1 phone, you will need to:

  1. Unlock the bootloader: that will erase all data on the phone but allow you to install other ROMs and kernels
  2. Install a custom recovery: the one for Lineage OS or TWRP, to be able to easily install a ROM or a kernel
  3. Install a custom version of Lineage OS 16 we built supporting MPTCP
  4. Install an add-on to get Root permissions: “su” or “Magisk”, to configure the kernel
  5. Optionally, install the Google Apps that are required by some applications

 

For the 3 first steps, the easiest way is to follow this guide: https://wiki.lineageos.org/devices/beryllium/install

 

Instead of installing the latest official Lineage OS version, install the one we built with MPTCP support: https://github.com/Tessares/android_kernel_xiaomi_sdm845/releases/tag/v4.9.169-mptcp

 

For steps 4 and 5, you can “adb sideload” the downloaded file, similar to what was done to install the ROM at the 3rd step. The links are provided here above.

 

Note that if you wish to build the whole image yourself, please follow this other guide: https://wiki.lineageos.org/devices/beryllium/build

You will need to follow the instructions to build Lineage OS 16 and replace the official kernel repo located in kernel/xiaomi/sdm845 folder by this one: https://github.com/Tessares/android_kernel_xiaomi_sdm845/tree/lineage-16.0-mptcp

 

Kernel configuration

First set SELinux to Permissive mode to be able to create any subflows without issues. You can do it using an app like SELinuxModeChanger.

To do the following modifications, you can:

 

You will likely need to set up routing rules to properly use each path as expected. For that, you can execute with the “root” user the script “ip_rule.sh” from https://github.com/Tessares/android_kernel_xiaomi_sdm845/releases/tag/v4.9.169-mptcp. You might have to re-launch this script each time a modification in the network is done.

 

Also you might want to configure some sysctl, e.g.

 

  • net.mptcp.mptcp_enabled=2 ## only apps asking for MPTCP uses it
  • net.mptcp.mptcp_path_manager=fullmesh ## create subflows
  • net.mptcp.mptcp_checksum=0 ## if you are in a controlled environment
  • net.ipv4.tcp_fastopen=5 ## For the 0-RTT Convert protocol

 

Add 0-RTT Converter Protocol

On the smartphone, we need to install a proxy to intercept the TCP connections and create new MPTCP connections to a HAG proxy server.

ShadowSocks App

For that, we need to install a modified version of ShadowSocks for Android. We can find it here: https://github.com/Tessares/shadowsocks-android/releases/tag/v4.7.4-converter

For the PocoF1, you can download the arm64 version. Once downloaded on the smartphone, click on it to install it or use “adb install -r <apk>“ from your computer.

 

If you wish to build this app yourself, you can follow the instructions from the README file or import the repo in Android Studio.

 

ShadowSocks configuration

Start by creating a new profile (the “+” at the top right), choose “Manual settings” and set:

  • A profile name, up to you
  • The IP of the HAG
  • The port of the HAG
  • Authentication: Plain
  • Route: All
  • All other settings in “Feature Settings” section can be disabled
  • No plugin
  • No UDP fallback

In the settings of the application (“hamburger” button at the top left, “Settings”), make sure:

  • TCP Fast Open is On
  • “Service mode” in the “Advanced Settings” section is set to “VPN”

You can now go back to the main window:

  • Select your new profile
  • Press the “flight” icon (bottom of the screen, in the middle)
  • The first time, you should get a prompt asking if you are sure you want to enable the VPN mode: yes you are!
  • A “key” icon should be visible at the top right of the screen.

After a reboot, only the last step is needed except if you have enabled the “Auto Connect” option in the settings.

 

That’s it, you have enabled MPTCP and 0-RTT on the Xiaomi Pocophone F1 and are ready to try it out!

By Matthieu Baerts

  • Share