Changeset 2138


Ignore:
Timestamp:
Aug 21, 2012, 2:43:48 PM (7 years ago)
Author:
matthijs
Message:

luci-fonfw: Don't display nameless services.

If, for whatever reason, a service without a name appears in the
services list, the interface breaks. This can happen for example when a
backup value is restored for a plugin that is no longer installed.

Also, this problem occured in practice when upgrading from the 2.0n
recovery firmware, which contained an entry for the torrent in
/etc/config/services (which is stored in /etc/config/fmg in all other
firmware versions). Since the upgrade only backups the fwall setting and
assumes all other settings to be present in the new firmware image, this
caused a nameless service after the upgrade. An added problem was that
both services and fmg now defined a torrent service, which would break
saving.

This commit fixes this problem, hopefully in the most future-proof way.

Closes: #1192

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/luci/applications/luci-fonfw/luasrc/model/cbi/fon_fw/services.lua

    r1598 r2138  
    1010local dev = uci:get("registered", "fonreg", "dev") or "0"
    1111uci:foreach("services", "service", function(s)
    12         if s.fwall ~= nil then
     12        if s.fwall ~= nil and s.name ~= nil then
    1313                if not(s[".name"] == "ssh" and dev == "0") then
    1414                        local x = m:field(ListValue, s[".name"], s.name)
     
    2121
    2222uci:foreach("fmg", "images", function(s)
    23         if s.fwall ~= nil then
     23        if s.fwall ~= nil and s.name ~= nil then
    2424                if not(s[".name"] == "ssh" and dev == "0") then
    2525                        local x = m:field(ListValue, s[".name"], s.name)
Note: See TracChangeset for help on using the changeset viewer.