Loading Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ filegroup { visibility: [ "//packages/modules/NetworkStack/tests/unit", "//packages/modules/NetworkStack/tests/integration", "//frameworks/base/packages/Tethering/tests/integration", ] } Loading common/captiveportal/src/android/net/captiveportal/CaptivePortalProbeResult.java +5 −4 Original line number Diff line number Diff line Loading @@ -36,10 +36,11 @@ public final class CaptivePortalProbeResult { */ public static final int PARTIAL_CODE = -1; // DNS response with private IP on the probe URL means the network, especially Wi-Fi network is // not connected to the Internet. This code represents the result of a single probe, for correct // logging of the probe results. The result of the whole evaluation would typically be FAILED if // one of the probes returns this status. // DNS response with private IP on the probe URL suggests that the network, especially Wi-Fi // network is not connected to the Internet. This code represents the result of a single probe, // for correct logging of the probe results. The result of the whole evaluation would typically // be FAILED if one of the probes returns this status. // This logic is only used if the config_force_dns_probe_private_ip_no_internet flag is set. public static final int DNS_PRIVATE_IP_RESPONSE_CODE = -2; @NonNull Loading res/values/config.xml +18 −0 Original line number Diff line number Diff line Loading @@ -67,4 +67,22 @@ could result in valid captive portals being incorrectly classified as having no connectivity.--> <bool name="config_force_dns_probe_private_ip_no_internet">false</bool> <!-- Define the min and max range of the content-length that should be in the HTTP response header of probe responses for the validation success/failed regexp to be used. The RegExp will be used to match the probe response content when the content-length is inside this interval(Strictly greater than the config_min_matches_http_content_length and strictly smaller than the config_max_matches_http_content_length). When the content-length is out of this interval, the RegExp will not be used. --> <integer name="config_min_matches_http_content_length">0</integer> <integer name="config_max_matches_http_content_length">0</integer> <!-- A regular expression to match the content of a network validation probe. Treat the network validation as failed when the content matches the config_network_validation_failed_content_regexp and treat the network validation as success when the content matches the config_network_validation_success_content_regexp. If the content matches both of the config_network_validation_failed_content_regexp and the config_network_validation_success_content_regexp, the result will be considered as failed. --> <string name="config_network_validation_failed_content_regexp" translatable="false"></string> <string name="config_network_validation_success_content_regexp" translatable="false"></string> </resources> res/values/overlayable.xml +19 −0 Original line number Diff line number Diff line Loading @@ -18,8 +18,27 @@ <policy type="product|system|vendor"> <!-- Configuration values for NetworkMonitor --> <item type="integer" name="config_captive_portal_dns_probe_timeout"/> <!-- Define the min and max range of the content-length that should be in the HTTP response header of probe responses for the validation success/failed regexp to be used. The RegExp will be used to match the probe response content when the content-length is inside this interval(Strictly greater than the config_min_matches_http_content_length and strictly smaller than the config_max_matches_http_content_length). When the content-length is out of this interval, the RegExp will not be used. --> <item type="integer" name="config_min_matches_http_content_length"/> <item type="integer" name="config_max_matches_http_content_length"/> <item type="string" name="config_captive_portal_http_url"/> <item type="string" name="config_captive_portal_https_url"/> <!-- A regular expression to match the content of a network validation probe. Treat the network validation as failed when the content matches the config_network_validation_failed_content_regexp and treat the network validation as success when the content matches the config_network_validation_success_content_regexp. If the content matches both of the config_network_validation_failed_content_regexp and the config_network_validation_success_content_regexp, the result will be considered as failed. --> <item type="string" name="config_network_validation_failed_content_regexp"/> <item type="string" name="config_network_validation_success_content_regexp"/> <item type="array" name="config_captive_portal_http_urls"/> <item type="array" name="config_captive_portal_https_urls"/> <item type="array" name="config_captive_portal_fallback_urls"/> Loading src/android/net/util/NetworkStackUtils.java +8 −0 Original line number Diff line number Diff line Loading @@ -385,4 +385,12 @@ public class NetworkStackUtils { (address instanceof Inet6Address) ? "[%s]:%d" : "%s:%d", address.getHostAddress(), port); } /** * Return true if the provided address is non-null and an IPv6 Unique Local Address (RFC4193). */ public static boolean isIPv6ULA(@Nullable InetAddress addr) { return addr instanceof Inet6Address && ((addr.getAddress()[0] & 0xfe) == 0xfc); } } Loading
Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ filegroup { visibility: [ "//packages/modules/NetworkStack/tests/unit", "//packages/modules/NetworkStack/tests/integration", "//frameworks/base/packages/Tethering/tests/integration", ] } Loading
common/captiveportal/src/android/net/captiveportal/CaptivePortalProbeResult.java +5 −4 Original line number Diff line number Diff line Loading @@ -36,10 +36,11 @@ public final class CaptivePortalProbeResult { */ public static final int PARTIAL_CODE = -1; // DNS response with private IP on the probe URL means the network, especially Wi-Fi network is // not connected to the Internet. This code represents the result of a single probe, for correct // logging of the probe results. The result of the whole evaluation would typically be FAILED if // one of the probes returns this status. // DNS response with private IP on the probe URL suggests that the network, especially Wi-Fi // network is not connected to the Internet. This code represents the result of a single probe, // for correct logging of the probe results. The result of the whole evaluation would typically // be FAILED if one of the probes returns this status. // This logic is only used if the config_force_dns_probe_private_ip_no_internet flag is set. public static final int DNS_PRIVATE_IP_RESPONSE_CODE = -2; @NonNull Loading
res/values/config.xml +18 −0 Original line number Diff line number Diff line Loading @@ -67,4 +67,22 @@ could result in valid captive portals being incorrectly classified as having no connectivity.--> <bool name="config_force_dns_probe_private_ip_no_internet">false</bool> <!-- Define the min and max range of the content-length that should be in the HTTP response header of probe responses for the validation success/failed regexp to be used. The RegExp will be used to match the probe response content when the content-length is inside this interval(Strictly greater than the config_min_matches_http_content_length and strictly smaller than the config_max_matches_http_content_length). When the content-length is out of this interval, the RegExp will not be used. --> <integer name="config_min_matches_http_content_length">0</integer> <integer name="config_max_matches_http_content_length">0</integer> <!-- A regular expression to match the content of a network validation probe. Treat the network validation as failed when the content matches the config_network_validation_failed_content_regexp and treat the network validation as success when the content matches the config_network_validation_success_content_regexp. If the content matches both of the config_network_validation_failed_content_regexp and the config_network_validation_success_content_regexp, the result will be considered as failed. --> <string name="config_network_validation_failed_content_regexp" translatable="false"></string> <string name="config_network_validation_success_content_regexp" translatable="false"></string> </resources>
res/values/overlayable.xml +19 −0 Original line number Diff line number Diff line Loading @@ -18,8 +18,27 @@ <policy type="product|system|vendor"> <!-- Configuration values for NetworkMonitor --> <item type="integer" name="config_captive_portal_dns_probe_timeout"/> <!-- Define the min and max range of the content-length that should be in the HTTP response header of probe responses for the validation success/failed regexp to be used. The RegExp will be used to match the probe response content when the content-length is inside this interval(Strictly greater than the config_min_matches_http_content_length and strictly smaller than the config_max_matches_http_content_length). When the content-length is out of this interval, the RegExp will not be used. --> <item type="integer" name="config_min_matches_http_content_length"/> <item type="integer" name="config_max_matches_http_content_length"/> <item type="string" name="config_captive_portal_http_url"/> <item type="string" name="config_captive_portal_https_url"/> <!-- A regular expression to match the content of a network validation probe. Treat the network validation as failed when the content matches the config_network_validation_failed_content_regexp and treat the network validation as success when the content matches the config_network_validation_success_content_regexp. If the content matches both of the config_network_validation_failed_content_regexp and the config_network_validation_success_content_regexp, the result will be considered as failed. --> <item type="string" name="config_network_validation_failed_content_regexp"/> <item type="string" name="config_network_validation_success_content_regexp"/> <item type="array" name="config_captive_portal_http_urls"/> <item type="array" name="config_captive_portal_https_urls"/> <item type="array" name="config_captive_portal_fallback_urls"/> Loading
src/android/net/util/NetworkStackUtils.java +8 −0 Original line number Diff line number Diff line Loading @@ -385,4 +385,12 @@ public class NetworkStackUtils { (address instanceof Inet6Address) ? "[%s]:%d" : "%s:%d", address.getHostAddress(), port); } /** * Return true if the provided address is non-null and an IPv6 Unique Local Address (RFC4193). */ public static boolean isIPv6ULA(@Nullable InetAddress addr) { return addr instanceof Inet6Address && ((addr.getAddress()[0] & 0xfe) == 0xfc); } }