2 LuCI - Lua Configuration Interface
3 Copyright
2010 Jo-Philipp Wich
<xm@subsignal.org
>
5 Licensed under the Apache License, Version
2.0 (the
"License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-
2.0
18 local fs = require
"nixio.fs"
19 local has_ping6 = fs.access(
"/bin/ping6") or fs.access(
"/usr/bin/ping6")
20 local has_traceroute6 = fs.access(
"/usr/bin/traceroute6")
23 <script type=
"text/javascript" src=
"<%=resource%>/cbi.js"></script>
24 <script type=
"text/javascript">//<![CDATA[
25 var stxhr = new XHR();
27 function update_status(field, proto)
29 var tool = field.name;
30 var addr = field.value;
31 var protocol = proto ?
"6" :
"";
33 var legend = document.getElementById('diag-rc-legend');
34 var output = document.getElementById('diag-rc-output');
39 '
<img src=
"<%=resource%>/icons/loading.gif" alt=
"<%:Loading%>" style=
"vertical-align:middle" /> ' +
40 '<%:Waiting for command to complete...%
>'
43 legend.parentNode.style.display = 'block';
44 legend.style.display = 'inline';
46 stxhr.get('<%=luci.dispatcher.build_url(
"admin",
"network")%
>/diag_' + tool + protocol + '/' + addr, null,
51 legend.style.display = 'none';
52 output.innerHTML = String.format('
<pre>%h
</pre>', x.responseText);
56 legend.style.display = 'none';
57 output.innerHTML = '
<span class=
"error"><%:Bad address specified!%
></span>';
65 <form method=
"post" action=
"<%=pcdata(luci.http.getenv("REQUEST_URI
"))%>">
67 <h2><a id=
"content" name=
"content"><%:Diagnostics%
></a></h2>
69 <fieldset class=
"cbi-section">
70 <legend><%:Network Utilities%
></legend>
74 <div style=
"width:30%; float:left">
75 <input style=
"margin: 5px 0" type=
"text" value=
"openwrt.org" name=
"ping" /><br />
76 <% if has_ping6 then %
>
77 <select name=
"ping_proto" style=
"width:auto">
78 <option value=
"" selected=
"selected"><%:IPv4%
></option>
79 <option value=
"6"><%:IPv6%
></option>
81 <input type=
"button" value=
"<%:Ping%>" class=
"cbi-button cbi-button-apply" onclick=
"update_status(this.form.ping, this.form.ping_proto.selectedIndex)" />
83 <input type=
"button" value=
"<%:Ping%>" class=
"cbi-button cbi-button-apply" onclick=
"update_status(this.form.ping)" />
87 <div style=
"width:33%; float:left">
88 <input style=
"margin: 5px 0" type=
"text" value=
"openwrt.org" name=
"traceroute" /><br />
89 <% if has_traceroute6 then %
>
90 <select name=
"traceroute_proto" style=
"width:auto">
91 <option value=
"" selected=
"selected"><%:IPv4%
></option>
92 <option value=
"6"><%:IPv6%
></option>
94 <input type=
"button" value=
"<%:Traceroute%>" class=
"cbi-button cbi-button-apply" onclick=
"update_status(this.form.traceroute, this.form.traceroute_proto.selectedIndex)" />
96 <input type=
"button" value=
"<%:Traceroute%>" class=
"cbi-button cbi-button-apply" onclick=
"update_status(this.form.traceroute)" />
98 <% if not has_traceroute6 then %
>
100 <p><%:Install iputils-traceroute6 for IPv6 traceroute%
></p>
104 <div style=
"width:33%; float:left;">
105 <input style=
"margin: 5px 0" type=
"text" value=
"openwrt.org" name=
"nslookup" /><br />
106 <input type=
"button" value=
"<%:Nslookup%>" class=
"cbi-button cbi-button-apply" onclick=
"update_status(this.form.nslookup)" />
109 <br style=
"clear:both" /><br />
114 <fieldset class=
"cbi-section" style=
"display:none">
115 <legend id=
"diag-rc-legend"><%:Collecting data...%
></legend>
116 <span id=
"diag-rc-output"></span>