Skip to content

Commit

Permalink
fix(oohelperd): refuse to measure bogons (#898)
Browse files Browse the repository at this point in the history
See the explanatory newly-added comment for more information.

Closes ooni/probe#2064
  • Loading branch information
bassosimone authored Aug 28, 2022
1 parent dcdd8fb commit 9bd1c5f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion internal/cmd/oohelperd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,25 @@ func main() {
Indexer: &atomicx.Int64{},
MaxAcceptableBody: maxAcceptableBody,
NewClient: func(logger model.Logger) model.HTTPClient {
return netxlite.NewHTTPClientWithResolver(logger, newResolver(logger))
// If the DoH resolver we're using insists that a given domain maps to
// bogons, make sure we're going to fail the HTTP measurement.
//
// The TCP measurements scheduler in ipinfo.go will also refuse to
// schedule TCP measurements for bogons.
//
// While this seems theoretical, as of 2022-08-28, I see:
//
// % host polito.it
// polito.it has address 192.168.59.6
// polito.it has address 192.168.40.1
// polito.it mail is handled by 10 mx.polito.it.
//
// So, it's better to consider this as a possible corner case.
reso := netxlite.MaybeWrapWithBogonResolver(
true, // enabled
newResolver(logger),
)
return netxlite.NewHTTPClientWithResolver(logger, reso)
},
NewDialer: func(logger model.Logger) model.Dialer {
return netxlite.NewDialerWithResolver(logger, newResolver(logger))
Expand Down

0 comments on commit 9bd1c5f

Please sign in to comment.