summaryrefslogtreecommitdiff
path: root/net/dtcp/files/patch-dtcpc.rb
blob: a63ead05b96050d2085b9311be57c2b4a094f0f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Index: dtcpc.rb
diff -u dtcpc.rb.orig dtcpc.rb
--- dtcpc.rb.orig	2013-06-02 23:05:51.000000000 +0900
+++ dtcpc.rb	2014-05-22 17:24:50.852383194 +0900
@@ -422,6 +422,10 @@
     execute("ifconfig #{@name} mtu #{mtu}")
   end
 
+  def setfib(fibnum)
+    execute("ifconfig #{@name} fib #{fibnum}")
+  end
+
   def linklocal
     `ifconfig #{@name} inet6`.each_line { |s|
       if s =~ /inet6 (fe80::[^ ]*)/
@@ -461,6 +465,9 @@
 	end
       }
     end
+    if $fibnum >= 0
+      setfib($fibnum)
+    end
     @created = true
   end
 
@@ -520,6 +527,9 @@
     if !@tunif || @tunif == "ng"
       @name = mkpeer
       @created = true
+      if $fibnum >= 0
+	setfib($fibnum)
+      end
       return
     end
 
@@ -535,6 +545,9 @@
       @name = mkpeer
       if @name == @tunif
 	@created = true
+	if $fibnum >= 0
+	  setfib($fibnum)
+	end
 	break
       end
 
@@ -927,6 +940,7 @@
 password = ''
 tunif = TUNIF
 cloning = TUNIF_CLONING
+$fibnum = -1
 tuntype = 'tunnelonly'
 route_type = 'static'
 static_routes = 'default'
@@ -949,7 +963,7 @@
 # exit 0
 
 begin
-  params = ARGV.getopts('aA:b:cdDf:i:lm:nop:P:r:R:t:u:U')
+  params = ARGV.getopts('aA:b:cdDfF:i:lm:nop:P:r:R:t:u:U')
 rescue
   usage()
   exit 0
@@ -965,6 +979,7 @@
 $debug = params["d"]
 daemonize = params["D"]
 pidfile = params["f"] if params["f"]
+$fibnum = params["F"].to_i if params["F"]
 tunif = params["i"] if params["i"]
 loop = params["l"]
 mtu = params["m"].to_i if params["m"]