From: Jo-Philipp Wich Date: Sun, 3 Nov 2019 16:35:32 +0000 (+0100) Subject: luci-mod-network: remove unused `iface_down` endpoint X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7a2fefc671ff7b5533620e809a4de07cb3b564a3;p=oweals%2Fluci.git luci-mod-network: remove unused `iface_down` endpoint Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-mod-network/luasrc/controller/admin/network.lua b/modules/luci-mod-network/luasrc/controller/admin/network.lua index 1d9956463..bd00235fa 100644 --- a/modules/luci-mod-network/luasrc/controller/admin/network.lua +++ b/modules/luci-mod-network/luasrc/controller/admin/network.lua @@ -15,9 +15,6 @@ function index() page.uci_depends = { wireless = { ["@wifi-device[0]"] = "wifi-device" } } page.leaf = true - page = entry({"admin", "network", "iface_down"}, post("iface_down"), nil) - page.leaf = true - page = entry({"admin", "network", "remote_addr"}, call("remote_addr"), nil) page.leaf = true @@ -73,53 +70,6 @@ local function addr2dev(addr, src) return route and route.dev end -function iface_down(iface, force) - local netmd = require "luci.model.network".init() - local peer = luci.http.getenv("REMOTE_ADDR") - local serv = luci.http.getenv("SERVER_ADDR") - - if force ~= "force" and serv and peer then - local dev = addr2dev(peer, serv) - if dev then - local nets = netmd:get_networks() - local outnet = nil - local _, net, ai - - for _, net in ipairs(nets) do - if net:contains_interface(dev) then - outnet = net - break - end - end - - if outnet:name() == iface then - luci.http.status(409, "Is inbound interface") - return - end - - local peeraddr = outnet:get("peeraddr") - for _, ai in ipairs(peeraddr and nixio.getaddrinfo(peeraddr) or {}) do - local peerdev = addr2dev(ai.address) - for _, net in ipairs(peerdev and nets or {}) do - if net:contains_interface(peerdev) and net:name() == iface then - luci.http.status(409, "Is inbound interface") - return - end - end - end - end - end - - if netmd:get_network(iface) then - luci.sys.call("env -i /sbin/ifdown %s >/dev/null 2>/dev/null" - % luci.util.shellquote(iface)) - luci.http.status(200, "Shut down") - return - end - - luci.http.status(404, "No such interface") -end - function remote_addr() local uci = require "luci.model.uci" local peer = luci.http.getenv("REMOTE_ADDR")