@database64128 requested issue #74841 to be considered for backport to the next 1.25 minor release.
@gopherbot please open backport issues. Now this is a tough one compared to #74737.
In user code, the same code path usually needs to handle both connected and unconnected sockets. There's no workaround other than checking and not using
WriteMsgUDPAddrPortwhen the address is zero value. This is quite ugly.
go n, cmsgn, err := c.WriteMsgUDPAddrPort(b, cmsg, ap) if err != nil {}becomes:
go var ( n int cmsgn int err error ) // Long explanation here... if ap.IsValid() { n, cmsgn, err = c.WriteMsgUDPAddrPort(b, cmsg, ap) } else { n, cmsgn, err = c.WriteMsgUDP(b, cmsg, nil) } if err != nil {}The fix involves 3 separate CLs, touching
internal/pollandsyscall. Changes in these packages are mostly adding nil checks though, so risks should be low.