{"record":{"id":"459a7dd8c5e44b14","repo":"slackhq/nebula","slug":"unsupported-sock-type-t","errorCode":null,"errorMessage":"unsupported sock type: %T","messagePattern":"unsupported sock type: %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"udp/udp_linux.go","lineNumber":173,"sourceCode":"\treturn unix.GetsockoptInt(u.sysFd, unix.SOL_SOCKET, unix.SO_SNDBUF)\n}\n\nfunc (u *StdConn) GetSoMark() (int, error) {\n\treturn unix.GetsockoptInt(u.sysFd, unix.SOL_SOCKET, unix.SO_MARK)\n}\n\nfunc (u *StdConn) LocalAddr() (netip.AddrPort, error) {\n\tsa, err := unix.Getsockname(u.sysFd)\n\tif err != nil {\n\t\treturn netip.AddrPort{}, err\n\t}\n\tswitch sa := sa.(type) {\n\tcase *unix.SockaddrInet4:\n\t\treturn netip.AddrPortFrom(netip.AddrFrom4(sa.Addr), uint16(sa.Port)), nil\n\tcase *unix.SockaddrInet6:\n\t\treturn netip.AddrPortFrom(netip.AddrFrom16(sa.Addr), uint16(sa.Port)), nil\n\tdefault:\n\t\treturn netip.AddrPort{}, fmt.Errorf(\"unsupported sock type: %T\", sa)\n\t}\n}\n\n// recvmmsg does one blocking recvmmsg (MSG_WAITFORONE), reading up to len(msgs) datagrams.\nfunc (u *StdConn) recvmmsg(msgs []rawMessage) (int, error) {\n\tr, _, errno := unix.Syscall6(\n\t\tunix.SYS_RECVMMSG,\n\t\tuintptr(u.sysFd),\n\t\tuintptr(unsafe.Pointer(&msgs[0])),\n\t\tuintptr(len(msgs)),\n\t\tunix.MSG_WAITFORONE,\n\t\t0,\n\t\t0,\n\t)\n\tif errno != 0 {\n\t\tif u.closed.Load() {\n\t\t\treturn 0, net.ErrClosed\n\t\t}","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/udp/udp_linux.go#L155-L191","documentation":"LocalAddr converts a unix.Sockaddr returned by getsockname into a netip.AddrPort; if the kernel returns a sockaddr type it does not handle (anything other than SockaddrInet4 or SockaddrInet6), it returns this error including the Go type. This should be practically unreachable on Linux and indicates an unexpected kernel/golang.org/x/sys behavior.","triggerScenarios":"Calling StdConn.LocalAddr() when unix.Getsockname returns a sockaddr type other than *unix.SockaddrInet4 or *unix.SockaddrInet6 (e.g. an AF_UNIX or unexpected family).","commonSituations":"Very old or patched x/sys/unix versions surfacing a different concrete sockaddr type; running code modified to create non-INET sockets; upstream bug reports of impossible states.","solutions":["Confirm the socket fd was created as AF_INET/AF_INET6 by udp.NewListener and not modified","Upgrade golang.org/x/sys to a current version and rebuild","File a bug with the Go kernel socktype printed in the error (%T) if it occurs on stock code","As a workaround, cache the AddrPort from listener setup instead of querying LocalAddr at runtime"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"ap, err := u.LocalAddr()\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"unsupported sock type\") {\n        // fall back to the AddrPort captured at listener creation\n        ap = configuredListenAddr\n    }\n    log.Warn(\"LocalAddr failed\", \"err\", err)\n}","preventionTips":["Keep golang.org/x/sys/unix up to date","Only call LocalAddr on StdConn objects created by NewListener","Pin to released nebula versions; treat this error as a bug and report with the %T value","Cache the configured listen AddrPort instead of re-querying"],"tags":["udp","linux","localaddr","sockaddr","unreachable"],"backgroundTag":"unsupported-socket-type","analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}