netlink
netlink copied to clipboard
ppp0 modem interface causes parseAddr panic
The parseAddr function (https://github.com/vishvananda/netlink/blob/master/addr_linux.go#L216) assumes that the unix.IFA_ADDRESS
case will be hit, setting a valid value to the dst
variable. However, if the unix.IFA_ADDRESS
case is not hit then dst
will remain unset (null) and cause a panic (https://github.com/vishvananda/netlink/blob/master/addr_linux.go#L271).
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1a31f90]
goroutine 20887 [running]:
github.com/rancher/k3s/vendor/github.com/vishvananda/netlink.parseAddr(0x400648bdec, 0x40, 0x40, 0x0, 0x400867a0a8, 0x4, 0x280, 0x0, 0x0, 0x400648be00, ...)
/go/src/github.com/rancher/k3s/vendor/github.com/vishvananda/netlink/addr_linux.go:274 +0x170
github.com/rancher/k3s/vendor/github.com/vishvananda/netlink.(*Handle).AddrList(0x6721590, 0x43eff40, 0x400f0859e0, 0x2, 0x0, 0x4, 0x2bc, 0xfe, 0x1)
/go/src/github.com/rancher/k3s/vendor/github.com/vishvananda/netlink/addr_linux.go:199 +0x180
github.com/rancher/k3s/vendor/github.com/vishvananda/netlink.AddrList(...)
/go/src/github.com/rancher/k3s/vendor/github.com/vishvananda/netlink/addr_linux.go:174
github.com/rancher/k3s/vendor/github.com/coreos/flannel/pkg/ip.getIfaceAddrs(0x400e1e22c0, 0x0, 0x0, 0x0, 0x0, 0x0)
/go/src/github.com/rancher/k3s/vendor/github.com/coreos/flannel/pkg/ip/iface.go:36 +0x68
github.com/rancher/k3s/vendor/github.com/coreos/flannel/pkg/ip.GetIfaceIP4Addr(0x400e1e22c0, 0x0, 0x0, 0x400775ee08, 0x1, 0x1)
/go/src/github.com/rancher/k3s/vendor/github.com/coreos/flannel/pkg/ip/iface.go:40 +0x30
github.com/rancher/k3s/pkg/agent/flannel.LookupExtIface(0x400e1e22c0, 0x75ff34, 0x400cd82f08, 0x75f90c)
/go/src/github.com/rancher/k3s/pkg/agent/flannel/flannel.go:100 +0xa8
github.com/rancher/k3s/pkg/agent/flannel.flannel(0x444d740, 0x4000e58c00, 0x0, 0x4006a5dd40, 0x34, 0x400b2e43f0, 0x2d, 0x1, 0x0)
/go/src/github.com/rancher/k3s/pkg/agent/flannel/flannel.go:43 +0x28
github.com/rancher/k3s/pkg/agent/flannel.Run.func1(0x444d740, 0x4000e58c00, 0x4005df4380)
/go/src/github.com/rancher/k3s/pkg/agent/flannel/setup.go:98 +0x5c
created by github.com/rancher/k3s/pkg/agent/flannel.Run
/go/src/github.com/rancher/k3s/pkg/agent/flannel/setup.go:97 +0x290
The above stack is a running of flannel (via k3s) that makes use of the netlink library to parse all the host system network routes/addresses. In the event that a ppp0 modem interface exists the above panic occurs.
IP routing information
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 700 0 0 ppp0
10.31.81.0 0.0.0.0 255.255.255.0 U 101 0 0 lan0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
32: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 3
link/ppp
inet 10.206.144.193/32 brd 10.206.144.193 scope global noprefixroute ppp0
valid_lft forever preferred_lft foreve
See the k3s tracked issue for more details: https://github.com/k3s-io/k3s/issues/3512
Proposed fix: https://github.com/vishvananda/netlink/pull/665
I can confirm that https://github.com/vishvananda/netlink/pull/665 fixed the issue.