net/udprelay: log socket read errors (#16573)

Socket read errors currently close the server, so we need to understand
when and why they occur.

Updates tailscale/corp#27502
Updates tailscale/corp#30118

Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
Jordan Whited 2025-07-15 15:23:47 -07:00 committed by GitHub
parent d65c0fd2d0
commit cb7a0b1dca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -581,6 +581,7 @@ func (s *Server) packetReadLoop(readFromSocket, otherSocket *net.UDPConn) {
// TODO: extract laddr from IP_PKTINFO for use in reply // TODO: extract laddr from IP_PKTINFO for use in reply
n, from, err := readFromSocket.ReadFromUDPAddrPort(b) n, from, err := readFromSocket.ReadFromUDPAddrPort(b)
if err != nil { if err != nil {
s.logf("error reading from socket(%v): %v", readFromSocket.LocalAddr(), err)
return return
} }
s.handlePacket(from, b[:n], readFromSocket, otherSocket) s.handlePacket(from, b[:n], readFromSocket, otherSocket)