netxlite: call getaddrinfo and handle platform-specific oddities (#764)
This commit changes our system resolver to call getaddrinfo directly when CGO is enabled. This change allows us to: 1. obtain the CNAME easily 2. obtain the real getaddrinfo retval 3. handle platform specific oddities such as `EAI_NODATA` returned on Android devices See https://github.com/ooni/probe/issues/2029 and https://github.com/ooni/probe/issues/2029#issuecomment-1140258729 in particular. See https://github.com/ooni/probe/issues/2033 for documentation regarding the desire to see `getaddrinfo`'s retval. See https://github.com/ooni/probe/issues/2118 for possible follow-up changes.
This commit is contained in:
@@ -68,7 +68,7 @@ func (tk *TestKeys) classify() string {
|
||||
return classAnomalyTestHelperUnreachable
|
||||
case netxlite.FailureConnectionReset:
|
||||
return classInterferenceReset
|
||||
case netxlite.FailureDNSNXDOMAINError:
|
||||
case netxlite.FailureDNSNXDOMAINError, netxlite.FailureAndroidDNSCacheNoData:
|
||||
return classAnomalyTestHelperUnreachable
|
||||
case netxlite.FailureEOFError:
|
||||
return classInterferenceClosed
|
||||
|
||||
@@ -12,11 +12,6 @@ import (
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite"
|
||||
)
|
||||
|
||||
const (
|
||||
softwareName = "ooniprobe-example"
|
||||
softwareVersion = "0.0.1"
|
||||
)
|
||||
|
||||
func TestTestKeysClassify(t *testing.T) {
|
||||
asStringPtr := func(s string) *string {
|
||||
return &s
|
||||
@@ -41,6 +36,13 @@ func TestTestKeysClassify(t *testing.T) {
|
||||
t.Fatal("unexpected result")
|
||||
}
|
||||
})
|
||||
t.Run("with tk.Target.Failure == android_dns_cache_no_data", func(t *testing.T) {
|
||||
tk := new(TestKeys)
|
||||
tk.Target.Failure = asStringPtr(netxlite.FailureAndroidDNSCacheNoData)
|
||||
if tk.classify() != classAnomalyTestHelperUnreachable {
|
||||
t.Fatal("unexpected result")
|
||||
}
|
||||
})
|
||||
t.Run("with tk.Target.Failure == connection_reset", func(t *testing.T) {
|
||||
tk := new(TestKeys)
|
||||
tk.Target.Failure = asStringPtr(netxlite.FailureConnectionReset)
|
||||
|
||||
Reference in New Issue
Block a user