From 4afbfa91c0fe1165fdcc9d196ae6e15d26f159a6 Mon Sep 17 00:00:00 2001 From: nick Date: Wed, 27 Aug 2014 09:06:44 +0100 Subject: [PATCH 1/4] tests: Add a create-many-IPs-in-parallel test, as this is a common operation --- test/t_route.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/t_route.rb b/test/t_route.rb index a9ab25c..acab915 100644 --- a/test/t_route.rb +++ b/test/t_route.rb @@ -40,6 +40,28 @@ class TestAddr < Test::Unit::TestCase end end + test "massively parallel IP address addition" do + @ifname = create_test_interface + + ips = (10..20).map {|y| (1..254).map {|z| "10.100.#{y}.#{z}" } }.flatten.compact + + threads = ips.map {|ip| + Thread.new { + Linux::Netlink::Route::Socket.new.addr.add( + :index => @ifname, + :local => ip, + :prefixlen => 8 + ) + } + } + + threads.map(&:join) + created = @ip.addr.list(:index => @ifname, :family => Socket::AF_INET). + map {|ifaddr| ifaddr.address.to_s } + + ips.each {|ip| assert created.include?( ip ), "#{ip} was not created" } + end + def create_test_interface(ifname = "test_#{$$}") begin @ip.link.add( From 6ebbdbbf87d61e96babcc84fb9280276248009c8 Mon Sep 17 00:00:00 2001 From: nick Date: Wed, 27 Aug 2014 10:24:13 +0100 Subject: [PATCH 2/4] Update gemspec --- netlinkrb.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netlinkrb.gemspec b/netlinkrb.gemspec index cdf2135..4952326 100644 --- a/netlinkrb.gemspec +++ b/netlinkrb.gemspec @@ -5,9 +5,9 @@ $:.unshift lib unless $:.include? lib Gem::Specification.new do |s| s.name = "netlinkrb" - s.version = "0.12" + s.version = "0.16" s.platform = Gem::Platform::RUBY - s.authors = ["Brian Candler", "Matthew Bloch", "Patrick Cherry", "Alex Young"] + s.authors = ["Brian Candler", "Matthew Bloch", "Patrick Cherry", "Alex Young", "Nicholas Thomas"] s.email = ["matthew@bytemark.co.uk"] s.summary = "Interface to Linux' Netlink API" s.description = "Ruby native interface to the Netlink API which avoids shelling out to command-line tools as much as possible." From 981eb2ec2998db34dd5d26b5b556db0666a356ea Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Wed, 1 Apr 2015 22:43:20 +0100 Subject: [PATCH 3/4] Version bump --- netlinkrb.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlinkrb.gemspec b/netlinkrb.gemspec index 4952326..0e69d72 100644 --- a/netlinkrb.gemspec +++ b/netlinkrb.gemspec @@ -5,7 +5,7 @@ $:.unshift lib unless $:.include? lib Gem::Specification.new do |s| s.name = "netlinkrb" - s.version = "0.16" + s.version = "0.17" s.platform = Gem::Platform::RUBY s.authors = ["Brian Candler", "Matthew Bloch", "Patrick Cherry", "Alex Young", "Nicholas Thomas"] s.email = ["matthew@bytemark.co.uk"] From aa45b7fa3e58ba71b7530d28256c4ffc579d3c56 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Wed, 1 Apr 2015 22:43:23 +0100 Subject: [PATCH 4/4] Added tag 0.17 for changeset ecf38b43dd66