-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[iOS] Make sure IPGlobalProperties and NetworkInterface.GetIsNetworkAvailable methods return the correct info #57096
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
Conversation
…vailable methods return the correct info This change makes sure some of the IPGlobalProperties stop throwing exceptions and return the correct values. - GetIPv4GlobalStatistics, GetIcmpV4Statistics, GetTcpIPv4Statistics, GetUdpIPv4Statistics no longer throw NetworkInformationException. - GetActiveTcpConnections no longer returns TcpConnectionInformation instances only with the State of Unknown. - GetActiveTcpListeners return the correct IPEndPoint details for the IPV6 loopback. - NetworkInterface.GetIsNetworkAvailable no longer returns false for every call. The reason these methods were behaving incorrectly on iOS is due to Apple not including the public headers for icmp_var.h, ip_var.h, tcp_fsm.h, if_media.h, and udp_var.h in the iOS SDK. This would lead to, for example, pal_tcpstate.c always returning TcpState_Unknown even if the underlying native value was TCPS_ESTABLISHED. This change includes the missing public headers in our build. Fixes dotnet#36890
Tagging subscribers to this area: @dotnet/ncl Issue DetailsThis change makes sure some of the IPGlobalProperties stop throwing exceptions and return the correct values.
The reason these methods were behaving incorrectly on iOS is due to Apple not including the public headers for icmp_var.h, ip_var.h, tcp_fsm.h, if_media.h, and udp_var.h in the iOS SDK. This would lead to, for example, pal_tcpstate.c always returning TcpState_Unknown even if the underlying native value was TCPS_ESTABLISHED. This change includes the missing public headers in our build. Fixes #36890
|
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.
LGTM.
I'm wondering if we would know if the headers ever change and the structures no longer match....
* may not be used to create, or enable the creation or redistribution of, | ||
* unlawful or unlicensed copies of an Apple operating system, or to | ||
* circumvent, violate, or enable the circumvention or violation of, any | ||
* terms of an Apple operating system software license agreement. |
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.
Just want to make sure this license is compatible with our repo...
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.
I was using https://github.com/dotnet/runtime/blob/main/src/libraries/Native/Unix/System.Native/ios/net/route.h as precedent, but it does not hurt to double check.
/cc @richlander
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.
Just curious, why is it necessary to commit the Apple headers? Aren't they available in their SDK during build, similar to winnt.h etc?
@omajid do you consider this an acceptable license? I assume so since as @steveisok points out we already have such code.
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.
I wasn't sure, so I went looking.
https://www.gnu.org/philosophy/apsl.en.html says:
The Apple Public Source License (APSL) version 2.0 qualifies as a free software license.
It's in the OSI list too: https://opensource.org/licenses/APSL-2.0
Fedora considers this license as okay too: https://fedoraproject.org/wiki/Licensing:Main#Good_Licenses (search for "APSL 2.0" in the table). Red Hat legal has approved it for RHEL as well.
All this is for the 2.0 variant. The opinion on 1.x seems to be that it's not acceptable.
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.
Just curious, why is it necessary to commit the Apple headers? Aren't they available in their SDK during build, similar to winnt.h etc?
@omajid do you consider this an acceptable license? I assume so since as @steveisok points out we already have such code.
It's unknown exactly why they are excluded from the iOS SDK. The likely explanation is that Apple can more easily move on from supporting them.
Marking no merge while we check with @richlander . Since I'm fixing another incorrect license in a PR at the moment! |
@richlander Can you give this a look as I'd like to make sure the licensing is ok before merging. |
@steveisok any update here? |
@karelz I'm waiting on the go-ahead from @richlander re: the license files. |
LGTM. It looks like @omajid is also happy so that covers it. |
/backport to release/6.0 |
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1242351574 |
/backport to release/6.0-rc2 |
Started backporting to release/6.0-rc2: https://github.com/dotnet/runtime/actions/runs/1245525236 |
…face.GetIsNetworkAvailable methods return the correct info (#59258) Backport of #57096 This change makes sure some of the IPGlobalProperties stop throwing exceptions and return the correct values. GetIPv4GlobalStatistics, GetIcmpV4Statistics, GetTcpIPv4Statistics, GetUdpIPv4Statistics no longer throw NetworkInformationException. GetActiveTcpConnections no longer returns TcpConnectionInformation instances only with the State of Unknown. GetActiveTcpListeners return the correct IPEndPoint details for the IPV6 loopback. NetworkInterface.GetIsNetworkAvailable no longer returns false for every call. The reason these methods were behaving incorrectly on iOS is due to Apple not including the public headers for icmp_var.h, ip_var.h, tcp_fsm.h, if_media.h, and udp_var.h in the iOS SDK. This would lead to, for example, pal_tcpstate.c always returning TcpState_Unknown even if the underlying native value was TCPS_ESTABLISHED. This change includes the missing public headers in our build. Fixes #36890
This change makes sure some of the IPGlobalProperties stop throwing exceptions and return the correct values.
GetIPv4GlobalStatistics, GetIcmpV4Statistics, GetTcpIPv4Statistics, GetUdpIPv4Statistics no longer throw NetworkInformationException.
GetActiveTcpConnections no longer returns TcpConnectionInformation instances only with the State of Unknown.
GetActiveTcpListeners return the correct IPEndPoint details for the IPV6 loopback.
NetworkInterface.GetIsNetworkAvailable no longer returns false for every call.
The reason these methods were behaving incorrectly on iOS is due to Apple not including the public headers for icmp_var.h, ip_var.h, tcp_fsm.h, if_media.h, and udp_var.h in the iOS SDK. This would lead to, for example, pal_tcpstate.c always returning TcpState_Unknown even if the underlying native value was TCPS_ESTABLISHED. This change includes the missing public headers in our build.
Fixes #36890