net/tuntap: fix return code when tools can't be found
This module should return failure if iproute2, openvpn or tunctl cannot be found. Before it was returning success; this fixes the issue.
This commit is contained in:
parent
a38a5071f3
commit
ce9994f7ca
@ -16,6 +16,7 @@ _is_tuntap()
|
|||||||
tuntap_pre_start()
|
tuntap_pre_start()
|
||||||
{
|
{
|
||||||
local tuntap=
|
local tuntap=
|
||||||
|
local rc=
|
||||||
eval tuntap=\$tuntap_${IFVAR}
|
eval tuntap=\$tuntap_${IFVAR}
|
||||||
|
|
||||||
[ -z "${tuntap}" ] && return 0
|
[ -z "${tuntap}" ] && return 0
|
||||||
@ -66,16 +67,20 @@ tuntap_pre_start()
|
|||||||
|
|
||||||
if ${do_iproute2}; then
|
if ${do_iproute2}; then
|
||||||
ip tuntap add dev "${IFACE}" mode "${tuntap}" ${i_opts}
|
ip tuntap add dev "${IFACE}" mode "${tuntap}" ${i_opts}
|
||||||
|
rc=$?
|
||||||
elif ${do_openvpn}; then
|
elif ${do_openvpn}; then
|
||||||
openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" \
|
openvpn --mktun --dev-type "${tuntap}" --dev "${IFACE}" \
|
||||||
${o_opts} >/dev/null
|
${o_opts} >/dev/null
|
||||||
|
rc=$?
|
||||||
elif ${do_tunctl}; then
|
elif ${do_tunctl}; then
|
||||||
tunctl ${t_opts} -t "${IFACE}" >/dev/null
|
tunctl ${t_opts} -t "${IFACE}" >/dev/null
|
||||||
|
rc=$?
|
||||||
else
|
else
|
||||||
eerror "Neither iproute2, openvpn nor tunctl has been found, please install"
|
eerror "Neither iproute2, openvpn nor tunctl has been found, please install"
|
||||||
eerror "either \"iproute2\" \"openvpn\" or \"usermode-utilities\"."
|
eerror "either \"iproute2\" \"openvpn\" or \"usermode-utilities\"."
|
||||||
|
rc=1
|
||||||
fi
|
fi
|
||||||
eend $? && _up && service_set_value tuntap "${tuntap}"
|
eend $rc && _up && service_set_value tuntap "${tuntap}"
|
||||||
}
|
}
|
||||||
|
|
||||||
tuntap_post_stop()
|
tuntap_post_stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user