Skip to content
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

Merged

Conversation

branan
Copy link

@branan branan commented Mar 7, 2016

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.

@MikaelSmith
Copy link

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.
@branan branan force-pushed the maint/stable/better_ip_parsing branch from 45046a3 to 5698e75 Compare March 8, 2016 00:15
@branan branan changed the title (maint) parse routing table rules with a starting 'type' field (FACT-1282) parse routing table rules with a starting 'type' field Mar 8, 2016
@branan
Copy link
Author

branan commented Mar 8, 2016

@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) {

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 ...?

Copy link
Author

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 

Copy link
Author

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.

@MikaelSmith
Copy link

👍

MikaelSmith pushed a commit that referenced this pull request Mar 8, 2016
(FACT-1282) parse routing table rules with a starting 'type' field
@MikaelSmith MikaelSmith merged commit 3d0abe1 into puppetlabs:stable Mar 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants