Reorg to separate different NETLINK_ROUTE functions. Try adding vlan interfaces

This commit is contained in:
Brian Candler
2011-05-03 12:41:10 +01:00
parent 6688d17cab
commit 0a7297a86d
11 changed files with 585 additions and 368 deletions

View File

@@ -5,16 +5,17 @@ require 'netlink/route'
nl = Netlink::Route::Socket.new
puts "\n*** Before adding address"
nl.addrs["lo"][Socket::AF_INET].each { |x| puts x.address }
nl.if.addrs["lo"][Socket::AF_INET].each { |x| puts x.address }
begin
nl.add_addr(:index=>"lo", :local=>"1.2.3.4", :prefixlen=>32)
rescue Errno::EEXIST
end
puts "\n*** After adding address"
nl.addrs["lo"][Socket::AF_INET].each { |x| puts x.address }
begin
nl.if.add_addr(:index=>"lo", :local=>"1.2.3.4", :prefixlen=>32)
rescue Errno::EEXIST
puts "Already exists"
end
nl.if.addrs["lo"][Socket::AF_INET].each { |x| puts x.address }
nl.delete_addr(:index=>"lo", :local=>"1.2.3.4", :prefixlen=>32)
puts "\n*** After deleting address"
nl.addrs["lo"][Socket::AF_INET].each { |x| puts x.address }
nl.if.delete_addr(:index=>"lo", :local=>"1.2.3.4", :prefixlen=>32)
nl.if.addrs["lo"][Socket::AF_INET].each { |x| puts x.address }