Rename plural to singular; cleaner and more consistent with 'ip' utility

This commit is contained in:
Brian Candler
2011-05-03 19:13:37 +01:00
parent 834f7a83d6
commit 9bfa6e5b2c
10 changed files with 76 additions and 76 deletions

View File

@@ -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 route"
nl.routes.list(:family=>Socket::AF_INET, :table=>Netlink::RT_TABLE_MAIN) { |x| p x }
ip.route.list(:family=>Socket::AF_INET, :table=>Netlink::RT_TABLE_MAIN) { |x| p x }
puts "\n*** After adding route"
begin
nl.routes.add(:oif=>"lo", :dst=>"1.2.3.4", :dst_len=>32, :gateway=>"127.0.0.1")
ip.route.add(:oif=>"lo", :dst=>"1.2.3.4", :dst_len=>32, :gateway=>"127.0.0.1")
rescue Errno::EEXIST
puts "Already exists"
end
nl.routes.list(:family=>Socket::AF_INET, :table=>Netlink::RT_TABLE_MAIN) { |x| p x }
ip.route.list(:family=>Socket::AF_INET, :table=>Netlink::RT_TABLE_MAIN) { |x| p x }
puts "\n*** After deleting route"
nl.routes.delete(:oif=>"lo", :dst=>"1.2.3.4", :dst_len=>32, :gateway=>"127.0.0.1")
nl.routes.list(:family=>Socket::AF_INET, :table=>Netlink::RT_TABLE_MAIN) { |x| p x }
ip.route.delete(:oif=>"lo", :dst=>"1.2.3.4", :dst_len=>32, :gateway=>"127.0.0.1")
ip.route.list(:family=>Socket::AF_INET, :table=>Netlink::RT_TABLE_MAIN) { |x| p x }