Skip to content
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(webconnectivitylte): handle domains w/o A/AAAA records #1473

Merged
merged 8 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions internal/experiment/webconnectivitylte/analysisclassic.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,17 @@ func analysisClassicComputeBlockingAccessible(woa *minipipeline.WebAnalysis, tk
return
}

// 5.3. Handle the case where just the probe failed.
// 5.3. When the probe says dns_no_answer the control would otherwise say that
// we have resolved zero IP addresses for historical reasons. In such a case,
// let's pretend that also the control returned dns_no_answer.
if entry.Failure.Unwrap() == netxlite.FailureDNSNoAnswer &&
!entry.ControlDNSResolvedAddrs.IsNone() &&
entry.ControlDNSResolvedAddrs.Unwrap().Len() <= 0 {
tk.setWebsiteDown()
return
}

// 5.4. Handle the case where just the probe failed.
tk.setBlockingString("dns")
tk.setHTTPExperimentFailure(entry.Failure)
return
Expand Down Expand Up @@ -406,9 +416,6 @@ func analysisClassicComputeBlockingAccessible(woa *minipipeline.WebAnalysis, tk
tk.setWebsiteDown()
return
}

// TODO(bassosimone): we should handle the case where a domain
// exists but there aren't IP addresses for it.
}
}

Expand Down
1 change: 1 addition & 0 deletions internal/experiment/webconnectivityqa/testcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func AllTestCases() []*TestCase {
tlsBlockingConnectionResetWithInconsistentDNS(),

websiteDownNXDOMAIN(),
websiteDownNoAddrs(),
websiteDownTCPConnect(),
}
}
28 changes: 28 additions & 0 deletions internal/experiment/webconnectivityqa/websitedown.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package webconnectivityqa

import "github.com/ooni/probe-cli/v3/internal/netemx"

// websiteDownNXDOMAIN describes the test case where the website domain
// is NXDOMAIN according to the TH and the probe.
func websiteDownNXDOMAIN() *TestCase {
Expand Down Expand Up @@ -60,3 +62,29 @@ func websiteDownTCPConnect() *TestCase {
},
}
}

// websiteDownNoAddrs describes the test case where the website domain
// does not return any address according to the TH and the probe.
func websiteDownNoAddrs() *TestCase {
return &TestCase{
Name: "websiteDownNoAddrs",
Flags: TestCaseFlagNoV04,
Input: "http://www.example.com/",
Configure: func(env *netemx.QAEnv) {

// reconfigure with only CNAME but no addresses and do this
// for all the resolvers of the kingdom
env.AddRecordToAllResolvers("www.example.com", "web01.example.com" /* No addrs */)

},
ExpectErr: false,
ExpectTestKeys: &testKeys{
DNSExperimentFailure: "dns_no_answer",
DNSConsistency: "consistent",
XBlockingFlags: 0,
XNullNullFlags: 1, // AnalysisFlagNullNullExpectedDNSLookupFailure
Accessible: false,
Blocking: false,
},
}
}
13 changes: 12 additions & 1 deletion internal/minipipeline/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"sort"

"github.com/ooni/probe-cli/v3/internal/model"
"github.com/ooni/probe-cli/v3/internal/netxlite"
"github.com/ooni/probe-cli/v3/internal/optional"
"github.com/ooni/probe-cli/v3/internal/runtimex"
)
Expand Down Expand Up @@ -449,7 +450,17 @@ func (wa *WebAnalysis) dnsComputeFailureMetrics(c *WebObservationsContainer) {
}

// handle the case where only the probe failed
if obs.DNSLookupFailure.Unwrap() != "" {
if failure := obs.DNSLookupFailure.Unwrap(); failure != "" {
// When the probe says dns_no_answer the control would otherwise say that
// we have resolved zero IP addresses for historical reasons. In such a case,
// let's pretend that also the control returned dns_no_answer.
if failure == netxlite.FailureDNSNoAnswer {
if !obs.ControlDNSResolvedAddrs.IsNone() && obs.ControlDNSResolvedAddrs.Unwrap().Len() <= 0 {
wa.DNSLookupExpectedFailure.Add(obs.DNSTransactionID.Unwrap())
continue
}
// fallthrough
}
wa.DNSLookupUnexpectedFailure.Add(obs.DNSTransactionID.Unwrap())
continue
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
{
"ControlExpectations": {
"DNSAddresses": [],
"FinalResponseFailure": "dns_lookup_error"
},
"DNSLookupSuccess": [],
"DNSLookupSuccessWithInvalidAddresses": [],
"DNSLookupSuccessWithValidAddress": [],
"DNSLookupSuccessWithBogonAddresses": [],
"DNSLookupSuccessWithInvalidAddressesClassic": [],
"DNSLookupSuccessWithValidAddressClassic": [],
"DNSLookupUnexpectedFailure": [],
"DNSLookupUnexplainedFailure": [],
"DNSExperimentFailure": "dns_no_answer",
"DNSLookupExpectedFailure": [
2,
3
],
"DNSLookupExpectedSuccess": [],
"TCPConnectExpectedFailure": [],
"TCPConnectUnexpectedFailure": [],
"TCPConnectUnexpectedFailureDuringWebFetch": [],
"TCPConnectUnexpectedFailureDuringConnectivityCheck": [],
"TCPConnectUnexplainedFailure": [],
"TCPConnectUnexplainedFailureDuringWebFetch": [],
"TCPConnectUnexplainedFailureDuringConnectivityCheck": [],
"TLSHandshakeExpectedFailure": [],
"TLSHandshakeUnexpectedFailure": [],
"TLSHandshakeUnexpectedFailureDuringWebFetch": [],
"TLSHandshakeUnexpectedFailureDuringConnectivityCheck": [],
"TLSHandshakeUnexplainedFailure": [],
"TLSHandshakeUnexplainedFailureDuringWebFetch": [],
"TLSHandshakeUnexplainedFailureDuringConnectivityCheck": [],
"HTTPRoundTripUnexpectedFailure": [],
"HTTPRoundTripUnexplainedFailure": [],
"HTTPFinalResponseSuccessTLSWithoutControl": null,
"HTTPFinalResponseSuccessTLSWithControl": null,
"HTTPFinalResponseSuccessTCPWithoutControl": null,
"HTTPFinalResponseSuccessTCPWithControl": null,
"HTTPFinalResponseDiffBodyProportionFactor": null,
"HTTPFinalResponseDiffStatusCodeMatch": null,
"HTTPFinalResponseDiffTitleDifferentLongWords": null,
"HTTPFinalResponseDiffUncommonHeadersIntersection": null,
"Linear": [
{
"TagDepth": 0,
"Type": 0,
"Failure": "dns_no_answer",
"TransactionID": 3,
"TagFetchBody": null,
"DNSTransactionID": 3,
"DNSDomain": "www.example.com",
"DNSLookupFailure": "dns_no_answer",
"DNSQueryType": "A",
"DNSEngine": "udp",
"DNSResolvedAddrs": null,
"IPAddressOrigin": null,
"IPAddress": null,
"IPAddressASN": null,
"IPAddressBogon": null,
"EndpointTransactionID": null,
"EndpointProto": null,
"EndpointPort": null,
"EndpointAddress": null,
"TCPConnectFailure": null,
"TLSHandshakeFailure": null,
"TLSServerName": null,
"HTTPRequestURL": null,
"HTTPFailure": null,
"HTTPResponseStatusCode": null,
"HTTPResponseBodyLength": null,
"HTTPResponseBodyIsTruncated": null,
"HTTPResponseHeadersKeys": null,
"HTTPResponseLocation": null,
"HTTPResponseTitle": null,
"HTTPResponseIsFinal": null,
"ControlDNSDomain": "www.example.com",
"ControlDNSLookupFailure": "",
"ControlDNSResolvedAddrs": [],
"ControlTCPConnectFailure": null,
"ControlTLSHandshakeFailure": null,
"ControlHTTPFailure": "dns_lookup_error",
"ControlHTTPResponseStatusCode": null,
"ControlHTTPResponseBodyLength": null,
"ControlHTTPResponseHeadersKeys": null,
"ControlHTTPResponseTitle": null
},
{
"TagDepth": 0,
"Type": 0,
"Failure": "dns_no_answer",
"TransactionID": 3,
"TagFetchBody": null,
"DNSTransactionID": 3,
"DNSDomain": "www.example.com",
"DNSLookupFailure": "dns_no_answer",
"DNSQueryType": "AAAA",
"DNSEngine": "udp",
"DNSResolvedAddrs": null,
"IPAddressOrigin": null,
"IPAddress": null,
"IPAddressASN": null,
"IPAddressBogon": null,
"EndpointTransactionID": null,
"EndpointProto": null,
"EndpointPort": null,
"EndpointAddress": null,
"TCPConnectFailure": null,
"TLSHandshakeFailure": null,
"TLSServerName": null,
"HTTPRequestURL": null,
"HTTPFailure": null,
"HTTPResponseStatusCode": null,
"HTTPResponseBodyLength": null,
"HTTPResponseBodyIsTruncated": null,
"HTTPResponseHeadersKeys": null,
"HTTPResponseLocation": null,
"HTTPResponseTitle": null,
"HTTPResponseIsFinal": null,
"ControlDNSDomain": "www.example.com",
"ControlDNSLookupFailure": "",
"ControlDNSResolvedAddrs": [],
"ControlTCPConnectFailure": null,
"ControlTLSHandshakeFailure": null,
"ControlHTTPFailure": "dns_lookup_error",
"ControlHTTPResponseStatusCode": null,
"ControlHTTPResponseBodyLength": null,
"ControlHTTPResponseHeadersKeys": null,
"ControlHTTPResponseTitle": null
},
{
"TagDepth": 0,
"Type": 0,
"Failure": "dns_no_answer",
"TransactionID": 2,
"TagFetchBody": null,
"DNSTransactionID": 2,
"DNSDomain": "www.example.com",
"DNSLookupFailure": "dns_no_answer",
"DNSQueryType": "ANY",
"DNSEngine": "getaddrinfo",
"DNSResolvedAddrs": null,
"IPAddressOrigin": null,
"IPAddress": null,
"IPAddressASN": null,
"IPAddressBogon": null,
"EndpointTransactionID": null,
"EndpointProto": null,
"EndpointPort": null,
"EndpointAddress": null,
"TCPConnectFailure": null,
"TLSHandshakeFailure": null,
"TLSServerName": null,
"HTTPRequestURL": null,
"HTTPFailure": null,
"HTTPResponseStatusCode": null,
"HTTPResponseBodyLength": null,
"HTTPResponseBodyIsTruncated": null,
"HTTPResponseHeadersKeys": null,
"HTTPResponseLocation": null,
"HTTPResponseTitle": null,
"HTTPResponseIsFinal": null,
"ControlDNSDomain": "www.example.com",
"ControlDNSLookupFailure": "",
"ControlDNSResolvedAddrs": [],
"ControlTCPConnectFailure": null,
"ControlTLSHandshakeFailure": null,
"ControlHTTPFailure": "dns_lookup_error",
"ControlHTTPResponseStatusCode": null,
"ControlHTTPResponseBodyLength": null,
"ControlHTTPResponseHeadersKeys": null,
"ControlHTTPResponseTitle": null
},
{
"TagDepth": 0,
"Type": 0,
"Failure": "dns_nxdomain_error",
"TransactionID": 1,
"TagFetchBody": null,
"DNSTransactionID": 1,
"DNSDomain": "www.example.com",
"DNSLookupFailure": "dns_nxdomain_error",
"DNSQueryType": "AAAA",
"DNSEngine": "doh",
"DNSResolvedAddrs": null,
"IPAddressOrigin": null,
"IPAddress": null,
"IPAddressASN": null,
"IPAddressBogon": null,
"EndpointTransactionID": null,
"EndpointProto": null,
"EndpointPort": null,
"EndpointAddress": null,
"TCPConnectFailure": null,
"TLSHandshakeFailure": null,
"TLSServerName": null,
"HTTPRequestURL": null,
"HTTPFailure": null,
"HTTPResponseStatusCode": null,
"HTTPResponseBodyLength": null,
"HTTPResponseBodyIsTruncated": null,
"HTTPResponseHeadersKeys": null,
"HTTPResponseLocation": null,
"HTTPResponseTitle": null,
"HTTPResponseIsFinal": null,
"ControlDNSDomain": "www.example.com",
"ControlDNSLookupFailure": "",
"ControlDNSResolvedAddrs": [],
"ControlTCPConnectFailure": null,
"ControlTLSHandshakeFailure": null,
"ControlHTTPFailure": "dns_lookup_error",
"ControlHTTPResponseStatusCode": null,
"ControlHTTPResponseBodyLength": null,
"ControlHTTPResponseHeadersKeys": null,
"ControlHTTPResponseTitle": null
},
{
"TagDepth": 0,
"Type": 0,
"Failure": "dns_nxdomain_error",
"TransactionID": 1,
"TagFetchBody": null,
"DNSTransactionID": 1,
"DNSDomain": "www.example.com",
"DNSLookupFailure": "dns_nxdomain_error",
"DNSQueryType": "A",
"DNSEngine": "doh",
"DNSResolvedAddrs": null,
"IPAddressOrigin": null,
"IPAddress": null,
"IPAddressASN": null,
"IPAddressBogon": null,
"EndpointTransactionID": null,
"EndpointProto": null,
"EndpointPort": null,
"EndpointAddress": null,
"TCPConnectFailure": null,
"TLSHandshakeFailure": null,
"TLSServerName": null,
"HTTPRequestURL": null,
"HTTPFailure": null,
"HTTPResponseStatusCode": null,
"HTTPResponseBodyLength": null,
"HTTPResponseBodyIsTruncated": null,
"HTTPResponseHeadersKeys": null,
"HTTPResponseLocation": null,
"HTTPResponseTitle": null,
"HTTPResponseIsFinal": null,
"ControlDNSDomain": "www.example.com",
"ControlDNSLookupFailure": "",
"ControlDNSResolvedAddrs": [],
"ControlTCPConnectFailure": null,
"ControlTLSHandshakeFailure": null,
"ControlHTTPFailure": "dns_lookup_error",
"ControlHTTPResponseStatusCode": null,
"ControlHTTPResponseBodyLength": null,
"ControlHTTPResponseHeadersKeys": null,
"ControlHTTPResponseTitle": null
}
]
}
Loading