1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 18:41:51 +00:00

Add back gateway for DHCP and fix get public IP and netstat

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-08-07 08:05:51 +02:00
parent 7165fb2df1
commit 35d65227ac
4 changed files with 29 additions and 8 deletions

View file

@ -366,6 +366,14 @@ return L.view.extend({
so.value(hosts[mac].ipv4);
});
so = ss.options(form.value, 'gw', _('Gateway IPv4 Address'));
so.rmempty = true;
so.datatype = 'or(ip4addr,"ignore")';
Object.keys(hosts).forEach(function(mac) {
if (hosts[mac].ipv4)
so.value(hosts[mac].ipv4);
});
so = ss.option(form.Value, 'leasetime', _('Lease time'));
so.rmempty = true;

View file

@ -1,5 +1,6 @@
-- Copyright 2008 Steven Barth <steven@midlink.org>
-- Copyright 2011-2018 Jo-Philipp Wich <jo@mein.io>
-- Copyright 2019 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter project
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.admin.network", package.seeall)
@ -138,6 +139,12 @@ function index()
page = entry({"admin", "network", "diag_ping6"}, post("diag_ping6"), nil)
page.leaf = true
page = entry({"admin", "network", "diag_getip"}, post("diag_getip"), nil)
page.leaf = true
page = entry({"admin", "network", "diag_netstat"}, post("diag_netstat"), nil)
page.leaf = true
page = entry({"admin", "network", "diag_traceroute6"}, post("diag_traceroute6"), nil)
page.leaf = true
-- end
@ -420,3 +427,11 @@ end
function diag_traceroute6(addr)
diag_command("traceroute6 -q 1 -w 2 -n %s 2>&1", addr)
end
function diag_getip(addr)
diag_command("wget -4 -qO- -T 2 %s 2>&1", addr)
end
function diag_netstat()
diag_command("netstat -lapute 2>&1","http://www.none.com/")
end

View file

@ -306,6 +306,9 @@ end
ip = s:option(Value, "ip", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address"))
ip.datatype = "or(ip4addr,'ignore')"
gw = s:option(Value, "gw", translate("Gateway IPv4 Address"))
gw.datatype = "or(ip4addr,'ignore')"
time = s:option(Value, "leasetime", translate("Lease time"))
time.rmempty = true

View file

@ -1,5 +1,6 @@
<%#
Copyright 2010 Jo-Philipp Wich <jow@openwrt.org>
Copyright 2019 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter project
Licensed to the public under the Apache License 2.0.
-%>
@ -10,7 +11,7 @@ local fs = require "nixio.fs"
local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6")
local has_traceroute6 = fs.access("/bin/traceroute6") or fs.access("/usr/bin/traceroute6")
local has_speedtest = fs.access("/usr/sbin/speedtestc")
local has_curl = fs.access("/usr/bin/curl")
local has_wget = fs.access("/usr/bin/wget")
local has_netstat = fs.access("/bin/netstat")
local dns_host = luci.config.diag and luci.config.diag.dns or "dev.openwrt.org"
@ -103,14 +104,8 @@ local getip_host = luci.config.diag and luci.config.diag.getip or "ifconfig.co"
<input style="margin: 5px 0" type="text" value="<%=dns_host%>" name="nslookup" /><br />
<input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" />
</div>
<% if has_speedtest and false then %>
<div class="td left">
<input style="margin: 5px 0" type="text" value="" name="speedtest" placeholder="alternate server" /><br />
<input type="button" value="<%:Speedtest%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.speedtest)" />
</div>
<% end %>
<% if has_curl then %>
<% if has_wget then %>
<div class="td left">
<input style="margin: 5px 0" type="hidden" value="<%=getip_host%>" name="getip" /><br />
<input type="button" value="<%:Get public IP%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.getip)" />