miniupnpd: implement an 'enabled' flag 276/head
authorKevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
Sat, 11 Feb 2017 19:13:29 +0000 (19:13 +0000)
committerKevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
Sun, 12 Feb 2017 08:46:24 +0000 (08:46 +0000)
Add a 'master' miniupnpd service enable flag rather than just relying on
rcS.d script existence.  This allows the service to be disabled across
sysupgrade, similar to minidlna.

The service assumes enabled if no 'enabled' config flag is configured
for backwards compatibility.

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
miniupnpd/files/miniupnpd.init
miniupnpd/files/upnpd.config

index c7dc6a26289991c91b4fd00d33cdb66b60d58f97..c934a283732b60e357bb75bb13934ae0123a2f6e 100644 (file)
@@ -68,7 +68,11 @@ start() {
        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
index 56cde579e072faec3061c92b6caef27c4e4912cb..9a65bfa6330e6c8ee3ccc13057dc8d5fbad9018d 100644 (file)
@@ -1,4 +1,5 @@
 config upnpd config
+       option enabled          0
        option enable_natpmp    1
        option enable_upnp      1
        option secure_mode      1