Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

siproxd: init requires that interface_inbound and interface_outbound … #801

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions net/siproxd/files/siproxd.init
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ START=50

USE_PROCD=1

die() {
local err=$1; shift
echo "siproxd[ERROR]: $*" >&2
exit $err
}

PROG="/usr/sbin/siproxd"
CONF_DIR="/var/etc/siproxd"
REG_DIR="/var/lib/siproxd"
Expand Down Expand Up @@ -45,18 +51,28 @@ append_conf() {

setup_networks() {
local sec="$1"
local _int_inbound _int_outbound
local _dev_inbound _dev_outbound
local _int _dev _up

for _role in inbound outbound; do
config_get _int "$sec" interface_$_role
[ -z $_int ] && die 1 "$sec.interface_$_role not defined"

ubus -t 30 wait_for network.interface.$_int 2> /dev/null || die 1 "$sec.interface_$_role - $_int isn't a valid interface"

config_get _int_inbound "$sec" interface_inbound
config_get _int_outbound "$sec" interface_outbound
for i in `seq 30`; do
if [ -z $_dev ]; then
_dev=`ifstatus $_int | jsonfilter -qe '$.l3_device'`
else
_up=`ifstatus $_int | jsonfilter -qe '$.up'`
[ $_up = true ] && break
fi

. /lib/functions/network.sh
network_get_physdev _dev_inbound $_int_inbound
network_get_physdev _dev_outbound $_int_outbound
[ $i -eq 30 ] && die 1 "$sec.interface_$_role - $_int timeout, interface not up"
sleep 1
done

default_conf if_inbound $_dev_inbound
default_conf if_outbound $_dev_outbound
default_conf if_$_role $_dev
done
}

# Apply default values to key options if unset in user's UCI config.
Expand Down