x/net: Failure to send IPv4 UDP packet on ipv6 socket with ControlMessage #70640
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go version go1.23.2 (Red Hat 1.23.2-1.el9) linux/amd64
Output of
go env
in your module/workspace:What did you do?
The following program successfully receives and sends traffic on both IPv4 and IPv6:
Output when receiving traffic on 127.0.0.1:
Output when receiving traffic on ::1:
When changing
false
totrue
in theSetControlMessage()
call, the program still works on IPv6, but fails on IPv4.Output when receiving traffic on 127.0.0.1:
Output when receiving traffic on ::1:
What did you see happen?
Error when sending traffic to an IPv4 address when
ControlMessage
is used. This is likely because of a confusion in the system call, where the destination address is an IPv4 struct, while the socket options are an IPv6 struct. The fact that the destination address was originally received on an IPv6 socket, and should be passed back into the system as such gets lost.Example system call capture of a failed IPv4 send:
What did you expect to see?
Traffic being able to be sent with both IPv4 and IPv6, as is possible without using
ControlMessage
The text was updated successfully, but these errors were encountered: