From 32b02e6a4760fe07d18f43861be4e3e6fa21f078 Mon Sep 17 00:00:00 2001 From: Hajimu UMEMOTO Date: Wed, 28 May 2014 17:43:27 +0000 Subject: [PATCH] - Set username to descr during interface is in use. - Make dtcpc_fib work. --- net/dtcp/Makefile | 2 +- net/dtcp/files/dtcpc.in | 3 ++ net/dtcp/files/patch-dtcpc.rb | 70 +++++++++++++++++++++++++++++++++++ net/dtcp/files/patch-dtcps.rb | 38 +++++++++++++++---- 4 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 net/dtcp/files/patch-dtcpc.rb diff --git a/net/dtcp/Makefile b/net/dtcp/Makefile index 13ab16459575..191c2313eca0 100644 --- a/net/dtcp/Makefile +++ b/net/dtcp/Makefile @@ -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/ diff --git a/net/dtcp/files/dtcpc.in b/net/dtcp/files/dtcpc.in index 0d7e32cdc0a9..3a747a3addad 100644 --- a/net/dtcp/files/dtcpc.in +++ b/net/dtcp/files/dtcpc.in @@ -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" diff --git a/net/dtcp/files/patch-dtcpc.rb b/net/dtcp/files/patch-dtcpc.rb new file mode 100644 index 000000000000..a63ead05b960 --- /dev/null +++ b/net/dtcp/files/patch-dtcpc.rb @@ -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"] diff --git a/net/dtcp/files/patch-dtcps.rb b/net/dtcp/files/patch-dtcps.rb index dd950da14526..bea1832ee408 100644 --- a/net/dtcp/files/patch-dtcps.rb +++ b/net/dtcp/files/patch-dtcps.rb @@ -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"]