diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-11-03 17:35:32 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-11-03 17:56:58 +0100 |
commit | 7a2fefc671ff7b5533620e809a4de07cb3b564a3 (patch) | |
tree | 516628aa24e1ea8facd21a20331c000eece4d614 /modules | |
parent | f16a47042c568ccc843897f784f9d748cd630ea2 (diff) |
luci-mod-network: remove unused `iface_down` endpoint
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/luci-mod-network/luasrc/controller/admin/network.lua | 50 |
1 files changed, 0 insertions, 50 deletions
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") |