Rename plural to singular; cleaner and more consistent with 'ip' utility
This commit is contained in:
@@ -3,19 +3,19 @@ $LOAD_PATH.unshift LIBDIR
|
||||
|
||||
require 'netlink/route'
|
||||
|
||||
nl = Netlink::Route::Socket.new
|
||||
ip = Netlink::Route::Socket.new
|
||||
puts "\n*** Before adding address"
|
||||
nl.addrs.list(:index=>"lo", :family=>Socket::AF_INET) { |x| puts x.address }
|
||||
ip.addr.list(:index=>"lo", :family=>Socket::AF_INET) { |x| puts x.address }
|
||||
|
||||
puts "\n*** After adding address"
|
||||
begin
|
||||
nl.addrs.add(:index=>"lo", :local=>"1.2.3.4", :prefixlen=>32)
|
||||
ip.addr.add(:index=>"lo", :local=>"1.2.3.4", :prefixlen=>32)
|
||||
rescue Errno::EEXIST
|
||||
puts "Already exists"
|
||||
end
|
||||
nl.addrs.list(:index=>"lo", :family=>Socket::AF_INET) { |x| puts x.address }
|
||||
ip.addr.list(:index=>"lo", :family=>Socket::AF_INET) { |x| puts x.address }
|
||||
|
||||
puts "\n*** After deleting address"
|
||||
nl.addrs.delete(:index=>"lo", :local=>"1.2.3.4", :prefixlen=>32)
|
||||
nl.addrs.list(:index=>"lo", :family=>Socket::AF_INET) { |x| puts x.address }
|
||||
ip.addr.delete(:index=>"lo", :local=>"1.2.3.4", :prefixlen=>32)
|
||||
ip.addr.list(:index=>"lo", :family=>Socket::AF_INET) { |x| puts x.address }
|
||||
|
||||
|
Reference in New Issue
Block a user