-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid using 130.192.91.x for most netemx addresses (#1219)
As we learned in #1216, using the 130.192.91.x namespace for every IP address in netemx breaks mapping domain names to IP addresess in Web Connectivity. No IP address would ever, in fact, be inconsistent, because they all belong to AS137. Initially, I thought about overriding the code that maps IP addresses to ASNs, to provide a custom implementation. But then I realized it was a more thorough test to use the default implementation (relying on maxminddb files) and using the correct IP addresses in the correct address space. My original thought for using 130.192.91.x addresses was that they were not the right addresses for the domains we're testing, thus, in the event in which netem was not WAI, all tests would have failed. However, we have many tests checking that netem is WAI already, so probably I was being excessively paranoid. As a result, this patch modifies the code to use the correct addresses. We're still using some 130.192.91.x addresses where it makes sense to do so (user's IP address and default user's resolver). Part of ooni/probe#1803. ## Checklist - [x] I have read the [contribution guidelines](https://github.com/ooni/probe-cli/blob/master/CONTRIBUTING.md) - [x] reference issue for this pull request: see above - [x] if you changed anything related to how experiments work and you need to reflect these changes in the ooni/spec repository, please link to the related ooni/spec pull request: N/A - [x] if you changed code inside an experiment, make sure you bump its version number: N/A
- Loading branch information
1 parent
d3d9782
commit 7109b14
Showing
8 changed files
with
158 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package netemx | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"testing" | ||
|
||
"github.com/apex/log" | ||
"github.com/ooni/probe-cli/v3/internal/netxlite" | ||
) | ||
|
||
// Make sure we can emulate Android's getaddrinfo behavior. | ||
func TestEmulateAndroidGetaddrinfo(t *testing.T) { | ||
env := MustNewScenario(InternetScenario) | ||
defer env.Close() | ||
|
||
env.EmulateAndroidGetaddrinfo(true) | ||
defer env.EmulateAndroidGetaddrinfo(false) | ||
|
||
env.Do(func() { | ||
reso := netxlite.NewStdlibResolver(log.Log) | ||
addrs, err := reso.LookupHost(context.Background(), "www.nonexistent.xyz") | ||
if !errors.Is(err, netxlite.ErrAndroidDNSCacheNoData) { | ||
t.Fatal("unexpected error") | ||
} | ||
if len(addrs) != 0 { | ||
t.Fatal("expected zero-length addresses") | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.