-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UDP RemoteAddr() returns always (wrong) IPv6 #35
Comments
Hi @darinkes |
According to tcpdump its an IPv4 connection from 127.0.0.1 to 127.0.0.1. [::7f00:1] is the result of mangled data cause of the bug in
|
BTY, you could update to the latest code of gnet and try it again, let's see whether the issue still exists. |
func (this *Server) OnInitComplete(srv gnet.Server) (action gnet.Action) {
log.Debugf("Server is listening on %s (multi-cores: %t, loops: %d)", srv.Addr.String(), srv.Multicore, srv.NumLoops)
return
}
func (this *Server) React(c gnet.Conn) (out []byte, action gnet.Action) {
log.Debugf("%v -> %v", c.RemoteAddr(), c.LocalAddr())
} Results in 2019-11-11 15:25:15 [DEBUG] (udp/server): Server is listening on 127.0.0.1:5555 (multi-cores: true, loops: 24)
2019-11-11 15:25:16 [DEBUG] (udp/server): [::7f00:1]:55170 -> 127.0.0.1:5555 I saw you fixed it in master now: ec7bd36 👍 |
checked out master and now it shows 2019-11-11 15:44:00 [DEBUG] (udp/server): 127.0.0.1:44772 -> 127.0.0.1:5555 Thanks for fixing this so quick |
Describe the bug
gnet.Conn.RemoteAddr() returns always IPv6 for UDP.
E.g. [::7f00:1]:52815 instead of 127.0.0.1:52815
To Reproduce
Expected behavior
Correct RemoteAddr
System Info (please complete the following information):
Additional context
in eventloop.go SockaddrToUDPAddr gets always called with sa6 = unix.SockaddrInet6
in netpoll/socktoaddr.go
So you always get an SockaddrInet converted to SockaddrInet6 for UDP.
The text was updated successfully, but these errors were encountered: