From 17af33ee48bb709aec31d09b90cfbd4cbece6d0d Mon Sep 17 00:00:00 2001 From: Rafał Miłecki Date: Wed, 26 May 2021 13:25:24 +0200 Subject: luci-mod-network: migrate network config depending on netifd version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Checking netifd version is important for users of the most recent LuCI that didn't update netifd (e.g. OpenWrt package). Suggested-by: Jo-Philipp Wich Signed-off-by: Rafał Miłecki --- .../htdocs/luci-static/resources/view/network/interfaces.js | 8 ++++++-- .../root/usr/share/rpcd/acl.d/luci-mod-network.json | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'modules/luci-mod-network') diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js index a1def24b07..e3502c0528 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js @@ -294,6 +294,7 @@ return view.extend({ network.getDSLModemType(), network.getDevices(), fs.lines('/etc/iproute2/rt_tables'), + fs.read('/usr/lib/opkg/info/netifd.control'), uci.changes() ]); }, @@ -354,8 +355,11 @@ return view.extend({ }, render: function(data) { - if (this.interfaceWithIfnameSections().length || - this.deviceWithIfnameSections().length) + var netifdVersion = (data[3] || '').match(/Version: ([^\n]+)/); + + if (netifdVersion && netifdVersion[1] >= "2021-05-20" && + (this.interfaceWithIfnameSections().length || + this.deviceWithIfnameSections().length)) return this.renderMigration(); var dslModemType = data[0], diff --git a/modules/luci-mod-network/root/usr/share/rpcd/acl.d/luci-mod-network.json b/modules/luci-mod-network/root/usr/share/rpcd/acl.d/luci-mod-network.json index 5d7888f765..ade9915b91 100644 --- a/modules/luci-mod-network/root/usr/share/rpcd/acl.d/luci-mod-network.json +++ b/modules/luci-mod-network/root/usr/share/rpcd/acl.d/luci-mod-network.json @@ -5,7 +5,8 @@ "cgi-io": [ "exec" ], "file": { "/etc/iproute2/rt_tables": [ "read" ], - "/usr/libexec/luci-peeraddr": [ "exec" ] + "/usr/libexec/luci-peeraddr": [ "exec" ], + "/usr/lib/opkg/info/netifd.control": [ "read" ] }, "ubus": { "file": [ "exec" ], -- cgit v1.2.3