lib/facter/util/resolvers/networking/primary_interface.rb in facter-4.0.52 vs lib/facter/util/resolvers/networking/primary_interface.rb in facter-4.1.0
- old
+ new
@@ -35,15 +35,12 @@
content.each_line.with_index do |line, index|
next if index.zero?
route = line.strip.split("\t")
- if route.count > 7 &&
- route[ROUTE_TABLE_MAPPING['Destination']] == '00000000' &&
- route[ROUTE_TABLE_MAPPING['Mask']] == '00000000'
- return route[ROUTE_TABLE_MAPPING['Iface']]
- end
+
+ return route[ROUTE_TABLE_MAPPING['Iface']] if valid_default_route?(route)
end
nil
end
@@ -71,9 +68,18 @@
return iface_name unless Facter::Util::Resolvers::Networking.ignored_ip_address(binding[:address])
end
end
nil
+ end
+
+ private
+
+ def valid_default_route?(route)
+ route.count > 7 &&
+ route[ROUTE_TABLE_MAPPING['Destination']] == '00000000' &&
+ route[ROUTE_TABLE_MAPPING['Mask']] == '00000000' &&
+ route[ROUTE_TABLE_MAPPING['Iface']] != '*' # `*` represents blackhole and not a valid interface
end
end
end
end
end