aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/config/netifd/files
diff options
context:
space:
mode:
authorKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>2019-11-19 15:12:42 +0000
committerKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>2019-11-20 10:52:57 +0000
commit3cee6f3f242c8f3529824213bef2bb91141177ad (patch)
tree38ccb2b3c1d0619d5382cbda6604d7db7819f11c /package/network/config/netifd/files
parent1bf1490eeb2fc9f3d067cb3bf82ef2f69cef1006 (diff)
downloadupstream-3cee6f3f242c8f3529824213bef2bb91141177ad.tar.gz
upstream-3cee6f3f242c8f3529824213bef2bb91141177ad.tar.bz2
upstream-3cee6f3f242c8f3529824213bef2bb91141177ad.zip
netifd: dhcp proto convert release to norelease
Change dhcp no/release on shutdown to 'norelease' uci option to match existing proto dhcpv6 usage. Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> Acked-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'package/network/config/netifd/files')
-rw-r--r--package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release23
-rwxr-xr-xpackage/network/config/netifd/files/lib/netifd/proto/dhcp.sh10
2 files changed, 28 insertions, 5 deletions
diff --git a/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release b/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release
new file mode 100644
index 0000000000..651c437cb2
--- /dev/null
+++ b/package/network/config/netifd/files/etc/uci-defaults/14_migrate-dhcp-release
@@ -0,0 +1,23 @@
+. /lib/functions.sh
+
+migrate_release() {
+ local config="$1"
+ local proto
+ local release
+
+ config_get proto "$config" proto
+ config_get release "$config" release
+
+ [ "$proto" = "dhcp" ] && [ -n "$release" ] && {
+ norelease="$((!$release))"
+ uci_set network "$config" norelease "$norelease"
+ uci_remove network "$config" release
+ }
+
+}
+
+config_load network
+config_foreach migrate_release interface
+commit network
+
+exit 0
diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
index 0d06eba06e..3034b2ba68 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -14,7 +14,7 @@ proto_dhcp_init_config() {
proto_config_add_string clientid
proto_config_add_string vendorid
proto_config_add_boolean 'broadcast:bool'
- proto_config_add_boolean 'release:bool'
+ proto_config_add_boolean 'norelease:bool'
proto_config_add_string 'reqopts:list(string)'
proto_config_add_boolean 'defaultreqopts:bool'
proto_config_add_string iface6rd
@@ -35,8 +35,8 @@ proto_dhcp_setup() {
local config="$1"
local iface="$2"
- local ipaddr hostname clientid vendorid broadcast release reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute
- json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes classlessroute
+ local ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute
+ json_get_vars ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes classlessroute
local opt dhcpopts
for opt in $reqopts; do
@@ -50,7 +50,7 @@ proto_dhcp_setup() {
[ "$defaultreqopts" = 0 ] && defaultreqopts="-o" || defaultreqopts=
[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
- [ "$release" = 1 ] && release="-R" || release=
+ [ "$norelease" = 1 ] && norelease="" || norelease="-R"
[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
[ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append dhcpopts "-O 212"
@@ -70,7 +70,7 @@ proto_dhcp_setup() {
${ipaddr:+-r $ipaddr} \
${hostname:+-x "hostname:$hostname"} \
${vendorid:+-V "$vendorid"} \
- $clientid $defaultreqopts $broadcast $release $dhcpopts
+ $clientid $defaultreqopts $broadcast $norelease $dhcpopts
}
proto_dhcp_renew() {