@@ -40,42 +40,42 @@ upnpd_add_custom_acl_entry() {
4040upnpd () {
4141 config_load " upnpd"
4242 local enabled
43- config_get enabled config enabled 0
43+ config_get enabled settings enabled 0
4444 if [ " $enabled " != " 1" ]; then
4545 log " Service disabled, UCI enabled is not set"
4646 return 1
4747 fi
4848 # Daemon
4949 local enabled_protocols allow_cgnat stun_host allow_third_party_mapping ipv6_disable system_uptime log_output lease_file config_file
50- config_get enabled_protocols config enabled_protocols all
51- config_get allow_cgnat config allow_cgnat 0
52- config_get stun_host config stun_host stun.nextcloud.com
53- config_get allow_third_party_mapping config allow_third_party_mapping 0
54- config_get ipv6_disable config ipv6_disable 0
55- config_get system_uptime config system_uptime 1
56- config_get log_output config log_output
57- config_get lease_file config lease_file /run/miniupnpd.leases
58- config_get config_file config config_file
50+ config_get enabled_protocols settings enabled_protocols all
51+ config_get allow_cgnat settings allow_cgnat 0
52+ config_get stun_host settings stun_host stun.nextcloud.com
53+ config_get allow_third_party_mapping settings allow_third_party_mapping 0
54+ config_get ipv6_disable settings ipv6_disable 0
55+ config_get system_uptime settings system_uptime 1
56+ config_get log_output settings log_output
57+ config_get lease_file settings lease_file /run/miniupnpd.leases
58+ config_get config_file settings config_file
5959
6060 # UPnP IGD
6161 local upnp_igd_compat download_kbps upload_kbps friendly_name model_number serial_number presentation_url uuid http_port notify_interval
62- config_get upnp_igd_compat config upnp_igd_compat igdv1
63- config_get download_kbps config download_kbps
64- config_get upload_kbps config upload_kbps
65- config_get friendly_name config friendly_name " OpenWrt UPnP IGD & PCP"
66- config_get model_number config model_number
67- config_get serial_number config serial_number
68- config_get presentation_url config presentation_url
69- config_get uuid config uuid
70- config_get http_port config http_port 5000
71- config_get notify_interval config notify_interval
62+ config_get upnp_igd_compat settings upnp_igd_compat igdv1
63+ config_get download_kbps settings download_kbps
64+ config_get upload_kbps settings upload_kbps
65+ config_get friendly_name settings friendly_name " OpenWrt UPnP IGD & PCP"
66+ config_get model_number settings model_number
67+ config_get serial_number settings serial_number
68+ config_get presentation_url settings presentation_url
69+ config_get uuid settings uuid
70+ config_get http_port settings http_port 5000
71+ config_get notify_interval settings notify_interval
7272
7373 # External network interface
7474 local external_iface external_iface6 external_zone external_ip
75- config_get external_iface config external_iface
76- config_get external_iface6 config external_iface6
77- config_get external_zone config external_zone
78- config_get external_ip config external_ip
75+ config_get external_iface settings external_iface
76+ config_get external_iface6 settings external_iface6
77+ config_get external_zone settings external_zone
78+ config_get external_ip settings external_ip
7979
8080 local conf ifname ifname6
8181 . /lib/functions/network.sh
@@ -155,7 +155,7 @@ upnpd() {
155155 [ -z " $uuid " ] && {
156156 log " Generate UPnP IGD UUID"
157157 uuid=" $( cat /proc/sys/kernel/random/uuid) "
158- uci set upnpd.config .uuid=" $uuid "
158+ uci set upnpd.settings .uuid=" $uuid "
159159 uci commit upnpd
160160 }
161161 [ " $uuid " != " nocli" ] && echo " uuid=$uuid " || log " Deprecated. Set uuid to 00000000-0000-0000-0000-000000000000 instead"
@@ -282,6 +282,7 @@ upnpd_add_int_network_and_preset() {
282282}
283283
284284upnpd_uci_migration () {
285+ { uci -q get upnpd.settings > /dev/null || ! uci -q get upnpd.config > /dev/null; } && return 0
285286 log " Check UCI options in /etc/config/upnpd to be migrated to v2.0"
286287
287288 # Set missing enabled option to fix previously different defaults in LuCI/config (0) and init UCI (1)
@@ -508,5 +509,11 @@ upnpd_uci_migration() {
508509 uci -q delete upnpd.config.internal_iface
509510 fi
510511
512+ # Finally rename section config -> settings (v2.0)
513+ if uci -q get upnpd.config > /dev/null; then
514+ log " Rename section config -> settings (v2.0)" && uci rename upnpd.config=" settings" ||
515+ log " Error renaming the UCI section" daemon.err
516+ fi
517+
511518 uci commit upnpd > /dev/null
512519}
0 commit comments