-
Notifications
You must be signed in to change notification settings - Fork 498
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
(FACT-1282) parse routing table rules with a starting 'type' field #1283
(FACT-1282) parse routing table rules with a starting 'type' field #1283
Conversation
This should still be part of FACT-1282. |
The `ip` command is the worst, and thinks it's helpful to show the route type as an optional field before the route destination. This patch detects that case and allows us to keep parsing key/value pairs that appear in these rules.
45046a3
to
5698e75
Compare
@MikaelSmith commit message updated. Not fixing my branch name since that means closing and re-opening the PR |
// Iterate over key/value pairs and add the ones we care | ||
// about to our routes entries | ||
for (size_t i = 1; i < parts.size(); i += 2) { | ||
for (size_t i = dst_idx+1; i < parts.size(); i += 2) { |
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.
This looks wrong; why start at 1 or 2? i.e. what format has x destination ...
?
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.
[root@bqpdzd6yyu6gzck ~]# ip -6 route
unreachable ::/96 dev lo metric 1024 error -101
unreachable ::ffff:0.0.0.0/96 dev lo metric 1024 error -101
unreachable 2002:a00::/24 dev lo metric 1024 error -101
unreachable 2002:7f00::/24 dev lo metric 1024 error -101
unreachable 2002:a9fe::/32 dev lo metric 1024 error -101
unreachable 2002:ac10::/28 dev lo metric 1024 error -101
unreachable 2002:c0a8::/32 dev lo metric 1024 error -101
unreachable 2002:e000::/19 dev lo metric 1024 error -101
unreachable 3ffe:ffff::/32 dev lo metric 1024 error -101
fe80::/64 dev ens192 proto kernel metric 256
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.
It's entirely the way the ip
command prints stuff. It's great for humans, but not awesome for parsing, unfortunately.
👍 |
(FACT-1282) parse routing table rules with a starting 'type' field
The
ip
command is the worst, and thinks it's helpful to show theroute type as an optional field before the route destination. This
patch detects that case and allows us to keep parsing key/value pairs
that appear in these rules.