Question

I know that it is possible to read and set the MTU during runtime e.g. with:

adb shell ip -d -s l l dev rmnet0
adb shell ifconfig rmnet0 mtu <MTU>

This has the problem that the MTU set this way does not hold after restarting the phone.

So how to configure the default MTU for an interface when building your own build with Android Open Source Project sources?

There seems to be no mention about this anywhere and grepping code does not seem to help. Also the default Linux kernel configuration files where this is done do not seem to exist in Android.

There sure must be a way to do this, right?

Was it helpful?

Solution

Apparently PMTUD is a better solution to this (RFC 4821). It can be enabled in AOSP builds in init.rc (e.g. system/core/rootdir/init.rc) by adding following lines at the end of section "on boot":

on boot
# Other configurations here...

# Set TCP MTU Probing to automatic:
    write /proc/sys/net/ipv4/tcp_mtu_probing 1
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top