aboutsummaryrefslogtreecommitdiff
path: root/net.Linux
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-30 10:26:52 +0000
committerRoy Marples <roy@marples.name>2008-01-30 10:26:52 +0000
commite675b2e00579618c54064c4ac80e221c7531f280 (patch)
tree1f74a83f0651bbd80ecd34f0d7964b713952d367 /net.Linux
parentee9476223da866694f1b6532744dd879b9dfc5fb (diff)
Allow openvpn options to be specified. If options exist then for tunctl then we prefer that to openvpn, unless openvpn options exist.
Diffstat (limited to 'net.Linux')
-rw-r--r--net.Linux/tuntap.sh23
1 files changed, 18 insertions, 5 deletions
diff --git a/net.Linux/tuntap.sh b/net.Linux/tuntap.sh
index 7c789620..62008135 100644
--- a/net.Linux/tuntap.sh
+++ b/net.Linux/tuntap.sh
@@ -32,12 +32,25 @@ tuntap_pre_start()
# Set the base metric to 1000
metric=1000
- if type tunctl >/dev/null 2>&1; then
- local opts=
- eval opts=\$tunctl_${IFVAR}
- tunctl ${opts} -t "${IFACE}" >/dev/null
+ local o_opts= t_opts= do_open=false do_tunctl=false
+ eval o_opts=\$openvpn_${IFVAR}
+ eval t_opts=\$tunctl_${IFVAR}
+
+ if [ -n "${o_opts}" ] && type openvpn >/dev/null 2>&1; then
+ do_open=true
+ elif [ -n "${t_opts}" ] && type tunctl >/dev/null 2>&1; then
+ do_tunctl=true
+ elif type openvpn >/dev/null 2>&1; then
+ do_openvpn=true
+ else
+ do_tunctl=true
+ fi
+
+ if ${do_openvpn}; then
+ openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" \
+ ${o_opts} >/dev/null
else
- openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" >/dev/null
+ tunctl ${t_opts} -t "${IFACE}" >/dev/null
fi
eend $? && _up && service_set_value tuntap "${tuntap}"
}