net: handle IP interface stack correctly on linux
A configuration like the following:
7: tun6rd: <NOARP,UP,LOWER_UP> mtu 1280
link/sit 10.11.12.13 brd 0.0.0.0
inet 1.2.3.4/24 scope global tun6rd
inet6 2014:1001:a0b:c0d::1/32 scope global
inet6 ::10.11.12.13/128 scope global
9: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1496
link/ppp
inet 192.168.101.234 peer 192.168.102.234/32 scope global ppp0
inet 10.20.30.40/24 scope global ppp0
inet6 2014:1002::1/64 scope global
11: tun0@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1480
link/ipip 192.168.202.34 peer 192.168.202.69
inet 192.168.10.1/24 scope global tunnel0
inet6 2014:1003::1/64 scope global
will be handled like below.
"tun6rd": flags "up", ifindex 7, mtu 1280
hardware address ""
interface address "1.2.3.4/24"
interface address "2014:1001:a0b:c0d::1/32"
interface address "::a0b:c0d/128"
"ppp0": flags "up|pointtopoint|multicast", ifindex 9, mtu 1496
hardware address ""
interface address "192.168.101.234/32"
interface address "10.20.30.40/24"
interface address "2014:1002::1/64"
"tun0": flags "up|pointtopoint", ifindex 11, mtu 1480
hardware address ""
interface address "192.168.10.1/24"
interface address "2014:1003::1/64"
Fixes #6433.
Update #4839
LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/
57700043