Skip to content

Commit

Permalink
support rangepoints in self-test
Browse files Browse the repository at this point in the history
Summary:
We have a self-test that makes sure we get responses from all subnets as defined by ipmaps.
It was a follow-up to the incident we had, and I wanna keep it working.
As we use rangepoints more now, I'm updating the selftest to support doing the same check with them.

Reviewed By: t3lurid3

Differential Revision: D57490993

fbshipit-source-id: 52d53ef9f5b7dc8fa787e9bfa3fa0b992ad780c8
  • Loading branch information
abulimov authored and facebook-github-bot committed May 17, 2024
1 parent a191e91 commit 0856db8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dnsrocks/dnsdata/selftest_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,20 @@ func GetSubnets(dataPath string) ([]*net.IPNet, error) {
continue
}
rtype := decodeRtype(line)
if rtype != prefixNet {
if rtype != prefixNet && rtype != prefixRangePoint {
continue
}
r, err := codec.DecodeLn(line)
if err != nil {
return nets, fmt.Errorf("error decoding %s: %w", string(line), err)
}
rr := r.(*Rnet)
nets = append(nets, rr.ipnet)
switch rr := r.(type) {
case *Rnet:
nets = append(nets, rr.ipnet)
case *Rrangepoint:
n := &net.IPNet{IP: net.IP(rr.pt.rangeStart[:]), Mask: net.CIDRMask(int(rr.pt.location.maskLen), 128)}
nets = append(nets, n)
}
}
if err := scanner.Err(); err != nil {
return nets, err
Expand Down

0 comments on commit 0856db8

Please sign in to comment.