From b34b031ce6d27fe1f6dbdb78f58592202268df5d Mon Sep 17 00:00:00 2001 From: Jerry Date: Sat, 29 Aug 2020 23:22:55 +0800 Subject: [PATCH] roa.py: allow same net different asns, as long as those asns are owned by the same entity dns-reverse-generator.py: add newline --- scripts/dns-reverse-generator.py | 2 +- scripts/roa.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/dns-reverse-generator.py b/scripts/dns-reverse-generator.py index 9b18e5b..d7aa65e 100755 --- a/scripts/dns-reverse-generator.py +++ b/scripts/dns-reverse-generator.py @@ -29,7 +29,7 @@ def main(): if isinstance(address, IPv4Address): pointer = address.reverse_pointer.replace(".127.10.in-addr.arpa", "") records.append("%s\tIN\tPTR\t%s.neo." % (pointer, name)) - RESOLVE_FILE.write_text("\n".join(records)) + RESOLVE_FILE.write_text("\n".join(records)+"\n") if __name__ == "__main__": diff --git a/scripts/roa.py b/scripts/roa.py index 2566941..c2b3876 100755 --- a/scripts/roa.py +++ b/scripts/roa.py @@ -122,7 +122,8 @@ def route_to_roa(asn_table: dict): ): if not net1["prefix"].overlaps(net2["prefix"]): continue - assert net1["prefix"] != net2["prefix"] + entity_from_net = lambda net: asn_table.get(net["asn"])["owner"] + assert net1["prefix"] != net2["prefix"] or (net1['asn'] != net2['asn'] and entity_from_net(net1) == entity_from_net(net2)) assert net1["prefix"].supernet_of(net2["prefix"]) s1net, s2net = (net1["supernet"], net2["supernet"]) assert s2net # please include supernet = in your route