aboutsummaryrefslogtreecommitdiff
path: root/rpkid
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid')
-rwxr-xr-xrpkid/rpki/gui/app/range_list.py10
-rw-r--r--rpkid/rpki/gui/app/views.py21
2 files changed, 29 insertions, 2 deletions
diff --git a/rpkid/rpki/gui/app/range_list.py b/rpkid/rpki/gui/app/range_list.py
index 5fa36891..fcfcfc24 100755
--- a/rpkid/rpki/gui/app/range_list.py
+++ b/rpkid/rpki/gui/app/range_list.py
@@ -77,10 +77,16 @@ class RangeList(list):
for x in self:
xmin = x.min
+ def V(v):
+ """convert the integer value to the appropriate type for this
+ range"""
+ return x.__class__.datum_type(v)
+
try:
while xmin <= x.max:
if xmin < cur.min:
- r.append(x.__class__(min=xmin, max=min(x.max,cur.min-1)))
+ r.append(x.__class__(min=V(xmin),
+ max=V(min(x.max,cur.min-1))))
xmin = cur.max+1
elif xmin == cur.min:
xmin = cur.max+1
@@ -91,7 +97,7 @@ class RangeList(list):
cur = it.next()
except StopIteration:
- r.append(x.__class__(min=xmin, max=x.max))
+ r.append(x.__class__(min=V(xmin), max=x.max))
return r
diff --git a/rpkid/rpki/gui/app/views.py b/rpkid/rpki/gui/app/views.py
index d238be55..abfddc72 100644
--- a/rpkid/rpki/gui/app/views.py
+++ b/rpkid/rpki/gui/app/views.py
@@ -464,6 +464,27 @@ def roa_create(request):
match = roa_match(rng)
for route, roas in match:
validate_route(route, roas)
+ # tweak the validation status due to the presence of the
+ # new ROA. Don't need to check the prefix bounds here
+ # because all the matches routes will be covered by this
+ # new ROA
+ if route.status == 'unknown':
+ # if the route was previously unknown (no covering
+ # ROAs), then:
+ # if the AS matches, it is valid, otherwise invalid
+ if route.asn == asn:
+ route.status = 'valid'
+ route.status_label = 'success'
+ else:
+ route.status = 'invalid'
+ route.status_label = 'important'
+ elif route.status == 'invalid':
+ # if the route was previously invalid, but this new ROA
+ # matches the ASN, it is now valid
+ if route.asn == asn:
+ route.status = 'valid'
+ route.status_label = 'success'
+
routes.append(route)
else:
form = forms.ROARequest()