applications/luci-radvd: fix removal of section in overview page
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 21 Nov 2010 03:23:48 +0000 (03:23 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 21 Nov 2010 03:23:48 +0000 (03:23 +0000)
applications/luci-radvd/luasrc/model/cbi/radvd.lua

index 67ef26a2fa2016cd86e27f28f01afecbbf7318ef..041decce5fe8fd4d77b04eaaf16c54cddc16d3d6 100644 (file)
@@ -36,16 +36,18 @@ function s.create(...)
 end
 
 function s.remove(self, section)
-       local iface = m.uci:get("radvd", section, "interface")
-       if iface then
-               m.uci:delete_all("radvd", "prefix",
-                       function(s) return s.interface == iface end)
+       if m.uci:get("radvd", section) == "interface" then
+               local iface = m.uci:get("radvd", section, "interface")
+               if iface then
+                       m.uci:delete_all("radvd", "prefix",
+                               function(s) return s.interface == iface end)
 
-               m.uci:delete_all("radvd", "route",
-                       function(s) return s.interface == iface end)
+                       m.uci:delete_all("radvd", "route",
+                               function(s) return s.interface == iface end)
 
-               m.uci:delete_all("radvd", "rdnss",
-                       function(s) return s.interface == iface end)
+                       m.uci:delete_all("radvd", "rdnss",
+                               function(s) return s.interface == iface end)
+               end
        end
 
        return TypedSection.remove(self, section)