tinc expects long parameters to be in the form "--name=value" and the
current init scripts generate "--name value" parameters. See `tincd
--help` to confirm. Also, the config/tinc and init.d/tinc incorrectly
use the parameter "log" when it should be "logfile".

Signed-off-by: Sandy McArthur, Jr. <sa...@mcarthur.org>
---
Attempting a resubmit that patchwork.openwrt.org will pick up. Patch
is included inline instead of as attachment.


diff --git a/net/tinc/files/tinc.config b/net/tinc/files/tinc.config
index f9f2b53..1894078 100644
--- a/net/tinc/files/tinc.config
+++ b/net/tinc/files/tinc.config
@@ -4,7 +4,7 @@ config tinc-net NETNAME
  ## Daemon Configuration (cmd arguments)
  #option generate_keys 0
  #option key_size 2048
- #option log /tmp/log/tinc.NETNAME.log
+ #option logfile /tmp/log/tinc.NETNAME.log
  #option debug 3

  ## Server Configuration (tinc.conf)
diff --git a/net/tinc/files/tinc.init b/net/tinc/files/tinc.init
index 9ab1bd0..b24bc68 100644
--- a/net/tinc/files/tinc.init
+++ b/net/tinc/files/tinc.init
@@ -42,7 +42,7 @@ append_params() {
  config_get v "$s" "$p"
  IFS="$LIST_SEP"
  for v in $v; do
- [ -n "$v" ] && append_param "$p" && ARGS="$ARGS $v"
+ [ -n "$v" ] && append_param "$p" && ARGS="$ARGS=$v"
  done
  unset IFS
  done
@@ -169,7 +169,7 @@ start_instance() {
  ARGS=""

  # append params
- append_params "$s" log debug
+ append_params "$s" logfile debug

  SERVICE_PID_FILE="/var/run/tinc.$s.pid"
  service_start $BIN -c "$TMP_TINC/$s" -n $s $ARGS --pidfile="$SERVICE_PID_FILE"


On Tue, Apr 30, 2013 at 12:36 PM, Sandy McArthur Jr <sa...@mcarthur.org> wrote:
> Luka,
> I tried your suggestion as it made sense but when I tried the extra quoting 
> of:
>
> [ -n "$v" ] && append_param "$p" && ARGS="$ARGS=\"$v\""
>
> I get the error:
>
> # /etc/init.d/tinc start
> Could not open log file "/tmp/log/tinc.thelans.log-test": No such file
> or directory
>
>
> The patch I sent was discovered in my attempt to get Tinc working as
> described here:
> https://forum.openwrt.org/viewtopic.php?id=43869 (I could still use some 
> help.)
>
>
> Without my patch using these relevant config settings:
>
> config tinc-net thelans
>         option log /tmp/log/tinc.thelans.log-test
>         option debug 3
>
> I get:
>
> # ps w | grep tinc
>  9587 root      3128 S    /usr/sbin/tincd -c /tmp/tinc/thelans -n
> thelans --log /tmp/log/tinc.thelans.log-test --debug 3
> --pidfile=/var/run/tin
>
> # head -n 1 /tmp/log/tinc.thelans.log-test
> head: /tmp/log/tinc.thelans.log-test: No such file or directory
>
> # ls /tmp/log/tinc.*
> /tmp/log/tinc.thelans.log
>
> # head -n 1 /tmp/log/tinc.thelans.log
> 2013-04-30 12:14:15 tinc.thelans[9587]: tincd 1.0.19 (Mar 14 2013
> 12:15:49) starting, debug level 1
>
> Note that the log file name was not used and the start of the log file
> indicates a debug level of 1. `tincd --help` says "-d, --debug[=LEVEL]
>            Increase debug level or set it to LEVEL." which means the
> "--debug 3" only increased the debug level by one.
>
>
> With the patch I suggested using this relevant config:
>
> config tinc-net thelans
>         option logfile /tmp/log/tinc.thelans.log-test
>         option debug 3
>
> I get:
>
> # ps w | grep tinc
>  9665 root      3128 S    /usr/sbin/tincd -c /tmp/tinc/thelans -n
> thelans --logfile=/tmp/log/tinc.thelans.log-test --debug=3
> --pidfile=/var/run
>
> # head -n 1 /tmp/log/tinc.thelans.log-test
> 2013-04-30 12:19:43 tinc.thelans[9665]: tincd 1.0.19 (Mar 14 2013
> 12:15:49) starting, debug level 3
>
> Note that the log file name was used and the debug level was set to 3
> as specified in the config file.
>
>
> After collecting the examples above I thought to test if
> --log=/tmp/log/tinc.thelans.log-test worked and it does seem to. I
> still feel it's best to use --logfile as that is what the tinc
> help/docs say to use.
>
> Relevant tinc docs:
> http://www.tinc-vpn.org/documentation/tinc_5.html#Runtime-options
> or
> # tincd --help
> Usage: tincd [option]...
>
>   -c, --config=DIR               Read configuration options from DIR.
>   -D, --no-detach                Don't fork and detach.
>   -d, --debug[=LEVEL]            Increase debug level or set it to LEVEL.
>   -k, --kill[=SIGNAL]            Attempt to kill a running tincd and exit.
>   -n, --net=NETNAME              Connect to net NETNAME.
>   -K, --generate-keys[=BITS]     Generate public/private RSA keypair.
>   -L, --mlock                    Lock tinc into main memory.
>       --logfile[=FILENAME]       Write log entries to a logfile.
>       --pidfile=FILENAME         Write PID to FILENAME.
>   -o, --option=[HOST.]KEY=VALUE  Set global/host configuration value.
>   -R, --chroot                   chroot to NET dir at startup.
>   -U, --user=USER                setuid to given USER at startup.
>       --help                     Display this help and exit.
>       --version                  Output version information and exit.
>
>
>
> On Tue, Apr 30, 2013 at 3:47 AM, Luka Perkov <l...@openwrt.org> wrote:
>> Hi Sandy,
>>
>> On Mon, Apr 29, 2013 at 11:00:00PM -0400, Sandy McArthur Jr wrote:
>>> tinc expects long parameters to be in the form "--name=value" and the
>>> current init scripts generate "--name value" parameters.
>>
>> I don't think that matters. Also look bellow...
>>
>>>+++ b/net/tinc/files/tinc.init
>>>@@ -42,7 +42,7 @@ append_params() {
>>>                config_get v "$s" "$p"
>>>                IFS="$LIST_SEP"
>>>                for v in $v; do
>>>-                       [ -n "$v" ] && append_param "$p" && ARGS="$ARGS $v"
>>>+                       [ -n "$v" ] && append_param "$p" && ARGS="$ARGS=$v"
>>
>> If we are going to nitpick I would say it should be done like this:
>>
>> [ -n "$v" ] && append_param "$p" && ARGS="$ARGS=\"$v\""
>>
>>>                done
>>>                unset IFS
>>>        done
>>
>> Luka
>
>
>
> --
> Sandy McArthur, Jr.
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to