owsd: fix loading of dhcp entries refs #9908

- config_load dhcp was called while parsing owsd config,
	thus overwritting the latter.
	- fixed this by loading and parsing the dhcp config before
	loading and parsing the owsd config.
	- this issue resulted in owsd not loading the config for
	wan:80, thus no gui available, refs #9908.
This commit is contained in:
Alex Oprea 2016-08-23 14:40:10 +02:00 committed by Sukru Senli
parent 96066cef33
commit ad4b3de384

View file

@ -9,6 +9,26 @@ USE_PROCD=1
PROG=/usr/bin/owsd PROG=/usr/bin/owsd
CONFIGFILE="/etc/config/owsd" CONFIGFILE="/etc/config/owsd"
DHCP_DOMAINS=""
load_dhcp_domains() {
append_domain() {
local domain=$1
DHCP_DOMAINS="$DHCP_DOMAINS $domain"
}
dhcp_domain_section() {
local section=$1
local ip
config_get ip "$section" ip
[ -z "$ip" ] && config_list_foreach "$section" "name" append_domain
}
config_load dhcp # note: do not overload a config while parsing it
config_foreach dhcp_domain_section "domain"
}
validate_owsd() { validate_owsd() {
uci_validate_section "owsd" "owsd" "global" \ uci_validate_section "owsd" "owsd" "global" \
'sock:string' \ 'sock:string' \
@ -88,23 +108,19 @@ parse_owsd_iface() {
config_list_foreach "$1" "origin" append_origin config_list_foreach "$1" "origin" append_origin
if [ -n "$whitelist_dhcp_domains" ]; then if [ -n "$whitelist_dhcp_domains" ]; then
append_domain() { http="http${cert:+s}"
append_origin_parts "http${cert:+s}" "$1" "${port}" for domain in $DHCP_DOMAINS; do
} append_origin_parts "$http" "$domain" "$port"
done
dhcp_domain_section() {
local ip
config_get ip "$1" ip
[ -z "$ip" ] && config_list_foreach "$1" "name" append_domain
}
config_load dhcp
config_foreach dhcp_domain_section "domain"
fi fi
} }
start_service() { start_service() {
config_load owsd
# preload dhcp domains list, in case any interface config requires it
load_dhcp_domains
config_load owsd # note: do not overload a config while parsing it
procd_open_instance procd_open_instance
procd_set_param command $PROG procd_set_param command $PROG