Skip to content

Commit

Permalink
Merge pull request #225 from private-octopus/m11-providers-domains
Browse files Browse the repository at this point in the history
Fix root addresses in table check fix
  • Loading branch information
huitema authored Sep 15, 2023
2 parents a0215e5 + 4aea7e9 commit c581df8
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions travis/check-dnsstats-tables.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/usr/bin/env python

import re, sys, csv
import ipaddress

def canonical_ipaddress(addr):
try:
ip = ipaddress.ip_address(addr)
addr = str(ip)
except:
print("Invalid IP: " + addr)
return addr

try:
# For Python 3.0 and later
from urllib.request import urlopen
Expand Down Expand Up @@ -57,8 +67,9 @@
try:
root_hints = urlopen("https://www.internic.net/domain/named.root") \
.read().decode('utf-8')
root_hints = set([ln.split()[-1] for ln in root_hints.split('\n')
if ln[0].isalpha()])
root_hints = set([ln.split()[-1] for ln in root_hints.split('\n')
if len(ln) > 0 and ln[0].isalpha()])
root_hints = set(canonical_ipaddress(ip) for ip in root_hints)
if roots != root_hints:
if root_hints - roots:
fail = True
Expand Down

0 comments on commit c581df8

Please sign in to comment.