- Set username to descr during interface is in use.

- Make dtcpc_fib work.
This commit is contained in:
Hajimu UMEMOTO 2014-05-28 17:43:27 +00:00
parent a6cc458d9b
commit 32b02e6a47
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=355644
4 changed files with 105 additions and 8 deletions

View File

@ -2,7 +2,7 @@
PORTNAME= dtcp
PORTVERSION= 20130602
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= net ipv6
MASTER_SITES= http://www.mahoroba.org/~ume/ipv6/ \
http://home.jp.FreeBSD.org/~ume/ipv6/

View File

@ -32,4 +32,7 @@ extra_commands="reload"
load_rc_config $name
command_args="-u ${dtcpc_username} ${dtcpc_server}"
if [ -n "${dtcpc_fib}" ]; then
command_args="-F ${dtcpc_fib} ${command_args}"
fi
run_rc_command "$1"

View File

@ -0,0 +1,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"]

View File

@ -1,19 +1,27 @@
Index: dtcps.rb
diff -u dtcps.rb.orig dtcps.rb
--- dtcps.rb.orig 2013-06-02 23:05:51.000000000 +0900
+++ dtcps.rb 2014-05-19 01:24:45.817292755 +0900
@@ -185,6 +185,10 @@
+++ dtcps.rb 2014-05-22 17:24:50.868385076 +0900
@@ -185,6 +185,18 @@
execute("ifconfig #{@name} mtu #{mtu}")
end
+ def setfib(fibnum)
+ execute("ifconfig #{@name} fib #{fibnum}")
+ end
+
+ def setdescr(str = nil)
+ if str == nil
+ execute("ifconfig #{@name} -description >/dev/null 2>&1")
+ else
+ execute("ifconfig #{@name} description #{str} >/dev/null 2>&1")
+ end
+ end
+
def linklocal
`ifconfig #{@name} inet6`.each_line { |s|
if s =~ /inet6 (fe80::[^ ]*)/
@@ -226,6 +230,9 @@
@@ -226,6 +238,9 @@
end
}
end
@ -23,7 +31,7 @@ diff -u dtcps.rb.orig dtcps.rb
@created = true
end
@@ -291,6 +298,9 @@
@@ -291,6 +306,9 @@
if !@tunif || @tunif == "ng"
@name = mkpeer
@created = true
@ -33,7 +41,7 @@ diff -u dtcps.rb.orig dtcps.rb
return
end
@@ -306,6 +316,9 @@
@@ -306,6 +324,9 @@
@name = mkpeer
if @name == @tunif
@created = true
@ -43,7 +51,23 @@ diff -u dtcps.rb.orig dtcps.rb
break
end
@@ -1173,13 +1186,14 @@
@@ -724,6 +745,7 @@
}
delpeer(@tunif, @info[3], @info[2])
end
+ tunif.setdescr
_delete(@tunif)
@tunif = nil
end
@@ -769,6 +791,7 @@
raise 'tunnel interface sold out'
end
debugmsg("#{s}: tunnel interface #{tunif.name}\n")
+ tunif.setdescr(user)
myaddr = nil
if type == 'host' || (type == 'network' && $network_with_peeraddr)
@@ -1173,13 +1196,14 @@
$tunif = TUNIF
$ng_tunif = "ng"
$cloning = TUNIF_CLONING
@ -59,7 +83,7 @@ diff -u dtcps.rb.orig dtcps.rb
rescue
usage()
exit 0
@@ -1190,6 +1204,7 @@
@@ -1190,6 +1214,7 @@
$cloning = false if params["c"]
$debug = params["d"]
$daemonize = !params["D"]