mirror of https://github.com/hak5/openwrt-owl.git
relayd: fix making incomplete instance json data
Defer procd_open_instance only after validity check passed. Fixes FS#541 Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>owl
parent
699976e61d
commit
699eedace0
|
@ -8,7 +8,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=relayd
|
PKG_NAME:=relayd
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_SOURCE_URL=$(LEDE_GIT)/project/relayd.git
|
PKG_SOURCE_URL=$(LEDE_GIT)/project/relayd.git
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
|
|
|
@ -19,8 +19,7 @@ validate_proto_relayd()
|
||||||
|
|
||||||
resolve_ifname() {
|
resolve_ifname() {
|
||||||
grep -qs "^ *$1:" /proc/net/dev && {
|
grep -qs "^ *$1:" /proc/net/dev && {
|
||||||
procd_append_param command -I "$1"
|
append resolved_ifnames "$1"
|
||||||
procd_append_param netdev "$1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +33,7 @@ resolve_network() {
|
||||||
|
|
||||||
start_relay() {
|
start_relay() {
|
||||||
local cfg="$1"
|
local cfg="$1"
|
||||||
|
local proto disabled
|
||||||
|
|
||||||
config_get proto "$cfg" proto
|
config_get proto "$cfg" proto
|
||||||
[ "$proto" = "relay" ] || return 0
|
[ "$proto" = "relay" ] || return 0
|
||||||
|
@ -41,9 +41,7 @@ start_relay() {
|
||||||
config_get_bool disabled "$cfg" disabled 0
|
config_get_bool disabled "$cfg" disabled 0
|
||||||
[ "$disabled" -gt 0 ] && return 0
|
[ "$disabled" -gt 0 ] && return 0
|
||||||
|
|
||||||
procd_open_instance
|
local resolved_ifnames
|
||||||
procd_set_param command "$PROG"
|
|
||||||
|
|
||||||
local net networks
|
local net networks
|
||||||
config_get networks "$cfg" network
|
config_get networks "$cfg" network
|
||||||
for net in $networks; do
|
for net in $networks; do
|
||||||
|
@ -55,9 +53,18 @@ start_relay() {
|
||||||
local ifn ifnames
|
local ifn ifnames
|
||||||
config_get ifnames "$cfg" ifname
|
config_get ifnames "$cfg" ifname
|
||||||
for ifn in $ifnames; do
|
for ifn in $ifnames; do
|
||||||
resolve_ifname "$ifn"
|
resolve_ifname "$ifn" || {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
procd_open_instance
|
||||||
|
procd_set_param command "$PROG"
|
||||||
|
|
||||||
|
for ifn in $resolved_ifnames; do
|
||||||
|
procd_append_param command -I "$ifn"
|
||||||
|
procd_append_param netdev "$ifn"
|
||||||
|
done
|
||||||
local ipaddr
|
local ipaddr
|
||||||
config_get ipaddr "$cfg" ipaddr
|
config_get ipaddr "$cfg" ipaddr
|
||||||
[ -n "$ipaddr" ] && procd_append_param command -L "$ipaddr"
|
[ -n "$ipaddr" ] && procd_append_param command -L "$ipaddr"
|
||||||
|
|
Loading…
Reference in New Issue