aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpow/POW-0.7/lib/pkix.py19
-rw-r--r--scripts/rpki/resource_set.py16
2 files changed, 31 insertions, 4 deletions
diff --git a/pow/POW-0.7/lib/pkix.py b/pow/POW-0.7/lib/pkix.py
index 65f62442..d2aa942c 100755
--- a/pow/POW-0.7/lib/pkix.py
+++ b/pow/POW-0.7/lib/pkix.py
@@ -1839,13 +1839,26 @@ _addFragment('''
''')
class ASIdentifiers(Sequence):
def __init__(self, optional=0, default=''):
+ #
+ # This is what we -should- be doing
+ #self.asnum = ASIdentifierChoice()
+ #self.rdi = ASIdentifierChoice()
+ #self.explicitAsnum = Explicit(CLASS_CONTEXT, FORM_CONSTRUCTED, 0, self.asnum, 1)
+ #self.explictRdi = Explicit(CLASS_CONTEXT, FORM_CONSTRUCTED, 1, self.rdi, 1)
+ #contents = [ self.explicitAsnum, self.explictRdi ]
+ #
+ # ...but it generates a spurious empty RDI clause, so try this instead
+ # since we know that we never use RDI anyway.
self.asnum = ASIdentifierChoice()
- self.rdi = ASIdentifierChoice()
self.explicitAsnum = Explicit(CLASS_CONTEXT, FORM_CONSTRUCTED, 0, self.asnum, 1)
- self.explictRdi = Explicit(CLASS_CONTEXT, FORM_CONSTRUCTED, 1, self.rdi, 1)
- contents = [ self.explicitAsnum, self.explictRdi ]
+ contents = [ self.explicitAsnum ]
+ #
Sequence.__init__(self, contents, optional, default)
+ def set(self, values):
+ assert len(values) == 1 or (len(values) == 2 and values[1] is None)
+ Sequence.set(self, (values[0],))
+
_addFragment('''
<class>
<header>
diff --git a/scripts/rpki/resource_set.py b/scripts/rpki/resource_set.py
index e8044819..64b18b6f 100644
--- a/scripts/rpki/resource_set.py
+++ b/scripts/rpki/resource_set.py
@@ -424,7 +424,7 @@ class resource_bag(object):
v6 = None
for x in exts:
if x[0] == rpki.oids.name2oid["sbgp-autonomousSysNum"]: #
- assert x[2][1] is None, "RDI not implemented: %s" % (str(x))
+ assert len(x[2]) == 1 or x[2][1] is None, "RDI not implemented: %s" % (str(x))
assert as is None
as = resource_set_as(x[2][0])
if x[0] == rpki.oids.name2oid["sbgp-ipAddrBlock"]:
@@ -468,6 +468,20 @@ class resource_bag(object):
self.v6.union(other.v6),
self.valid_until)
+ def __str__(self):
+ s = ""
+ if self.as:
+ s += "AS: %s" % self.as
+ if self.v4:
+ if s:
+ s += ", "
+ s += "V4: %s" % self.v4
+ if self.v6:
+ if s:
+ s += ", "
+ s += "V6: %s" % self.v6
+ return s
+
# Test suite for set operations. This will probably go away eventually
if __name__ == "__main__":