-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
fix DualMode ReceiveFrom on macOS #78261
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue Detailsfixes #26867
|
Co-authored-by: Ahmet Ibrahim AKSOY <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some accidental changes, otherwise LGTM.
printf("%s:%d: recvmsg name %p %d socksize=%zd\n", __func__, __LINE__, header.msg_name, header.msg_namelen, sizeof(struct sockaddr_in6)); | ||
while ((res = recvmsg(fd, &header, socketFlags)) < 0 && errno == EINTR); | ||
|
||
printf("%s:%d: recvmsg finished with %zd name %p %d\n", __func__, __LINE__, res, header.msg_name, header.msg_namelen); | ||
printf("%s:%d: poer=%du addr (%s)\n", __func__, __LINE__, ((struct sockaddr_in*)header.msg_name)->sin_port, inet_ntoa(((struct sockaddr_in*)header.msg_name)->sin_addr)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also looks like leftover from local debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do you see it @antonfirsov. This was removed yesterday in 70a11fa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea how I ended up commenting on the outdated variant.
fixes #26867
The ReceiveFrom works on macOs. The problem is that when the remote address is IPv4 on DualMode socket it comes back as plain old IPv4 so we fail to create the endpoint. It does come as IPv4Mapped Ipv6 address on Linux & Windows.
My initial fix was just to handle it as IPv4 but for consistency I decided to turn it into mapped address as well.
That should match
LocalEndpoint
andRemoteEndPoint
onDualMode
Socket
that also comes as mapped addresses.