-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parser: check for route duplicates (LP: #2003061) #320
Conversation
We currently check if the number of routes we have in the list is the same as the number of entries in the yaml structure. This cause problems when routes come from different files, see LP#2003061. In this case, the second route is not added to the netdef. This patch changes the logic to actually check if the route being processed is already in the list. For the uniqueness check, it compares the route table ID, metric, from, to and via fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I like this approach. But I think we need to work a bit more on the route matching logic. Everything else are just small suggestions inline.
While on it, we might consider refactoring some of this code, by introducing a reset_route
helper (similar to reset_ip_rule
). Also, what about handle_ip_roules
in general? Wouldn't the routing-policy handling have the same problem of duplicates?
* XXX: in the future we could add a route "key" to a hash set so this verification could | ||
* be done faster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: I like this idea!
Take into account that the destination could be 'default' or '0.0.0.0/0' (or '::/0' for IPv6). In this case we should consider them the same. Add the family to the matching criteria as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, lgtm. The refactoring and potential improvement of ip_rules can be done at later point in time. Let's keep this fix isolated.
We currently check if the number of routes we have in the list is the same as the number of entries in the yaml structure. This cause problems when routes come from different files, see LP#2003061. In this case, the second route is not added to the netdef.
This patch changes the logic to actually check if the route being processed is already in the list. For the uniqueness check, it compares the route IP family, table ID, metric, from, to and via fields.
Description
Checklist
make check
successfully.make check-coverage
).