For Issue#414 - handle roa=/32 and prefix < /32.
For cases where the ROA is host-route and a .0 host, if the prefix to compare
is a network at the same .0 the current code fails to understand
validity rules.
ie:
218.188.106.0/32 - ROA
218.188.106.0/24 - network to compare.
@@ -1339,7 +1339,7 @@ impl AddressPrefix {
pub fn covers(self, other: Self) -> bool {
match (self.addr, other.addr) {
(IpAddr::V4(left), IpAddr::V4(right)) => {
- if self.len > 31 {
+ if self.len > 31 && other.len > 31 {
left == right
}
else if self.len > other.len {
@@ -1354,7 +1354,7 @@ impl AddressPrefix {
}
}
(IpAddr::V6(left), IpAddr::V6(right)) => {
- if self.len > 127 {
+ if self.len > 127 && other.len > 127 {
left == right
}
else if self.len > other.len {
