summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorCooper Lees <me@cooperlees.com>2020-06-24 11:53:28 -0700
committerCooper Lees <me@cooperlees.com>2020-06-24 12:46:21 -0700
commitd83afc7244cf63be9f27cb424ba754245c2ecbcf (patch)
tree25633e896bea23c165daf6f92f102d74ee91b103 /spec
parentae23ca40a68b58dbff20e20a47105c265ceb0ce2 (diff)
downloadohai-d83afc7244cf63be9f27cb424ba754245c2ecbcf.tar.gz
Linux network plugin: Handle IPv6 next hops for IPv4 routes
- Add handling for `via` where the inet6 address family is specified - Add rspec test to show working Addresses part of #1474 Signed-off-by: Cooper Lees <me@cooperlees.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/plugins/linux/network_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/plugins/linux/network_spec.rb b/spec/unit/plugins/linux/network_spec.rb
index 8aa11336..f10e3e88 100644
--- a/spec/unit/plugins/linux/network_spec.rb
+++ b/spec/unit/plugins/linux/network_spec.rb
@@ -1500,6 +1500,24 @@ describe Ohai::System, "Linux Network Plugin" do
expect(plugin["network"]["interfaces"]["eth0.11"]["vlan"]["flags"]).to eq([ "REORDER_HDR" ])
end
end
+
+ # Test we can handle IPv4 with inet6 IPv6 next hops
+ describe "using IPv6 next hops for IPv4 routes" do
+ let(:linux_ip_route) do
+ <<~EOM
+ default via inet6 fe80::69 dev eth0 metric 69
+ EOM
+ end
+
+ it "expect an IPv6 next hop and not keyword inet6" do
+ expect(plugin["network"]["interfaces"]["eth0"]["routes"]).to eq(
+ [
+ {"destination"=>"default", "family"=>"inet", "metric" => "69", "via"=>"fe80::69"},
+ {"destination"=>"fe80::/64", "family"=>"inet6", "metric"=>"256", "proto"=>"kernel"},
+ ]
+ )
+ end
+ end
end
end
end