summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/facter/util/macaddress.rb2
-rw-r--r--spec/fixtures/ifconfig/darwin_10_6_6_dualstack8
-rw-r--r--spec/fixtures/ifconfig/darwin_10_6_6_dualstack_en17
-rw-r--r--spec/fixtures/netstat/darwin_10_6_6_dualstack34
-rwxr-xr-xspec/unit/util/macaddress_spec.rb3
5 files changed, 52 insertions, 2 deletions
diff --git a/lib/facter/util/macaddress.rb b/lib/facter/util/macaddress.rb
index fc0a043..f6bae14 100644
--- a/lib/facter/util/macaddress.rb
+++ b/lib/facter/util/macaddress.rb
@@ -12,7 +12,7 @@ module Facter::Util::Macaddress
end
def self.default_interface
- `#{netstat_command} | /usr/bin/awk '/^default/{print $6}'`.chomp
+ `#{netstat_command} | /usr/bin/awk '/^default/{print $6;exit}'`.chomp
end
private
diff --git a/spec/fixtures/ifconfig/darwin_10_6_6_dualstack b/spec/fixtures/ifconfig/darwin_10_6_6_dualstack
new file mode 100644
index 0000000..819f56e
--- /dev/null
+++ b/spec/fixtures/ifconfig/darwin_10_6_6_dualstack
@@ -0,0 +1,8 @@
+lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
+ inet 127.0.0.1 netmask 0xff000000
+ inet6 ::1 prefixlen 128
+ inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
+en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
+ ether 00:25:4b:ca:56:72
+ media: autoselect
+ status: inactive
diff --git a/spec/fixtures/ifconfig/darwin_10_6_6_dualstack_en1 b/spec/fixtures/ifconfig/darwin_10_6_6_dualstack_en1
new file mode 100644
index 0000000..eabb1f6
--- /dev/null
+++ b/spec/fixtures/ifconfig/darwin_10_6_6_dualstack_en1
@@ -0,0 +1,7 @@
+en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
+ ether 00:25:00:48:19:ef
+ inet6 fe80::225:ff:fe48:19ef%en1 prefixlen 64 scopeid 0x5
+ inet 192.168.1.207 netmask 0xffffff00 broadcast 192.168.1.255
+ inet6 2000:44b4:32:400::1 prefixlen 64
+ media: autoselect
+ status: active
diff --git a/spec/fixtures/netstat/darwin_10_6_6_dualstack b/spec/fixtures/netstat/darwin_10_6_6_dualstack
new file mode 100644
index 0000000..14d937d
--- /dev/null
+++ b/spec/fixtures/netstat/darwin_10_6_6_dualstack
@@ -0,0 +1,34 @@
+Routing tables
+
+Internet:
+Destination Gateway Flags Refs Use Netif Expire
+default 192.168.1.254 UGSc 38 0 en1
+127 127.0.0.1 UCS 0 0 lo0
+127.0.0.1 127.0.0.1 UH 14 1044474 lo0
+169.254 link#5 UCS 0 0 en1
+192.168.1 link#5 UCS 2 0 en1
+192.168.1.207 127.0.0.1 UHS 0 1 lo0
+192.168.1.220 e0:f8:47:98:85:71 UHLWI 0 0 en1 135
+192.168.1.254 0:4:ed:66:13:cc UHLWI 42 134 en1 1158
+
+Internet6:
+Destination Gateway Flags Netif Expire
+default 2000:44b4:61::16e UGSc tun0
+::1 ::1 UH lo0
+2000:44b4:61::16e 2000:44b4:61::16f UH tun0
+2000:44b4:61::16f link#9 UHL lo0
+2000:44b4:62:480::/64 link#5 UC en1
+2000:44b4:62:480::/60 ::1 UGSc lo0
+2000:44b4:62:480::1 0:25:0:48:19:ef UHL lo0
+fe80::%lo0/64 fe80::1%lo0 Uc lo0
+fe80::1%lo0 link#1 UHL lo0
+fe80::%en1/64 link#5 UC en1
+fe80::225:ff:fe48:19ef%en1 0:25:0:48:19:ef UHL lo0
+fe80::a00:27ff:fe02:bcb5%en1 8:0:27:2:bc:b5 UHLW en1
+fe80::a932:c76f:9c2e:ead8%en1 0:1e:2a:b3:9b:66 UHLW en1
+fe80::e2f8:47ff:fe98:8571%en1 e0:f8:47:98:85:71 UHLW en1
+fe80::225:4bff:feca:5672%tun0 link#9 UHL lo0
+ff01::/32 ::1 Um lo0
+ff02::/32 ::1 UmC lo0
+ff02::/32 link#5 UmC en1
+ff02::/32 fe80::225:4bff:feca:5672%tun0 UmC tun0
diff --git a/spec/unit/util/macaddress_spec.rb b/spec/unit/util/macaddress_spec.rb
index 98215c4..d255d20 100755
--- a/spec/unit/util/macaddress_spec.rb
+++ b/spec/unit/util/macaddress_spec.rb
@@ -9,7 +9,8 @@ describe "Darwin" do
# version, iface, real macaddress, fallback macaddress
["9.8.0", 'en0', "00:17:f2:06:e4:2e", "00:17:f2:06:e4:2e"],
["10.3.0", 'en0', "00:17:f2:06:e3:c2", "00:17:f2:06:e3:c2"],
- ["10.6.4", 'en1', "58:b0:35:7f:25:b3", "58:b0:35:fa:08:b1"]
+ ["10.6.4", 'en1', "58:b0:35:7f:25:b3", "58:b0:35:fa:08:b1"],
+ ["10.6.6_dualstack", "en1" , "00:25:00:48:19:ef" , "00:25:4b:ca:56:72"]
]
test_cases.each do |version, default_iface, macaddress, fallback_macaddress|