Skip to content

Commit 1142491

Browse files
author
Alex Peuchert
committed
first commit
0 parents  commit 1142491

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3586
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*~
2+
**/*~

COPYING

+340
Large diffs are not rendered by default.

Changelog

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Version 1.2.1
2+
- import into GitHub (Alex Peuchert)
3+
- added .gemspec for automatic GEM creation
4+
5+
Version 1.2
6+
- All IP addresses (v4 and v6) are ipaddr objects now.
7+
- Rework unit tests to run from rake
8+
9+
Version 1.1
10+
- New features courtesy of Jeremy Tregunna
11+
* Fixed "command not found" error when executing "netstat" on some of the BSD's
12+
* Added support for Darwin and DragonFly BSD
13+
* Added unit tests for Darwin and DragonFly as well as ifconfig examples
14+
* Added three methods (1 public, 2 private) to common/ifconfig.rb:
15+
- valid_addr? - Checks the supplied type and executes one of two private
16+
methods to verify that the specified address is valid. Returns false if not.
17+
18+
- valid_v4? and valid_v6? private methods will return true if the supplied
19+
address is a valid ipv4 or ipv6 address (respectfully).
20+

INSTALL

+239
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
$Id: INSTALL,v 1.1.1.1 2005/07/02 19:10:57 hobe Exp $
2+
3+
Requirements
4+
------------
5+
6+
Ruby-Ifconfig depends on Ruby 1.8.0 or later.
7+
8+
Installation
9+
------------
10+
11+
Minero Aoki's setup.rb script is included. Extensive documentation for this
12+
script can be found at the end of this document.
13+
14+
Basically, however, the following should be enough to install the package:
15+
16+
$ ruby setup.rb config
17+
$ ruby setup.rb setup
18+
# ruby setup.rb install
19+
20+
("#" line may require root privilege)
21+
22+
23+
Documentation
24+
-------------
25+
26+
To create documentation for Ruby-Ifconfig, use rdoc as follows:
27+
28+
$ rdoc -x CVS lib
29+
30+
rdoc has been bundled with Ruby since 1.8.1, but you may care to use
31+
a newer version from Ruby's CVS. Information on that can be found here:
32+
33+
http://www.ruby-lang.org/en/20020106.html
34+
35+
36+
37+
-----------------------------------------------------------------------------
38+
39+
Full instructions for setup.rb:
40+
41+
Details
42+
-------
43+
44+
Usage of install.rb/setup.rb is:
45+
46+
ruby install.rb <global options>
47+
ruby install.rb [<global options>] <task> [<task options>]
48+
49+
50+
-q,--quiet
51+
suppress message outputs
52+
--verbose
53+
output messages verbosely (default)
54+
-h,--help
55+
prints help and quit
56+
-v,--version
57+
prints version and quit
58+
--copyright
59+
prints copyright and quit
60+
61+
These are acceptable tasks:
62+
config
63+
saves configurations
64+
show
65+
prints current configurations
66+
setup
67+
compiles extentions
68+
install
69+
installs files
70+
clean
71+
cleans created files
72+
73+
Task Options for Config
74+
-----------------------
75+
76+
--prefix=PATH
77+
a prefix of the installing directory path
78+
--std-ruby=PATH
79+
the directory for standard ruby libraries
80+
--site-ruby-common=PATH
81+
the directory for version-independent non-standard
82+
ruby libraries
83+
--site-ruby=PATH
84+
the directory for non-standard ruby libraries
85+
--bin-dir=PATH
86+
the directory for commands
87+
--rb-dir=PATH
88+
the directory for ruby scripts
89+
--so-dir=PATH
90+
the directory for ruby extentions
91+
--data-dir=PATH
92+
the directory for shared data
93+
--ruby-path=PATH
94+
path to set to #! line
95+
--ruby-prog=PATH
96+
the ruby program using for installation
97+
--make-prog=NAME
98+
the make program to compile ruby extentions
99+
--without-ext
100+
forces to install.rb never to compile/install
101+
ruby extentions.
102+
--rbconfig=PATH
103+
your rbconfig.rb to load
104+
105+
You can view default values of these options by typing
106+
107+
$ ruby install.rb --help
108+
109+
110+
In addition, setup.rb accepts these options:
111+
--with=NAME,NAME,NAME...
112+
package names which you want to install
113+
--without=NAME,NAME,NAME...
114+
package names which you do not want to install
115+
116+
[NOTE] You can pass options for extconf.rb like this:
117+
118+
ruby install.rb config -- --with-tklib=/usr/lib/libtk-ja.so.8.0
119+
120+
121+
Task Options for Install
122+
------------------------
123+
124+
--no-harm
125+
prints what to do and done nothing really.
126+
--prefix=PATH
127+
a prefix of the installing directory path.
128+
This option may help binary package maintainers.
129+
A default value is an empty string.
130+
131+
Installing Programs with setup.rb
132+
=================================
133+
134+
Quick Start
135+
-----------
136+
137+
Type these lines on command line:
138+
("#" line may require root privilege)
139+
140+
$ ruby setup.rb config
141+
$ ruby setup.rb setup
142+
# ruby setup.rb install
143+
144+
145+
Details
146+
-------
147+
148+
Usage of setup.rb is:
149+
150+
ruby setup.rb <global options>
151+
ruby setup.rb [<global options>] <task> [<task options>]
152+
153+
154+
Global Options
155+
--------------
156+
157+
-q,--quiet
158+
suppress message outputs
159+
--verbose
160+
output messages verbosely (default)
161+
-h,--help
162+
prints help and quit
163+
-v,--version
164+
prints version and quit
165+
--copyright
166+
prints copyright and quit
167+
168+
These are acceptable tasks:
169+
config
170+
Checks and saves configurations.
171+
show
172+
Prints current configurations.
173+
setup
174+
Compiles ruby extentions.
175+
install
176+
Installs files.
177+
clean
178+
Cleans created files.
179+
distclean
180+
Cleans created files.
181+
182+
Task Options for CONFIG
183+
-----------------------
184+
185+
--prefix=PATH
186+
a prefix of the installing directory path
187+
--std-ruby=PATH
188+
the directory for standard ruby libraries
189+
--site-ruby-common=PATH
190+
the directory for version-independent non-standard
191+
ruby libraries
192+
--site-ruby=PATH
193+
the directory for non-standard ruby libraries
194+
--bin-dir=PATH
195+
the directory for commands
196+
--rb-dir=PATH
197+
the directory for ruby scripts
198+
--so-dir=PATH
199+
the directory for ruby extentions
200+
--data-dir=PATH
201+
the directory for shared data
202+
--ruby-path=PATH
203+
path to set to #! line
204+
--ruby-prog=PATH
205+
the ruby program using for installation
206+
--make-prog=NAME
207+
the make program to compile ruby extentions
208+
--without-ext
209+
forces to setup.rb never to compile/install
210+
ruby extentions.
211+
--rbconfig=PATH
212+
your rbconfig.rb to load
213+
214+
You can view default values of these options by typing
215+
216+
$ ruby setup.rb --help
217+
218+
219+
If there's the directory named "packages",
220+
You can also use these options:
221+
--with=NAME,NAME,NAME...
222+
Package names which you want to install.
223+
--without=NAME,NAME,NAME...
224+
Package names which you do not want to install.
225+
226+
[NOTE] You can pass options for extconf.rb like this:
227+
228+
ruby setup.rb config -- --with-tklib=/usr/lib/libtk-ja.so.8.0
229+
230+
231+
Task Options for INSTALL
232+
------------------------
233+
234+
--no-harm
235+
prints what to do and done nothing really.
236+
--prefix=PATH
237+
The prefix of the installing directory path.
238+
This option may help binary package maintainers.
239+
A default value is an empty string.

README

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
$Id: README,v 1.1.1.1 2005/07/02 19:10:57 hobe Exp $
2+
3+
This is a Ruby wrapper around the ifconfig command. The goal is to make
4+
getting any information that ifconfig provides easy to access.
5+
6+
It was developed on Linux 2.6 with ifconfig from net-tools 1.60. It also has
7+
support for SunOS, Darwin and Open, Free, Net, and DragonflyBSD. These have
8+
not been thoroughly tested. Non Linux platforms call netstat for interface
9+
packet information
10+
11+
Please send me ifconfig / netstat output for platforms that don't work.
12+
13+
see test/*.rb for usage examples.
14+
15+
Thanks to Peter Johnson for the *BSD examples
16+
Thanks to Jeremy Tregunna for Darwin and DragonflyBSD support
17+
18+
INSTALLATION
19+
------------
20+
21+
Please see the INSTALL file for details of how to install Ruby-Ifconfig
22+
23+
TESTING
24+
-------
25+
> rake
26+
to run all the unit tests.
27+
28+
LICENCE
29+
-------
30+
31+
This software is offered under the GNU GENERAL PUBLIC LICENSE, a copy of which
32+
is included.
33+
34+
Section 2, paragraph b and section 5 of the GNU General Public License does not apply when the Software (Ruby/Ifconfig) is included in the program Corgi.
35+
36+
--
37+
Daniel Hobe
38+

Rakefile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require 'rake'
2+
require 'rake/testtask'
3+
4+
$VERBOSE = true
5+
6+
desc "Run all unit tests"
7+
task :default => [ :test_units ]
8+
9+
desc "Run the unit tests in test/"
10+
task :test_units do
11+
Dir.glob('test/unit/*').each do |t|
12+
puts `/usr/bin/env ruby #{t}`
13+
end
14+
end

TODO

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$Id: TODO,v 1.1.1.1 2005/07/02 19:10:57 hobe Exp $
2+
3+
Clean up code to reduce duplicate code as much as possible.
4+
5+
Test on more platforms
6+
7+
Add concept of 'sub platform'. For example BSD->NetBSD1.4 might be different
8+
from BSD->NetBSD1.5

ifconfig_examples/darwin.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
2+
inet6 ::1 prefixlen 128
3+
inet6 fe80::1 prefixlen 64 scopeid 0x1
4+
inet 127.0.0.1 netmask 0xff000000
5+
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
6+
stf0: flags=0<> mtu 1280
7+
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
8+
inet6 fe80::203:93ff:fe0a:1676 prefixlen 64 scopeid 0x4
9+
inet 192.168.0.14 netmask 0xffffff00 broadcast 192.168.0.255
10+
inet6 2001:5c0:8116::203:93ff:fe0a:1676 prefixlen 64 autoconf
11+
ether 00:03:93:0a:16:76
12+
media: autoselect (100baseTX <full-duplex>) status: active
13+
supported media: none autoselect 10baseT/UTP <half-duplex> 10baseT/UTP <full-duplex> 10baseT/UTP <full-duplex,hw-loopback> 100baseTX <half-duplex> 100baseTX <full-duplex> 100baseTX <full-duplex,hw-loopback>
14+
fw0: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 2030
15+
lladdr 00:03:93:ff:fe:0a:16:76
16+
media: autoselect <full-duplex> status: inactive
17+
supported media: autoselect <full-duplex>

ifconfig_examples/dragonflybsd.txt

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
2+
inet6 fe80::202:44ff:fe8f:bb15%rl0 prefixlen 64 scopeid 0x2
3+
inet 192.168.1.24 netmask 0xffffff00 broadcast 192.168.1.255
4+
ether 00:02:44:8f:bb:15
5+
media: Ethernet autoselect (100baseTX <full-duplex>)
6+
status: active
7+
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
8+
inet6 ::1 prefixlen 128
9+
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
10+
inet 127.0.0.1 netmask 0xff000000
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ppp0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
2+
sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST> mtu 552
3+
faith0: flags=8002<BROADCAST,MULTICAST> mtu 1500
4+
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
5+
rl0 1500 <Link#1> 00:02:44:8f:bb:15 606 0 549 0 0
6+
rl0 1500 fe80:2::202 fe80:2::202:44ff: 0 - 0 - -
7+
rl0 1500 192.168.1 192.168.1.24 605 - 544 - -
8+
lo0 16384 <Link#2> 0 0 0 0 0
9+
lo0 16384 ::1/128 ::1 0 - 0 - -
10+
lo0 16384 fe80:4::1/6 fe80:4::1 0 - 0 - -
11+
lo0 16384 127 127.0.0.1 0 - 0 - -
12+
ppp0* 1500 <Link#3> 0 0 0 0 0
13+
sl0* 552 <Link#4> 0 0 0 0 0
14+
faith0* 1500 <Link#5> 0 0 0 0 0

ifconfig_examples/freebsd.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
xl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
2+
options=3<rxcsum,txcsum>
3+
inet 192.168.0.2 netmask 0xffffff00 broadcast 192.168.0.255
4+
inet6 fe80::201:2ff:fec6:4bea%xl0 prefixlen 64 scopeid 0x1
5+
ether 00:01:02:c6:4b:ea
6+
media: Ethernet autoselect (100baseTX <full-duplex>)
7+
status: active
8+
rl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
9+
inet 10.0.0.10 netmask 0xffffff00 broadcast 10.0.0.255
10+
inet6 fe80::200:21ff:fe03:8e1%rl0 prefixlen 64 scopeid 0x1
11+
ether 00:00:21:03:08:e1
12+
media: Ethernet autoselect (100baseTX )
13+
status: active
14+
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
15+
inet6 ::1 prefixlen 128
16+
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
17+
inet 127.0.0.1 netmask 0xff000000

0 commit comments

Comments
 (0)