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-1375) Only recognize default route with netmask of 0.0.0.0 #1292

Merged
merged 2 commits into from Apr 5, 2016
Merged

(FACT-1375) Only recognize default route with netmask of 0.0.0.0 #1292

merged 2 commits into from Apr 5, 2016

Conversation

ghost
Copy link

@ghost ghost commented Mar 24, 2016

Without this patch, Facter will recognize any route with a destination
of 0.0.0.0 as a default route, even if that route has a non-0 netmask.
The default route always has a netmask of 0.0.0.0, and should be the
one chosen to determine the primary network interface.

Without this patch, Facter will recognize any route with a destination
of 0.0.0.0 as a default route, even if that route has a non-0 netmask.
The default route always has a netmask of 0.0.0.0, and should be the
one chosen to determine the primary network interface.
@@ -81,7 +81,8 @@ namespace facter { namespace facts { namespace linux {
lth_file::each_line("/proc/net/route", [&interface](string& line) {
vector<boost::iterator_range<string::iterator>> parts;
boost::split(parts, line, boost::is_space(), boost::token_compress_on);
if (parts.size() > 1 && parts[1] == boost::as_literal("00000000")) {
if (parts.size() > 1 && parts[1] == boost::as_literal("00000000")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The size check needs to be updated in case the split didn't have 8 parts.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, fixed. Sorry about that; it's been a very long time since I've done non-scripting-language programming.

@MikaelSmith MikaelSmith merged commit b5db22e into puppetlabs:master Apr 5, 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.

None yet

3 participants