net-ip 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/net/ip/route/collection.rb +3 -3
- data/lib/net/ip/route.rb +0 -1
- data/lib/net/ip/version.rb +1 -1
- data/lib/net/ip.rb +3 -2
- metadata +4 -4
@@ -7,7 +7,7 @@ module Net
|
|
7
7
|
class Collection
|
8
8
|
include Enumerable
|
9
9
|
|
10
|
-
def initialize(table
|
10
|
+
def initialize(table)
|
11
11
|
@table = table
|
12
12
|
end
|
13
13
|
|
@@ -38,7 +38,7 @@ module Net
|
|
38
38
|
# @return {void}
|
39
39
|
def update_gateways(gateways)
|
40
40
|
params = gateways.collect {|gateway| "nexthop " + gateway.to_params}
|
41
|
-
result = `ip route replace default #{params.join(" ")}`
|
41
|
+
result = `ip route replace default table #{@table} #{params.join(" ")}`
|
42
42
|
raise result unless $?.success?
|
43
43
|
end
|
44
44
|
|
@@ -49,7 +49,7 @@ module Net
|
|
49
49
|
# @param route {Route} Route to add to the table.
|
50
50
|
# @return {void}
|
51
51
|
def add(route)
|
52
|
-
result = `ip route add #{route.to_params}`
|
52
|
+
result = `ip route add table #{@table} #{route.to_params}`
|
53
53
|
raise result unless $?.success?
|
54
54
|
end
|
55
55
|
|
data/lib/net/ip/route.rb
CHANGED
@@ -22,7 +22,6 @@ module Net
|
|
22
22
|
str << "via #{@via} " if @via
|
23
23
|
str << "dev #{@dev} " if @dev
|
24
24
|
str << "weight #{@weight}" if @weight
|
25
|
-
str << " table #{@table} " if @table
|
26
25
|
str << " proto #{@proto} " if @proto
|
27
26
|
str << " scope #{@scope} " if @scope
|
28
27
|
str << " src #{@src} " if @src
|
data/lib/net/ip/version.rb
CHANGED
data/lib/net/ip.rb
CHANGED
@@ -5,9 +5,10 @@ require "net/ip/rule/collection"
|
|
5
5
|
module Net
|
6
6
|
module IP
|
7
7
|
# Get list of routes
|
8
|
+
# @param table {String} The name of the routing table
|
8
9
|
# @return {Route::Collection}
|
9
|
-
def self.routes
|
10
|
-
Route::Collection.new
|
10
|
+
def self.routes(table = "main")
|
11
|
+
Route::Collection.new(table)
|
11
12
|
end
|
12
13
|
|
13
14
|
# Get list of rules
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -106,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
segments:
|
108
108
|
- 0
|
109
|
-
hash: -
|
109
|
+
hash: -2536851174243620573
|
110
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
111
|
none: false
|
112
112
|
requirements:
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
segments:
|
117
117
|
- 0
|
118
|
-
hash: -
|
118
|
+
hash: -2536851174243620573
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
121
|
rubygems_version: 1.8.25
|