Fix: Use 'subnet_of' instead of 'overlaps' for reserved IP range check#3223
Fix: Use 'subnet_of' instead of 'overlaps' for reserved IP range check#3223
Conversation
The checks of reserved IP ranges used 'overlaps' function which triggered an error even when '0.0.0.0/0' was compared to '0.0.0.0/8' Fixes #3214
There was a problem hiding this comment.
Pull request overview
Fixes IPv4 reserved-range validation so that supernets like 0.0.0.0/0 are not incorrectly rejected as “in” a smaller reserved block, aligning bgp.originate behavior with expected default-route use cases (issue #3214).
Changes:
- Switch reserved-range detection from
overlaps()tosubnet_of()to avoid false positives for supernets (e.g.0.0.0.0/0). - Extend IPv4 reserved ranges to include Class E (
240.0.0.0/4).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jbemmel
left a comment
There was a problem hiding this comment.
I think a regression test case for bgp.originate: 0.0.0.0/0 would be good; we may also want to consider deprecating bgp.session default_originate, in favor of this more intuitive (imho) version
We need both (there's a reason many devices support both ;) -- you might want to advertise a default route without having it, and you might want to advertise it only to some neighbors (customers but not peers) |
The checks of reserved IP ranges used 'overlaps' function which triggered an error even when '0.0.0.0/0' was compared to '0.0.0.0/8'
Fixes #3214