rethtool 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +2 -2
- data/VERSION +1 -1
- data/lib/rethtool/ethtool_cmd.rb +1 -0
- data/lib/rethtool/ethtool_value.rb +2 -1
- data/lib/rethtool/interface_settings.rb +9 -4
- data/lib/rethtool/link_status.rb +7 -6
- data/rethtool.gemspec +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -13,12 +13,12 @@ At present, Rethtool only supports a couple of things:
|
|
13
13
|
|
14
14
|
Adding extra SIOCETHTOOL features is relatively straightforward, thanks to
|
15
15
|
cstruct and the base infrastructure already in place, so feel free to have a
|
16
|
-
hack and
|
16
|
+
hack and send me a patch.
|
17
17
|
|
18
18
|
|
19
19
|
== Contributing to rethtool
|
20
20
|
|
21
|
-
Send me patches via e-mail, please (
|
21
|
+
Send me patches via e-mail, please (theshed+rethtool@hezmatt.org). I might
|
22
22
|
eventually notice a pull request on github, but e-mail goes straight to my
|
23
23
|
frontal lobe.
|
24
24
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/rethtool/ethtool_cmd.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rethtool'
|
1
2
|
require 'rethtool/ethtool_cmd'
|
2
3
|
|
3
4
|
# All of the settings of a network interface. Ridiculous amounts of
|
@@ -5,7 +6,11 @@ require 'rethtool/ethtool_cmd'
|
|
5
6
|
#
|
6
7
|
# Create an instance of this class with the interface name as the only
|
7
8
|
# parameter, then use the available instance methods to get the info you
|
8
|
-
# seek
|
9
|
+
# seek:
|
10
|
+
#
|
11
|
+
# if = Rethtool::InterfaceSettings.new("eth0")
|
12
|
+
# puts "Current link mode is #{if.current_mode}"
|
13
|
+
#
|
9
14
|
class Rethtool::InterfaceSettings
|
10
15
|
Mode = Struct.new(:speed, :duplex, :media)
|
11
16
|
|
@@ -31,10 +36,10 @@ class Rethtool::InterfaceSettings
|
|
31
36
|
# Create a new InterfaceSettings object. Simply pass it the name of the
|
32
37
|
# interface you want to get the settings for.
|
33
38
|
def initialize(interface)
|
34
|
-
cmd = EthtoolCmd.new
|
35
|
-
cmd.cmd =
|
39
|
+
cmd = Rethtool::EthtoolCmd.new
|
40
|
+
cmd.cmd = Rethtool::ETHTOOL_CMD_GSET
|
36
41
|
|
37
|
-
@data =
|
42
|
+
@data = Rethtool.ioctl(interface, cmd)
|
38
43
|
end
|
39
44
|
|
40
45
|
# Return an array of the modes supported by the interface. Returns an
|
data/lib/rethtool/link_status.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rethtool'
|
1
2
|
require 'rethtool/ethtool_value'
|
2
3
|
|
3
4
|
# Retrieve the current link status of an interface.
|
@@ -12,17 +13,17 @@ require 'rethtool/ethtool_value'
|
|
12
13
|
#
|
13
14
|
class Rethtool::LinkStatus
|
14
15
|
def initialize(interface)
|
15
|
-
cmd = EthtoolValue.new
|
16
|
+
cmd = Rethtool::EthtoolValue.new
|
16
17
|
cmd.cmd = Rethtool::ETHTOOL_CMD_GSET
|
17
18
|
|
18
|
-
@
|
19
|
+
@status = Rethtool.ioctl(interface, cmd).value
|
19
20
|
end
|
20
21
|
|
21
|
-
def
|
22
|
-
@
|
22
|
+
def down?
|
23
|
+
@status == 0
|
23
24
|
end
|
24
25
|
|
25
|
-
def
|
26
|
-
!
|
26
|
+
def up?
|
27
|
+
!down?
|
27
28
|
end
|
28
29
|
end
|
data/rethtool.gemspec
CHANGED
metadata
CHANGED