[release/6.0-rc2] [iOS] Make sure IPGlobalProperties and NetworkInterface.GetIsNetwor...
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Tue, 21 Sep 2021 20:42:06 +0000 (16:42 -0400)
committerGitHub <noreply@github.com>
Tue, 21 Sep 2021 20:42:06 +0000 (16:42 -0400)
commit8e3a1fbb503a27f485029cee00d91e465a5472f5
treeac30b6ab98f44e1d65271ea1d28a7fed031fba69
parent307d945acfd64e832b33168204286f0e15d0bcf5
[release/6.0-rc2] [iOS] Make sure IPGlobalProperties and NetworkInterface.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
12 files changed:
src/libraries/Native/Unix/Common/pal_config.h.in
src/libraries/Native/Unix/System.Native/ios/net/if_media.h [new file with mode: 0644]
src/libraries/Native/Unix/System.Native/ios/netinet/icmp_var.h [new file with mode: 0644]
src/libraries/Native/Unix/System.Native/ios/netinet/ip_var.h [new file with mode: 0644]
src/libraries/Native/Unix/System.Native/ios/netinet/tcp_fsm.h [new file with mode: 0644]
src/libraries/Native/Unix/System.Native/ios/netinet/udp_var.h [new file with mode: 0644]
src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c
src/libraries/Native/Unix/System.Native/pal_networkstatistics.c
src/libraries/Native/Unix/System.Native/pal_tcpstate.c
src/libraries/Native/Unix/configure.cmake
src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs
src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs