2011-04-30 22:39:25 +01:00
|
|
|
LIBDIR = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
|
|
$LOAD_PATH.unshift LIBDIR
|
|
|
|
|
|
|
|
require 'pp'
|
|
|
|
require 'netlink/route'
|
|
|
|
|
|
|
|
# Example of use of low-level API for NETLINK_ROUTE socket.
|
|
|
|
# Each of these method calls performs a netlink protocol exchange.
|
|
|
|
|
2011-05-03 19:13:37 +01:00
|
|
|
ip = Netlink::Route::Socket.new
|
2011-04-30 22:39:25 +01:00
|
|
|
puts "*** links ***"
|
2011-05-03 19:13:37 +01:00
|
|
|
pp ip.link.read_link
|
2011-04-30 22:39:25 +01:00
|
|
|
puts "*** addrs ***"
|
2011-05-03 19:13:37 +01:00
|
|
|
pp ip.addr.read_addr
|
2011-04-30 22:39:25 +01:00
|
|
|
puts "*** routes ***"
|
2011-05-03 19:13:37 +01:00
|
|
|
pp ip.route.read_route
|