diff --git a/net/dtcp/Makefile b/net/dtcp/Makefile index c97b6ff91027..860bb086068d 100644 --- a/net/dtcp/Makefile +++ b/net/dtcp/Makefile @@ -1,28 +1,28 @@ PORTNAME= dtcp PORTVERSION= 20130602 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= net MASTER_SITES= http://www.mahoroba.org/~ume/ipv6/ MAINTAINER= ume@FreeBSD.org COMMENT= Dynamic Tunnel Configuration Protocol daemon and client LICENSE= BSD3CLAUSE RUN_DEPENDS= rubygem-dbm>0:databases/rubygem-dbm .if defined(WITH_QPOPAUTH) RUN_DEPENDS+= qpopauth:mail/qpopper .endif USES= uidfix USE_RC_SUBR= dtcpc dtcps USE_RUBY= yes MAKE_ENV+= RUBY=${RUBY} SUB_LIST+= RUBY=${RUBY} PLIST_FILES= sbin/dtcpauth sbin/dtcpc sbin/dtcps \ man/man8/dtcpauth.8.gz man/man8/dtcpc.8.gz \ man/man8/dtcps.8.gz .include diff --git a/net/dtcp/files/patch-dtcpc.rb b/net/dtcp/files/patch-dtcpc.rb index a63ead05b960..e6395dd936e6 100644 --- a/net/dtcp/files/patch-dtcpc.rb +++ b/net/dtcp/files/patch-dtcpc.rb @@ -1,70 +1,91 @@ -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 @@ +--- dtcpc.rb.orig 2013-06-02 14:05:51 UTC ++++ dtcpc.rb +@@ -422,6 +422,10 @@ class Interface 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 @@ +@@ -461,6 +465,9 @@ class ClonedInterface < Interface end } end + if $fibnum >= 0 + setfib($fibnum) + end @created = true end -@@ -520,6 +527,9 @@ +@@ -520,6 +527,9 @@ class NetgraphInterface < Interface if !@tunif || @tunif == "ng" @name = mkpeer @created = true + if $fibnum >= 0 + setfib($fibnum) + end return end -@@ -535,6 +545,9 @@ +@@ -531,10 +541,13 @@ class NetgraphInterface < Interface + shutdown(@tunif) + + bogus = Array.new +- while TRUE ++ while true @name = mkpeer if @name == @tunif @created = true + if $fibnum >= 0 + setfib($fibnum) + end break end -@@ -927,6 +940,7 @@ +@@ -899,7 +912,7 @@ class DTCPClient + + def keep_alive(sock) + begin +- while TRUE ++ while true + debugmsg("sleep(60)\n") + sleep 60 + sendmsg(sock, "ping") +@@ -927,6 +940,7 @@ ousername = username password = '' tunif = TUNIF cloning = TUNIF_CLONING +$fibnum = -1 tuntype = 'tunnelonly' route_type = 'static' static_routes = 'default' -@@ -949,7 +963,7 @@ +@@ -949,7 +963,7 @@ pidfile = PIDFILE # 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 @@ +@@ -965,6 +979,7 @@ cloning = false if params["c"] $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"] +@@ -1013,7 +1028,7 @@ begin + rtadvd_disable) + dtcpc = DTCPClient.new(dst, port, username, password, tuntype, behind_nat, + mtu, udp_tunnel, udp_tunnel_port) +- while TRUE ++ while true + interrupt = nil + begin + trap("SIGHUP") { diff --git a/net/dtcp/files/patch-dtcps.rb b/net/dtcp/files/patch-dtcps.rb index bea1832ee408..a12c07ecf5c5 100644 --- a/net/dtcp/files/patch-dtcps.rb +++ b/net/dtcp/files/patch-dtcps.rb @@ -1,93 +1,123 @@ -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-22 17:24:50.868385076 +0900 -@@ -185,6 +185,18 @@ +--- dtcps.rb.orig 2013-06-02 14:05:51 UTC ++++ dtcps.rb +@@ -185,6 +185,18 @@ class Interface 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 +238,9 @@ +@@ -226,6 +238,9 @@ class ClonedInterface < Interface end } end + if $fibnum >= 0 + setfib($fibnum) + end @created = true end -@@ -291,6 +306,9 @@ +@@ -291,6 +306,9 @@ class NetgraphInterface < Interface if !@tunif || @tunif == "ng" @name = mkpeer @created = true + if $fibnum >= 0 + setfib($fibnum) + end return end -@@ -306,6 +324,9 @@ +@@ -302,10 +320,13 @@ class NetgraphInterface < Interface + shutdown(@tunif) + + bogus = Array.new +- while TRUE ++ while true @name = mkpeer if @name == @tunif @created = true + if $fibnum >= 0 + setfib($fibnum) + end break end -@@ -724,6 +745,7 @@ +@@ -724,6 +745,7 @@ class Tunnel } delpeer(@tunif, @info[3], @info[2]) end + tunif.setdescr _delete(@tunif) @tunif = nil end -@@ -769,6 +791,7 @@ +@@ -769,6 +791,7 @@ class Tunnel 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 @@ +@@ -883,7 +906,7 @@ end + def checktraffic(tun) + return if TRAFFICTIMEOUT == 0 + ipkts = getipkts(tun.name) +- while TRUE ++ while true + sleep TRAFFICTIMEOUT + i = getipkts(tun.name) + next if i == -1 +@@ -899,7 +922,7 @@ end + + def service_dtcp(sock, name) + debugmsg("service_dtcp(#{sock}, #{name})\n") +- while TRUE ++ while true + debugmsg("service_dtcp(#{sock}, #{name}) accepting\n") + Thread.start(sock.accept) { |s| + debugmsg("service_dtcp(#{sock}, #{name}) accepted #{s}\n") +@@ -912,7 +935,7 @@ def service_dtcp(sock, name) + + # check response + # tunnel itojun RESPONSE type +- while TRUE ++ while true + t = IO.select([s], [], [s], tun == nil ? AUTHTIMEOUT : TUNTIMEOUT) + if t == nil + s.print "-ERR connection timed out, disconnecting\r\n" +@@ -1173,13 +1196,14 @@ port = 20200 $tunif = TUNIF $ng_tunif = "ng" $cloning = TUNIF_CLONING +$fibnum = -1 $global = nil $prefix = nil $network_with_peeraddr = nil $udp_tunnel_port = UDP_TUNNEL_PORT begin - params = ARGV.getopts('ab:cdDg:i:I:op:U') + params = ARGV.getopts('ab:cdDF:g:i:I:op:U') rescue usage() exit 0 -@@ -1190,6 +1214,7 @@ +@@ -1190,6 +1214,7 @@ $udp_tunnel_port = params["b"].to_i if params["b"] $cloning = false if params["c"] $debug = params["d"] $daemonize = !params["D"] +$fibnum = params["F"].to_i if params["F"] $global = params["g"] if params["g"] $tunif = params["i"] if params["i"] $ng_tunif = params["I"] if params["I"]