netlink icon indicating copy to clipboard operation
netlink copied to clipboard

netlink.LinkSubscribe panics on UniFi Cloud Gateway Fiber

Open cuonglm opened this issue 6 months ago • 0 comments

Hello,

Our project use netlink library to monitor network changes, the code is straight and simple:

https://github.com/Control-D-Inc/ctrld/blob/b9ece6d7b902e9a53f0e1e7618f6bd92eeae2b04/cmd/cli/netlink_linux.go#L14

However, on Ubiquiti Cloud Gateway Fiber device, we received report from our users that the binary panic with this stacktrace:

Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: Jun 29 07:19:57.286 INF [e322ab] REPLY: upstream.0 -> [Edited IP]:33378 (UCG-Fiber): NOERROR
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: Jun 29 07:19:57.286 DBG [e322ab] received response of 78 bytes in 61.225646ms
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: panic: runtime error: slice bounds out of range [:16] with capacity 4
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: goroutine 123 [running]:
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: github.com/vishvananda/netlink/nl.DeserializeIfInfomsg(...)
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]:         /go/pkg/mod/github.com/vishvananda/[email protected]/nl/nl_linux.go:165
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: github.com/vishvananda/netlink.linkSubscribeAt.func2()
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]:         /go/pkg/mod/github.com/vishvananda/[email protected]/link_linux.go:2152 +0x2d8
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]: created by github.com/vishvananda/netlink.linkSubscribeAt in goroutine 119
Jun 29 07:19:57 UCG-Fiber ctrld[1750167]:         /go/pkg/mod/github.com/vishvananda/[email protected]/link_linux.go:2120 +0x2b0
Jun 29 07:19:57 UCG-Fiber systemd[1]: ctrld.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jun 29 07:19:57 UCG-Fiber systemd[1]: ctrld.service: Failed with result 'exit-code'.
Jun 29 07:19:57 UCG-Fiber systemd[1]: ctrld.service: Consumed 1.029s CPU time.
Jun 29 07:21:57 UCG-Fiber systemd[1]: ctrld.service: Scheduled restart job, restart counter is at 2.
Jun 29 07:21:57 UCG-Fiber systemd[1]: Stopped A highly configurable, multi-protocol DNS forwarding proxy.
Jun 29 07:21:57 UCG-Fiber systemd[1]: ctrld.service: Consumed 1.029s CPU time.
Jun 29 07:21:57 UCG-Fiber systemd[1]: Started A highly configurable, multi-protocol DNS forwarding proxy.

It seems to me that either netlink does not handle the message correctly, or the kernel on Ubiquiti Cloud Gateway Fiber may return an invalid message.

cuonglm avatar Jun 30 '25 07:06 cuonglm