1
0
Fork 0
mirror of https://github.com/NeoCloud/NeoNetwork synced 2024-11-22 23:20:41 +08:00

allow general netname

This commit is contained in:
JerryXiao 2020-05-02 20:31:47 +08:00
parent 4cee8eb874
commit 0c3d4bf9a8
Signed by: Jerry
GPG key ID: 9D9CE43650FF2BAA

View file

@ -118,7 +118,6 @@ def node2asn():
NODE_TABLE = node2asn() NODE_TABLE = node2asn()
def neonet_route2roa(dirname, is_ipv6=False): def neonet_route2roa(dirname, is_ipv6=False):
net_names = set()
roa_entries = list() roa_entries = list()
for f in (cwd / dirname).iterdir(): for f in (cwd / dirname).iterdir():
try: try:
@ -133,9 +132,7 @@ def neonet_route2roa(dirname, is_ipv6=False):
assert asn in ASNS assert asn in ASNS
route = f.name.replace(',', '/') route = f.name.replace(',', '/')
supernet = get_supernet(fc.get('supernet')) supernet = get_supernet(fc.get('supernet'))
netname = name2nichdl(fc.get('name')) netname = fc.get('name')
assert netname not in net_names
net_names.add(netname)
roa_entries.append(dict(zip(roa_entries_key, [asn, nettype(route, strict=True), supernet, netname]))) roa_entries.append(dict(zip(roa_entries_key, [asn, nettype(route, strict=True), supernet, netname])))
elif fc.get('type').lower().startswith('tun'): elif fc.get('type').lower().startswith('tun'):
assert NODE_TABLE[fc.get('downstream')] # extra check for downstream assert NODE_TABLE[fc.get('downstream')] # extra check for downstream
@ -143,9 +140,7 @@ def neonet_route2roa(dirname, is_ipv6=False):
assert asn in ASNS assert asn in ASNS
route = f.name.replace(',', '/') route = f.name.replace(',', '/')
supernet = get_supernet(fc.get('supernet')) supernet = get_supernet(fc.get('supernet'))
netname = name2nichdl("%s-%s" % (fc.get('type'), route)) netname = "%s-%s" % (fc.get('type'), route)
assert netname not in net_names
net_names.add(netname)
roa_entries.append(dict(zip(roa_entries_key, [asn, nettype(route, strict=True), supernet, netname]))) roa_entries.append(dict(zip(roa_entries_key, [asn, nettype(route, strict=True), supernet, netname])))
else: else:
assert fc.get('type').lower() in ('ptp',) assert fc.get('type').lower() in ('ptp',)