luci-base: fix handling alias interfaces in ifacelist widget
authorJo-Philipp Wich <jo@mein.io>
Sun, 15 Jul 2018 15:20:27 +0000 (17:20 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sun, 15 Jul 2018 15:28:38 +0000 (17:28 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/luasrc/view/cbi/network_ifacelist.htm

index abfa33e1edca600a7918db83f96427fe3c43edef..a97e9ef6d0ba2cad82a00ff8afb938bcacd7706e 100644 (file)
        else
                local n = self.network and net:get_network(self.network)
                if n then
-                       local i
-                       for _, i in ipairs(n:get_interfaces() or { n:get_interface() }) do
-                               checked[i:name()] = true
+                       local a = n:is_alias()
+                       if a then
+                               checked['@' .. a] = true
+                       else
+                               local i
+                               for _, i in ipairs(n:get_interfaces() or { n:get_interface() }) do
+                                       checked[i:name()] = true
+                               end
                        end
                end
        end
@@ -50,7 +55,8 @@
        --></script>
        <ul>
                <% for _, iface in ipairs(ifaces) do
-                       if (not self.nobridges  or not iface:is_bridge()) and
+                       if (not self.noaliases  or iface:type() ~= "alias") and
+                          (not self.nobridges  or not iface:is_bridge()) and
                           (not self.noinactive or iface:is_up()) and
                           iface:name() ~= self.exclude
                        then %>