macaddr 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/macaddr.rb +21 -7
- data/macaddr.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjZlZWVhMzVkOWY2YzdiMWJjZDNhNzRmYmMxOWFhYzMxODkyY2RiYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2E5ODVkNDgwNWMyMzM4Zjc2MTA5OTI5OGI4NTgyYWZiZDdiYjk2Yg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2VjYzUxZmQ1NGI0ZDc2MzA3ZGZkNDYyNDcxMmUxMDM1ZDU2NDYwN2JmMjli
|
10
|
+
ZmI0ODFhMDFjMmRhOGU2OWFjMjdmNmM1YWJmOGUzZjBjM2MwMzdlZGE1MDEw
|
11
|
+
YzczY2FkZmU3MTk5ZDg5OTgyNzJjOTZhYzVhMjEzMDA2OTI5MjU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2ZkOGEzZTYyZTRjMzg2Y2IxM2IxYTcyNGY3OTNjNmQ4MmE1NmY3NDkwZjk4
|
14
|
+
ODAwYWE4MTgwZWU4ZDk3NmViMzhjMjVjMGIwYzA3Y2ZiZjE4ZmNkMGIwMzFj
|
15
|
+
YjBlMzFhMWRiNzA4ZDYwMDQ4MTIxNGZjZjU4NzRjODhkMjhhNzg=
|
data/lib/macaddr.rb
CHANGED
@@ -24,7 +24,7 @@ require 'systemu'
|
|
24
24
|
require 'socket'
|
25
25
|
|
26
26
|
module Mac
|
27
|
-
VERSION = '1.7.
|
27
|
+
VERSION = '1.7.1'
|
28
28
|
|
29
29
|
def Mac.version
|
30
30
|
::Mac::VERSION
|
@@ -75,16 +75,30 @@ module Mac
|
|
75
75
|
@mac_address = parse(output)
|
76
76
|
end
|
77
77
|
|
78
|
+
link = Socket::PF_LINK if Socket.const_defined? :PF_LINK
|
79
|
+
packet = Socket::PF_PACKET if Socket.const_defined? :PF_PACKET
|
80
|
+
INTERFACE_PACKET_FAMILY = link || packet # :nodoc:
|
81
|
+
|
78
82
|
def from_getifaddrs
|
79
83
|
return unless Socket.respond_to? :getifaddrs
|
80
84
|
|
85
|
+
interfaces = Socket.getifaddrs.select do |addr|
|
86
|
+
addr.addr.pfamily == INTERFACE_PACKET_FAMILY
|
87
|
+
end
|
88
|
+
|
81
89
|
mac, =
|
82
|
-
Socket.
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
90
|
+
if Socket.const_defined? :PF_LINK then
|
91
|
+
interfaces.map do |addr|
|
92
|
+
addr.addr.getnameinfo
|
93
|
+
end.find do |m,|
|
94
|
+
!m.empty?
|
95
|
+
end
|
96
|
+
elsif Socket.const_defined? :PF_PACKET then
|
97
|
+
interfaces.map do |addr|
|
98
|
+
addr.addr.inspect_sockaddr[/hwaddr=([\h:]+)/, 1]
|
99
|
+
end.find do |mac_addr|
|
100
|
+
mac_addr != '00:00:00:00:00:00'
|
101
|
+
end
|
88
102
|
end
|
89
103
|
|
90
104
|
@mac_address = mac if mac
|
data/macaddr.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: macaddr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|