#
-# Copyright (C) 2010-2011 OpenWrt.org
+# Copyright (C) 2010-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=multiwan
-PKG_VERSION:=1.0.21
+PKG_VERSION:=1.0.22
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
#!/bin/sh
. /lib/functions.sh
+. /lib/functions/network.sh
silencer() {
if [ -z "$debug" -o "$debug" == "0" ]; then
local old_ipaddr
local old_gateway
- local ifname=$(uci_get_state network ${1} ifname 'x')
- local ipaddr=$(uci_get_state network ${1} ipaddr 'x')
- local gateway=$(uci_get_state network ${1} gateway 'x')
+ local ifname ipaddr gateway
+ network_get_device ifname ${1} || ifname=x
+ network_get_ipaddr ipaddr ${1} || ipaddr=x
+ network_get_gateway gateway ${1} || gateway=x
check_old_map=$(echo $wan_id_map 2>&1 | grep -o "$1\[")
failchk=$(query_config failchk $group)
dns=$(uci_get_state multiwan ${group} dns 'auto')
- [ "$dns" == "auto" ] && dns=$(uci_get_state network ${group} dns)
+ [ "$dns" == "auto" ] && network_get_dnsserver dns ${group}
dns=$(echo $dns | sed -e "s/ /\n/g")
if [ ! -z "$dns" -a "$failchk" != "x" -a "$ipaddr" != "x" -a "$gateway" != "x" -a "$ifname" != "x" ]; then
while :; do
[ "${health_monitor%.*}" = 'parallel' ] && sleep $health_interval
- ifname=$(uci_get_state network ${1} ifname 'x')
- ipaddr=$(uci_get_state network ${1} ipaddr 'x')
- gateway=$(uci_get_state network ${1} gateway 'x')
+ network_get_device ifname ${1} || ifname=x
+ network_get_ipaddr ipaddr ${1} || ipaddr=x
+ network_get_gateway gateway ${1} || gateway=x
if [ "$ifname_cur" != "$ifname" -o "$ipaddr_cur" != "$ipaddr" -o "$gateway_cur" != "$gateway" ]; then
add_task "$1" acquire
elif [ "$icmp_hosts" == "dns" ]; then
icmp_hosts_acquire=$(uci_get_state multiwan $1 dns 'auto')
[ "$icmp_hosts_acquire" == "auto" ] &&
- icmp_hosts_acquire=$(uci_get_state network $1 dns)
+ network_get_dnsserver icmp_hosts_acquire $1
else
icmp_hosts_acquire=$icmp_hosts
fi