#!/bin/sh /etc/rc.common
-# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2006-2014 OpenWrt.org
-START=95
+START=94
+STOP=15
SERVICE_USE_PID=1
local extip port usesysuptime conffile serial_number model_number
local uuid notify_interval presentation_url enable_upnp
local upnp_lease_file clean_ruleset_threshold clean_ruleset_interval
- local ipv6_listening_ip
+ local ipv6_listening_ip enabled
+
+ config_get_bool enabled config enabled 1
+
+ [ "$enabled" -gt 0 ] || return 1
config_get extiface config external_iface
+ config_get extzone config external_zone
config_get intiface config internal_iface
config_get extip config external_ip
config_get port config port 5000
local ifname
- [ -n "$extiface" ] || network_find_wan extiface
-
- network_get_device ifname ${extiface}
+ # manual external interface overrides everything
+ if [ -z "$extiface" ] ; then
+ # manual external zone (if dynamically find interfaces
+ # belonging to it) overrides network_find_wan*
+ if [ -n "$extzone" ] ; then
+ ifname=$(fw3 -q zone $extzone | head -1)
+ fi
+ [ -n "$extiface" ] || network_find_wan extiface
+ [ -n "$extiface" ] || network_find_wan6 extiface
+ fi
+
+ [ -n "$ifname" ] || network_get_device ifname ${extiface}
if [ -n "$conffile" ]; then
args="-f $conffile"