Skip to content

Commit

Permalink
Reload network addresses after set
Browse files Browse the repository at this point in the history
If dhcp is set, the IP address is not known until it was set by the OS.
Reload from kernel the network configuration and update the values in
the network list after the interfaces are set.

Signed-off-by: Stefano Babic <[email protected]>
  • Loading branch information
sbabic committed Jan 8, 2019
1 parent 09fe97f commit 64d55d0
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions SWUpdateGUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -437,22 +437,27 @@ local netwin = NetWindow:new
net = self:getById("network-fields")
local dhcp, ip, netmask = net:getip()
modinterface(name, dhcp, ip, netmask)
line = {}
table.insert (line, name)
if (dhcp) then
table.insert (line, "yes")
else
table.insert (line, "no")
end
table.insert (line, ip)
table.insert (line, netmask)
local newval = { line }

-- Call OS to setup the network interfaces
ifup(interfaces)

-- Reload values from kernel to check if they were set
loadnetinterfaces()
list:changeItem(newval, list.CursorLine)
list:rethinkLayout(true, 1)
local t = findintf(name)
if t then
line = {}
table.insert (line, name)
if t["dhcp"] then
table.insert (line, "yes")
else
table.insert (line, "no")
end
table.insert (line, t["addr"])
table.insert (line, t["netmask"])
local newval = { line }
list:changeItem(newval, list.CursorLine)
list:rethinkLayout(true, 1)
end

if SAVEIPADDRESS then
app:addCoroutine(function()
Expand Down

0 comments on commit 64d55d0

Please sign in to comment.