flannel icon indicating copy to clipboard operation
flannel copied to clipboard

flannel crash when using a ppp0 modem interface

Open jswantek opened this issue 3 years ago • 1 comments

Expected Behavior

When having a ppp0 modem interface on my Linux system flannel should not crash when parsing address on startup.

Current Behavior

When starting flannel if a ppp0 modem interface exists in my Linux system, flannel crashes with the following panic when parsing addresses:

I0624 23:06:59.293981   24938 flannel.go:92] Determining IP address of default interface
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

Possible Solution

https://github.com/vishvananda/netlink/pull/665

Steps to Reproduce (for bugs)

  1. Attach modem to USB port and wait for it to enumerate (have no other internet uplink interfaces) (Note: must enumerates as a ppp0 device.)
  2. start flannel (potentially through a service such as k3s)

Context

  • I have a Linux machine that will have (as it's sole connection to the Internet) a modem that enumerates as a ppp device and need to be able to run k3s on that system.
  • This issue will not occur with modems that enumerate as wwan0 devices using the qmi_wwan driver (or equivalent)
  • Issue also reported against:k3s (see: https://github.com/k3s-io/k3s/issues/3512)
  • Issue also reported against: vishvananda/netlink (see: https://github.com/vishvananda/netlink/issues/664)
  • Issue also reported against: kubernetes (see: https://github.com/kubernetes/kubernetes/issues/103280)

Your Environment

  • Flannel version: flannel version within k3s version: v1.20.2+k3s1 (1d4adb0)
  • Backend used (e.g. vxlan or udp): vxlan
  • Etcd version:
  • Kubernetes version (if used): k3s version: v1.20.2+k3s1 (1d4adb0)
  • Operating System and version:
Linux ws-nxcore-000048B02D0766CD 4.9.140-tegra #1 SMP PREEMPT Thu Jun 17 21:46:37 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic
  • Link to your project (optional):

jswantek avatar Jun 29 '21 19:06 jswantek

The proposed solution https://github.com/vishvananda/netlink/pull/665 does address the immediate panic but it was later discovered that lacking an IFA_ADDRESS (which can be easily seen using https://github.com/Yourens/rtnetlinkexample/blob/master/if_show.c) results in other downstream problems.

Jun 29 21:16:36 ws-nxcore-000048B02D0766CD bash[4543]: E0629 21:16:36.736218    4543 remote_runtime.go:116] RunPodSandbox from runtime service failed: rpc error: code = Unknown desc = failed to setup network for sandbox "c246d0f2899b3a6c0e83c2e03fafcebbd5ada9eb54f349c970142127624fb83a": netplugin failed with no error message
Jun 29 21:16:36 ws-nxcore-000048B02D0766CD bash[4543]: E0629 21:16:36.739284    4543 kuberuntime_sandbox.go:70] CreatePodSandbox for pod "coredns-854c77959c-8p7nv_kube-system(0295c50f-8c65-42ef-964e-b97cee322658)" failed: rpc error: code = Unknown desc = failed to setup network for sandbox "c246d0f2899b3a6c0e83c2e03fafcebbd5ada9eb54f349c970142127624fb83a": netplugin failed with no error message
Jun 29 21:16:36 ws-nxcore-000048B02D0766CD bash[4543]: E0629 21:16:36.739356    4543 kuberuntime_manager.go:755] createPodSandbox for pod "coredns-854c77959c-8p7nv_kube-system(0295c50f-8c65-42ef-964e-b97cee322658)" failed: rpc error: code = Unknown desc = failed to setup network for sandbox "c246d0f2899b3a6c0e83c2e03fafcebbd5ada9eb54f349c970142127624fb83a": netplugin failed with no error message
Jun 29 21:16:36 ws-nxcore-000048B02D0766CD bash[4543]: E0629 21:16:36.739554    4543 pod_workers.go:191] Error syncing pod 0295c50f-8c65-42ef-964e-b97cee322658 ("coredns-854c77959c-8p7nv_kube-system(0295c50f-8c65-42ef-964e-b97cee322658)"), skipping: failed to "CreatePodSandbox" for "coredns-854c77959c-8p7nv_kube-system(0295c50f-8c65-42ef-964e-b97cee322658)" with CreatePodSandboxError: "CreatePodSandbox for pod \"coredns-854c77959c-8p7nv_kube-system(0295c50f-8c65-42ef-964e-b97cee322658)\" failed: rpc error: code = Unknown desc = failed to setup network for sandbox \"c246d0f2899b3a6c0e83c2e03fafcebbd5ada9eb54f349c970142127624fb83a\": netplugin failed with no error message"

jswantek avatar Jul 02 '21 23:07 jswantek

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 25 '23 21:01 stale[bot]