Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Peuchert committed Dec 9, 2008
0 parents commit 1142491
Show file tree
Hide file tree
Showing 47 changed files with 3,586 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
*~
**/*~
340 changes: 340 additions & 0 deletions COPYING

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions Changelog
@@ -0,0 +1,20 @@
Version 1.2.1
- import into GitHub (Alex Peuchert)
- added .gemspec for automatic GEM creation

Version 1.2
- All IP addresses (v4 and v6) are ipaddr objects now.
- Rework unit tests to run from rake

Version 1.1
- New features courtesy of Jeremy Tregunna
* Fixed "command not found" error when executing "netstat" on some of the BSD's
* Added support for Darwin and DragonFly BSD
* Added unit tests for Darwin and DragonFly as well as ifconfig examples
* Added three methods (1 public, 2 private) to common/ifconfig.rb:
- valid_addr? - Checks the supplied type and executes one of two private
methods to verify that the specified address is valid. Returns false if not.

- valid_v4? and valid_v6? private methods will return true if the supplied
address is a valid ipv4 or ipv6 address (respectfully).

239 changes: 239 additions & 0 deletions INSTALL
@@ -0,0 +1,239 @@
$Id: INSTALL,v 1.1.1.1 2005/07/02 19:10:57 hobe Exp $

Requirements
------------

Ruby-Ifconfig depends on Ruby 1.8.0 or later.

Installation
------------

Minero Aoki's setup.rb script is included. Extensive documentation for this
script can be found at the end of this document.

Basically, however, the following should be enough to install the package:

$ ruby setup.rb config
$ ruby setup.rb setup
# ruby setup.rb install

("#" line may require root privilege)


Documentation
-------------

To create documentation for Ruby-Ifconfig, use rdoc as follows:

$ rdoc -x CVS lib

rdoc has been bundled with Ruby since 1.8.1, but you may care to use
a newer version from Ruby's CVS. Information on that can be found here:

http://www.ruby-lang.org/en/20020106.html



-----------------------------------------------------------------------------

Full instructions for setup.rb:

Details
-------

Usage of install.rb/setup.rb is:

ruby install.rb <global options>
ruby install.rb [<global options>] <task> [<task options>]


-q,--quiet
suppress message outputs
--verbose
output messages verbosely (default)
-h,--help
prints help and quit
-v,--version
prints version and quit
--copyright
prints copyright and quit

These are acceptable tasks:
config
saves configurations
show
prints current configurations
setup
compiles extentions
install
installs files
clean
cleans created files

Task Options for Config
-----------------------

--prefix=PATH
a prefix of the installing directory path
--std-ruby=PATH
the directory for standard ruby libraries
--site-ruby-common=PATH
the directory for version-independent non-standard
ruby libraries
--site-ruby=PATH
the directory for non-standard ruby libraries
--bin-dir=PATH
the directory for commands
--rb-dir=PATH
the directory for ruby scripts
--so-dir=PATH
the directory for ruby extentions
--data-dir=PATH
the directory for shared data
--ruby-path=PATH
path to set to #! line
--ruby-prog=PATH
the ruby program using for installation
--make-prog=NAME
the make program to compile ruby extentions
--without-ext
forces to install.rb never to compile/install
ruby extentions.
--rbconfig=PATH
your rbconfig.rb to load

You can view default values of these options by typing

$ ruby install.rb --help


In addition, setup.rb accepts these options:
--with=NAME,NAME,NAME...
package names which you want to install
--without=NAME,NAME,NAME...
package names which you do not want to install

[NOTE] You can pass options for extconf.rb like this:

ruby install.rb config -- --with-tklib=/usr/lib/libtk-ja.so.8.0


Task Options for Install
------------------------

--no-harm
prints what to do and done nothing really.
--prefix=PATH
a prefix of the installing directory path.
This option may help binary package maintainers.
A default value is an empty string.

Installing Programs with setup.rb
=================================

Quick Start
-----------

Type these lines on command line:
("#" line may require root privilege)

$ ruby setup.rb config
$ ruby setup.rb setup
# ruby setup.rb install


Details
-------

Usage of setup.rb is:

ruby setup.rb <global options>
ruby setup.rb [<global options>] <task> [<task options>]


Global Options
--------------

-q,--quiet
suppress message outputs
--verbose
output messages verbosely (default)
-h,--help
prints help and quit
-v,--version
prints version and quit
--copyright
prints copyright and quit

These are acceptable tasks:
config
Checks and saves configurations.
show
Prints current configurations.
setup
Compiles ruby extentions.
install
Installs files.
clean
Cleans created files.
distclean
Cleans created files.

Task Options for CONFIG
-----------------------

--prefix=PATH
a prefix of the installing directory path
--std-ruby=PATH
the directory for standard ruby libraries
--site-ruby-common=PATH
the directory for version-independent non-standard
ruby libraries
--site-ruby=PATH
the directory for non-standard ruby libraries
--bin-dir=PATH
the directory for commands
--rb-dir=PATH
the directory for ruby scripts
--so-dir=PATH
the directory for ruby extentions
--data-dir=PATH
the directory for shared data
--ruby-path=PATH
path to set to #! line
--ruby-prog=PATH
the ruby program using for installation
--make-prog=NAME
the make program to compile ruby extentions
--without-ext
forces to setup.rb never to compile/install
ruby extentions.
--rbconfig=PATH
your rbconfig.rb to load

You can view default values of these options by typing

$ ruby setup.rb --help


If there's the directory named "packages",
You can also use these options:
--with=NAME,NAME,NAME...
Package names which you want to install.
--without=NAME,NAME,NAME...
Package names which you do not want to install.

[NOTE] You can pass options for extconf.rb like this:

ruby setup.rb config -- --with-tklib=/usr/lib/libtk-ja.so.8.0


Task Options for INSTALL
------------------------

--no-harm
prints what to do and done nothing really.
--prefix=PATH
The prefix of the installing directory path.
This option may help binary package maintainers.
A default value is an empty string.
38 changes: 38 additions & 0 deletions README
@@ -0,0 +1,38 @@
$Id: README,v 1.1.1.1 2005/07/02 19:10:57 hobe Exp $

This is a Ruby wrapper around the ifconfig command. The goal is to make
getting any information that ifconfig provides easy to access.

It was developed on Linux 2.6 with ifconfig from net-tools 1.60. It also has
support for SunOS, Darwin and Open, Free, Net, and DragonflyBSD. These have
not been thoroughly tested. Non Linux platforms call netstat for interface
packet information

Please send me ifconfig / netstat output for platforms that don't work.

see test/*.rb for usage examples.

Thanks to Peter Johnson for the *BSD examples
Thanks to Jeremy Tregunna for Darwin and DragonflyBSD support

INSTALLATION
------------

Please see the INSTALL file for details of how to install Ruby-Ifconfig

TESTING
-------
> rake
to run all the unit tests.

LICENCE
-------

This software is offered under the GNU GENERAL PUBLIC LICENSE, a copy of which
is included.

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.

--
Daniel Hobe
daniel@nightrunner.com
14 changes: 14 additions & 0 deletions Rakefile
@@ -0,0 +1,14 @@
require 'rake'
require 'rake/testtask'

$VERBOSE = true

desc "Run all unit tests"
task :default => [ :test_units ]

desc "Run the unit tests in test/"
task :test_units do
Dir.glob('test/unit/*').each do |t|
puts `/usr/bin/env ruby #{t}`
end
end
8 changes: 8 additions & 0 deletions TODO
@@ -0,0 +1,8 @@
$Id: TODO,v 1.1.1.1 2005/07/02 19:10:57 hobe Exp $

Clean up code to reduce duplicate code as much as possible.

Test on more platforms

Add concept of 'sub platform'. For example BSD->NetBSD1.4 might be different
from BSD->NetBSD1.5
17 changes: 17 additions & 0 deletions ifconfig_examples/darwin.txt
@@ -0,0 +1,17 @@
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet6 ::1 prefixlen 128
inet6 fe80::1 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet6 fe80::203:93ff:fe0a:1676 prefixlen 64 scopeid 0x4
inet 192.168.0.14 netmask 0xffffff00 broadcast 192.168.0.255
inet6 2001:5c0:8116::203:93ff:fe0a:1676 prefixlen 64 autoconf
ether 00:03:93:0a:16:76
media: autoselect (100baseTX <full-duplex>) status: active
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>
fw0: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 2030
lladdr 00:03:93:ff:fe:0a:16:76
media: autoselect <full-duplex> status: inactive
supported media: autoselect <full-duplex>
10 changes: 10 additions & 0 deletions ifconfig_examples/dragonflybsd.txt
@@ -0,0 +1,10 @@
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet6 fe80::202:44ff:fe8f:bb15%rl0 prefixlen 64 scopeid 0x2
inet 192.168.1.24 netmask 0xffffff00 broadcast 192.168.1.255
ether 00:02:44:8f:bb:15
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
inet 127.0.0.1 netmask 0xff000000
14 changes: 14 additions & 0 deletions ifconfig_examples/dragonflybsd_netstat.txt
@@ -0,0 +1,14 @@
ppp0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST> mtu 552
faith0: flags=8002<BROADCAST,MULTICAST> mtu 1500
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
rl0 1500 <Link#1> 00:02:44:8f:bb:15 606 0 549 0 0
rl0 1500 fe80:2::202 fe80:2::202:44ff: 0 - 0 - -
rl0 1500 192.168.1 192.168.1.24 605 - 544 - -
lo0 16384 <Link#2> 0 0 0 0 0
lo0 16384 ::1/128 ::1 0 - 0 - -
lo0 16384 fe80:4::1/6 fe80:4::1 0 - 0 - -
lo0 16384 127 127.0.0.1 0 - 0 - -
ppp0* 1500 <Link#3> 0 0 0 0 0
sl0* 552 <Link#4> 0 0 0 0 0
faith0* 1500 <Link#5> 0 0 0 0 0
17 changes: 17 additions & 0 deletions ifconfig_examples/freebsd.txt
@@ -0,0 +1,17 @@
xl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=3<rxcsum,txcsum>
inet 192.168.0.2 netmask 0xffffff00 broadcast 192.168.0.255
inet6 fe80::201:2ff:fec6:4bea%xl0 prefixlen 64 scopeid 0x1
ether 00:01:02:c6:4b:ea
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
rl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
inet 10.0.0.10 netmask 0xffffff00 broadcast 10.0.0.255
inet6 fe80::200:21ff:fe03:8e1%rl0 prefixlen 64 scopeid 0x1
ether 00:00:21:03:08:e1
media: Ethernet autoselect (100baseTX )
status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet 127.0.0.1 netmask 0xff000000

0 comments on commit 1142491

Please sign in to comment.