IPv6 support is broken on old kernels without support for extended IFA_FLAGS
I've been working on an Ubuntu Touch phone for a relative for a while. It's an ex-Android device, locked in to a 3.4.0 "Linux" kernel without any perspective of ever updating that.
The userland is Ubuntu 16.04 with NetworkManager 1.2.2. It generally works well, except for IPv6 support being completely broken in NetworkManager, but working normally when invoking dhclient -6.
After connecting to the network (which offers DHCP, DHCPv6 and SLAAC RA's), only an IPv4 lease is successfully obtained. dhclient6 is invoked by NetworkManager, it does write to a lease file successfully, and it is even able to set up IPv6 routes. However, assigning the IPv6 addresses to the interface fails.
I get many errors in the syslog, two of them being most prominent:
platform-linux: do-add-ip6-address[21: 2001:dead:beef::6e2]: failure 22 (Invalid argument)
and
The kernel does not support extended IFA_FLAGS needed by NM for IPv6 private addresses. This feature is not available.
Currently my rather ugly workaround is adding a file in the dispatcher.d directory that spawns another dhclient -6 process, after which at least DHCPv6 works somewhat reliably:
#!/bin/bash
IF=$1
STATUS=$2
if [ "$IF" == "wlan0" ]
then
case "$STATUS" in
up)
logger -s "Running dhclient to work around IPv6 bug..."
dhclient -6 -N "$IF" -pf /var/run/dhclient6-ipv6-workaround-"$IF".pid -lf /var/lib/NetworkManager/dhclient6-ipv6-workaround-"$IF".lease -cf /var/lib/NetworkManager/dhclient6-"$IF".conf
;;
down)
dhclient -x -pf /var/run/dhclient6-ipv6-workaround-"$IF".pid
;;
esac
fi
However, this does not solve other problems like OpenVPN not setting its IPv6 address and is in general just not very nice.
Apparently an Ubuntu developer (back when Canonical still supported Ubuntu Touch) had contact with the NetworkManager project about this in the past: https://mail.gnome.org/archives/networkmanager-list/2016-May/msg00025.html
And it seems that not only Ubuntu Touch is affected, but pretty much everything that is locked to an old Android kernel like 3.4 and running NetworkManager has problems with IPv6:
https://forum.odroid.com/viewtopic.php?t=27378
https://gitlab.com/postmarketOS/pmaports/issues/148
https://www.bountysource.com/issues/53967509-network-manager-warnings-about-ipv6
According to a UBports developer, "nobody knows what's wrong": https://github.com/ubports/ubuntu-touch/issues/116#issuecomment-594218609
I was wondering if this is still the case. Does anybody know a way around the lack of support for extended IFA_FLAGS to get IPv6 address assignment working normally. It is safe to assume that patching the kernel, let alone upgrading it, is virtually impossible on these devices.