From c5ec42b5e89bbdcfcd0a122ca1e8004f34bf1ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Fri, 17 Dec 2021 15:05:51 +0100 Subject: [PATCH] static-ip: more resilent mac setting --- .../luasrc/lib/gluon/upgrade/240-static-ip | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package/gluon-static-ip/luasrc/lib/gluon/upgrade/240-static-ip b/package/gluon-static-ip/luasrc/lib/gluon/upgrade/240-static-ip index 1b91c605..f27ffd3c 100755 --- a/package/gluon-static-ip/luasrc/lib/gluon/upgrade/240-static-ip +++ b/package/gluon-static-ip/luasrc/lib/gluon/upgrade/240-static-ip @@ -77,10 +77,12 @@ local function apply_network(name, use, mac) if use == nil then use = not_disabled end - if not uci:get('network', name, 'macaddr') then - uci:set('network', name, 'macaddr', util.generate_mac(mac)) + macaddr = uci:get('network', name, 'macaddr') + if not macaddr then + macaddr = util.generate_mac(mac) + uci:set('network', name, 'macaddr', macaddr) end - static_ip_4(name, uci:get('network', name, 'ifname'), uci:get('network', name, 'macaddr'), use) + static_ip_4(name, uci:get('network', name, 'ifname'), macaddr, use) end -- TODO: get actual enabled value from options