tazpanel view network.cgi @ rev 472

boot.cgi: change look of "System logs" page; index.cgi: return "Diff" button back.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Apr 30 02:25:59 2015 +0300 (2015-04-30)
parents 7ca14d55e705
children de34ca9d1417
line source
1 #!/bin/sh
2 #
3 # Network configuration CGI interface
4 #
5 # Copyright (C) 2012-2015 SliTaz GNU/Linux - BSD License
6 #
9 # Common functions from libtazpanel
11 . lib/libtazpanel
12 get_config
13 header
15 TITLE=$(_ 'TazPanel - Network')
18 # Start a Wi-Fi connection
20 start_wifi() {
21 sed -i \
22 -e 's|^WIFI=.*|WIFI="yes"|' \
23 -e 's|^DHCP=.*|DHCP="yes"|' \
24 -e 's|^STATIC=.*|STATIC="no"|' /etc/network.conf
25 ifconfig $WIFI_INTERFACE up
26 iwconfig $WIFI_INTERFACE txpower auto
27 /etc/init.d/network.sh restart | log
29 # Sleep until connection established (max 5 seconds)
30 for i in $(seq 5); do
31 [ -n "$(iwconfig 2>/dev/null | fgrep Link)" ] && break
32 sleep 1
33 done
34 }
37 # Start an Ethernet connection
39 start_eth() {
40 case "$(GET staticip)" in
41 on) DHCP='no'; STATIC='yes';;
42 *) DHCP='yes'; STATIC='no';;
43 esac
45 /etc/init.d/network.sh stop | log
46 sleep 2
47 sed -i \
48 -e "s|^INTERFACE=.*|INTERFACE=\"$(GET iface)\"|" \
49 -e 's|^WIFI=.*|WIFI="no"|' \
50 -e "s|^DHCP=.*|DHCP=\"$DHCP\"|" \
51 -e "s|^STATIC=.*|STATIC=\"$STATIC\"|" \
52 -e "s|^IP=.*|IP=\"$(GET ip)\"|" \
53 -e "s|^NETMASK=.*|NETMASK=\"$(GET netmask)\"|" \
54 -e "s|^GATEWAY=.*|GATEWAY=\"$(GET gateway)\"|" \
55 -e "s|^DNS_SERVER=.*|DNS_SERVER=\"$(GET dns)\"|" \
56 /etc/network.conf
57 /etc/init.d/network.sh start | log
58 . /etc/network.conf
59 }
62 # Use /etc/wpa/wpa.conf as single database for known networks, passwords, etc.
63 # Translate this data to use in javascript.
65 parse_wpa_conf() {
66 awk '
67 BEGIN { print "networks = ["; begin_list = 1; network = 0; }
68 {
69 if ($0 == "network={") {
70 if (begin_list == 0) print ",";
71 begin_list = 0;
72 printf "{"; begin_obj = 1;
73 network = 1; next;
74 }
75 if (network == 1) {
76 if ($0 ~ "=") {
77 if (begin_obj == 0) printf ", ";
78 begin_obj = 0;
80 # split line into variable and value (note "=" can appear in the value)
81 split($0, a, "="); variable = a[1];
82 value = gensub(variable "=", "", "");
84 # escape html entities
85 value = gensub("\\\\", "\\\\", "g", value);
86 value = gensub("&", "\\&amp;", "g", value);
87 value = gensub("<", "\\&lt;", "g", value);
88 value = gensub(">", "\\&gt;", "g", value);
89 value = gensub("\"", "\\\"", "g", value);
91 # if value was already quoted - remove \" from begin and end
92 if (substr(value, 1, 2) == "\\\"")
93 value = substr(value, 3, length(value) - 4);
95 # output in form: variable:"escaped value"
96 printf "%s:\"%s\"", variable, value;
97 }
98 }
99 if (network == 1 && $0 ~ "}") { printf "}"; network = 0; next; }
100 }
101 END {print "\n];"}
102 ' /etc/wpa/wpa.conf | sed 's|\t||g;'
103 }
106 # Waiting for network link up
108 wait_up() {
109 for i in $(seq 5); do
110 [ -z "$(cat /sys/class/net/*/operstate | fgrep up)"] && sleep 1
111 done
112 }
115 # Actions commands before page is displayed
117 case " $(GET) " in
118 *\ start\ *)
119 /etc/init.d/network.sh start | log
120 # Here we sleep a bit to let udhcp get the lease before reloading
121 # the page with status
122 wait_up ;;
123 *\ stop\ *)
124 /etc/init.d/network.sh stop | log ;;
125 *\ restart\ *)
126 /etc/init.d/network.sh restart | log
127 wait_up ;;
128 *\ start_wifi\ *)
129 start_wifi ;;
130 *\ start_eth\ *)
131 start_eth ;;
132 *\ host\ *)
133 get_hostname="$(GET host)"
134 echo $(_ 'Changed hostname: %s' $get_hostname) | log
135 echo "$get_hostname" > /etc/hostname ;;
136 esac
138 case " $(POST) " in
139 *\ connect_wifi\ *)
140 # Connect to a Wi-Fi network
141 /etc/init.d/network.sh stop | log
142 password="$(POST password)"
144 # Escape special characters to use with sed substitutions
145 password="$(echo -n "$password" | sed 's|\\|\\\\|g; s|&|\\\&|g' | sed "s|'|'\"'\"'|g")"
147 sed -i \
148 -e "s|^WIFI_ESSID=.*|WIFI_ESSID=\"$(POST essid)\"|" \
149 -e "s|^WIFI_BSSID=.*|WIFI_BSSID=\"$(POST bssid)\"|" \
150 -e "s|^WIFI_KEY_TYPE=.*|WIFI_KEY_TYPE=\"$(POST keyType)\"|" \
151 -e "s|^WIFI_KEY=.*|WIFI_KEY='$password'|" \
152 -e "s|^WIFI_EAP_METHOD=.*|WIFI_EAP_METHOD=\"$(POST eap)\"|" \
153 -e "s|^WIFI_CA_CERT=.*|WIFI_CA_CERT=\"$(POST caCert)\"|" \
154 -e "s|^WIFI_CLIENT_CERT=.*|WIFI_CLIENT_CERT=\"$(POST clientCert)\"|" \
155 -e "s|^WIFI_IDENTITY=.*|WIFI_IDENTITY=\"$(POST identity)\"|" \
156 -e "s|^WIFI_ANONYMOUS_IDENTITY=.*|WIFI_ANONYMOUS_IDENTITY=\"$(POST anonymousIdentity)\"|" \
157 -e "s|^WIFI_PHASE2=.*|WIFI_PHASE2=\"$(POST phase2)\"|" \
158 /etc/network.conf
159 . /etc/network.conf
160 start_wifi
161 ;;
162 esac
165 # Get values only now since they could have been modified by actions.
167 . /etc/network.conf
173 #
174 # Main Commands for pages
175 #
177 case " $(GET) " in
179 *\ scan\ *)
180 # Scan open ports
181 scan=$(GET scan); back=$(GET back)
182 xhtml_header
183 LOADING_MSG=$(_ 'Scanning open ports...'); loading_msg
185 cat <<EOT
186 <section>
187 <header>
188 $(_ 'Port scanning for %s' $scan)
189 $(back_button "$back" "$(_ 'Network')" "")
190 </header>
191 <pre>$(pscan -b $scan)</pre>
192 </section>
193 EOT
194 ;;
197 *\ eth\ *)
198 # Wired connections settings
199 xhtml_header
201 PAR1="size=\"20\" required"; PAR="$PAR1 pattern=\"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\""
203 case "$STATIC" in
204 yes) use_static='checked';;
205 *) use_static='';;
206 esac
208 stop_disabled=''; start_disabled=''
209 if cat /sys/class/net/eth*/operstate | fgrep -q up; then
210 start_disabled='disabled'
211 else
212 stop_disabled='disabled'
213 fi
215 cat <<EOT
216 <h2>$(_ 'Ethernet connection')</h2>
217 EOT
218 [ -w /etc/network.conf ] && cat <<EOT
219 <p>$(_ "Here you can configure a wired connection using DHCP to \
220 automatically get a random IP or configure a static/fixed IP")</p>
222 <section>
223 <header>$(_ 'Configuration')</header>
224 <form id="conf">
225 <input type="hidden" name="eth"/>
226 <div>
227 <table>
228 <tr><td>$(_ 'Interface')</td>
229 <td><select name="iface" value="$INTERFACE" style="width:100%">
230 $(cd /sys/class/net; ls -1 | awk -viface="$INTERFACE" '{
231 sel = ($0 == iface) ? " selected":""
232 printf "<option value=\"%s\"%s>%s", $0, sel, $0
233 }')
234 </select></td>
235 </tr>
236 <tr><td>$(_ 'Static IP')</td>
237 <td><label><input type="checkbox" name="staticip" id="staticip" $use_static/>
238 $(_ 'Use static IP')</td>
239 </tr>
240 <tr id="st1"><td>$(_ 'IP address')</td>
241 <td><input type="text" name="ip" value="$IP" $PAR/></td>
242 </tr>
243 <tr id="st2"><td>$(_ 'Netmask')</td>
244 <td><input type="text" name="netmask" value="$NETMASK" $PAR/></td>
245 </tr>
246 <tr id="st3"><td>$(_ 'Gateway')</td>
247 <td><input type="text" name="gateway" value="$GATEWAY" $PAR/></td>
248 </tr>
249 <tr id="st4"><td>$(_ 'DNS server')</td>
250 <td><input type="text" name="dns" value="$DNS_SERVER" $PAR/></td>
251 </tr>
252 </table>
253 </div>
254 </form>
255 <footer><!--
256 --><button form="conf" type="submit" name="start_eth" data-icon="start" $start_disabled>$(_ 'Start' )</button><!--
257 --><button form="conf" type="submit" name="stop" data-icon="stop" $stop_disabled >$(_ 'Stop' )</button><!--
258 --></footer>
259 </section>
261 <script type="text/javascript">
262 function static_change() {
263 staticip = document.getElementById('staticip').checked;
264 for (i = 1; i < 5; i++) {
265 document.getElementById('st' + i).style.display = staticip ? '' : 'none';
266 }
267 }
269 document.getElementById('staticip').onchange = static_change;
270 static_change();
271 </script>
272 EOT
273 cat <<EOT
274 <section>
275 <header>
276 $(_ 'Configuration file')
277 EOT
278 [ -w /etc/network.conf ] && cat <<EOT
279 <form action="index.cgi">
280 <input type="hidden" name="file" value="/etc/network.conf"/>
281 <button name="action" value="edit" data-icon="edit">$(_ 'Edit')</button>
282 </form>
283 EOT
284 cat <<EOT
285 </header>
286 <div>$(_ "These values are the ethernet settings in the main /etc/network.conf configuration file")</div>
287 <pre>$(awk '{if($1 !~ "WIFI" && $1 !~ "#" && $1 != ""){print $0}}' /etc/network.conf | syntax_highlighter conf)</pre>
288 </section>
289 EOT
290 ;;
294 *\ wifi_list\ *)
295 # Catch ESSIDs and format output.
296 # We get the list of networks by Cell and without spaces.
298 HIDDEN="$(_ '(hidden)')"
300 cat <<EOT
301 <table class="wide center zebra">
302 <thead>
303 <tr>
304 <td>$(_ 'Name')</td>
305 <td>$(_ 'Signal level')</td>
306 <td>$(_ 'Channel')</td>
307 <td>$(_ 'Encryption')</td>
308 <td>$(_ 'Status')</td>
309 </tr>
310 </thead>
311 <tbody>
312 EOT
313 if [ -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then
314 ifconfig $WIFI_INTERFACE up
315 for i in $(iwlist $WIFI_INTERFACE scan | sed '/Cell /!d;s/.*Cell \([^ ]*\).*/Cell.\1/')
316 do
317 SCAN=$(iwlist $WIFI_INTERFACE scan last | sed "/$i/,/Cell/!d" | sed '$d')
319 BSSID=$(echo "$SCAN" | sed -n 's|.*Address: \([^ ]*\).*|\1|p')
321 CHANNEL=$(echo "$SCAN" | sed -n 's|.*Channel[:=]\([^ ]*\).*|\1|p')
323 QUALITY=$(echo "$SCAN" | sed -n 's|.*Quality[:=]\([^ ]*\).*|\1|p')
324 QUALITY_ICON="lvl$(( 5*${QUALITY:-0} ))" # lvl0 .. lvl4, lvl5
325 LEVEL=$(echo "$SCAN" | sed -n 's|.*Signal level[:=]\([^ ]*\).*|\1|p; s|-|−|')
327 ENCRYPTION=$(echo "$SCAN" | sed -n 's|.*Encryption key[:=]\([^ ]*\).*|\1|p') # on/off
329 ESSID=$(echo "$SCAN" | sed -n 's|.*ESSID:"\([^"]*\).*|\1|p')
331 # WPA Type - Group Cipher - Pairwise Ciphers - Authentication Suites
332 # {WPA|WPA2}-{TKIP|CCMP}-{TKIP|CCMP|TKIP CCMP}-{PSK|802.1x}
333 #CAPABILITIES="$(echo "$SCAN" | grep -e 'IE: .*WPA*' -A3 | cut -d: -f2 | sed -e 's|^ ||' -e '/WPA2/s|.*|=WPA2|' -e '/WPA /s|.*|=WPA|' -e '/--/d' | tr '\n' '-' | tr '=' '\n' | sed -e '/^$/d' -e 's|-$||')"
335 # Authentication type
336 AUTH="$(echo "$SCAN" | sed -n 's|.*Authentication Suites[^:]*: *\(.*\)|\1|p')"
337 if [ -n "$(echo -n $AUTH | fgrep PSK)" ]; then
338 # WPA-Personal. Authentication using password (PSK = pre-shared key)
339 WIFI_KEY_TYPE='WPA'
340 elif [ -n "$(echo -n $AUTH | fgrep 802.1x)" ]; then
341 # WPA-Enterprise. Authentication using username, password, certificates...
342 WIFI_KEY_TYPE='EAP'
343 else
344 WIFI_KEY_TYPE='NONE'
345 fi
347 # Check encryption type
348 if [ "$ENCRYPTION" == 'on' ]; then
349 # "WPA" or "WPA2" or "WPA/WPA2" (maybe also "WPA2/WPA")
350 ENC_SIMPLE=$(echo "$SCAN" | sed -n '/.*WPA.*/ s|.*\(WPA[^ ]*\).*|\1|p')
351 ENC_SIMPLE=$(echo $ENC_SIMPLE | sed 's| |/|')
352 ENC_ICON='sechi' # high
353 if [ -z "$ENC_SIMPLE" ]; then
354 WIFI_KEY_TYPE='WEP'
355 ENC_SIMPLE='WEP'; ENC_ICON='secmi' # middle
356 fi
357 else
358 WIFI_KEY_TYPE='NONE'
359 ENC_SIMPLE="$(_ 'None')"; ENC_ICON='seclo' # low
360 fi
362 # Connected or not connected...
363 if ifconfig $WIFI_INTERFACE | fgrep -q inet && \
364 iwconfig $WIFI_INTERFACE | fgrep -q "ESSID:\"$ESSID\""; then
365 status="$(_ 'Connected')"
366 else
367 status='---'
368 fi
370 cat <<EOT
371 <tr>
372 <td><a data-icon="wifi" onclick="loadcfg('$ESSID', '$BSSID', '$WIFI_KEY_TYPE')">${ESSID:-$HIDDEN}</a></td>
373 <td><span data-icon="$QUALITY_ICON" title="Quality: $QUALITY"> $LEVEL dBm</span></td>
374 <td>$CHANNEL</td>
375 <td><span data-icon="$ENC_ICON">$ENC_SIMPLE</span></td>
376 <td>$status</td>
377 </tr>
378 EOT
379 done
380 fi
381 cat <<EOT
382 </tbody>
383 </table>
384 EOT
385 exit 0
386 ;;
389 *\ wifi\ *)
390 # Wireless connections settings
391 xhtml_header
393 . /etc/network.conf
394 cat <<EOT
395 <h2>$(_ 'Wireless connection')</h2>
396 EOT
398 start_disabled=''; stop_disabled=''
399 if iwconfig 2>/dev/null | grep -q 'Tx-Power=off'; then
400 stop_disabled='disabled'
401 else
402 start_disabled='disabled'
403 fi
405 [ -w /etc/network.conf ] && cat <<EOT
406 <form>
407 <input type="hidden" name="wifi"/>
408 <button name="start_wifi" data-icon="start" $start_disabled>$(_ 'Start')</button><!--
409 --><button name="stop" data-icon="stop" $stop_disabled >$(_ 'Stop' )</button><!--
410 --><button type="submit" data-icon="refresh" $stop_disabled >$(_ 'Scan' )</button>
411 </form>
412 EOT
414 [ -w /etc/network.conf ] &&
415 if [ -n "$start_disabled" ]; then
416 cat <<EOT
417 <section id="wifiList">
418 <div style="text-align: center;"><span id="ajaxStatus"></span>$(_ 'Scanning wireless interface...')</div>
419 </section>
421 <script type="text/javascript">
422 ajax('network.cgi?wifi_list', '1', 'wifiList');
423 $(parse_wpa_conf)
424 </script>
425 EOT
427 # Escape html characters in the WIFI_KEY
428 WIFI_KEY_ESCAPED="$(echo -n "$WIFI_KEY" | sed 's|&|\&amp;|g; s|<|\&lt;|g; s|>|\&gt;|g; s|"|\&quot;|g')"
430 cat <<EOT
431 <section>
432 <header>$(_ 'Connection')</header>
433 <div>
434 <form method="post" action="?wifi" id="connection">
435 <input type="hidden" name="connect_wifi"/>
436 <input type="hidden" name="bssid" id="bssid"/>
437 <table>
438 <tr><td>$(_ 'Network SSID')</td>
439 <td><input type="text" name="essid" value="$WIFI_ESSID" id="essid"/></td>
440 </tr>
442 <tr><td>$(_ 'Security')</td>
443 <td><select name="keyType" id="keyType">
444 <option value="NONE">$(_ 'None')</option>
445 <option value="WEP" >WEP</option>
446 <option value="WPA" >WPA/WPA2 PSK</option>
447 <option value="EAP" >802.1x EAP</option>
448 </select>
449 </td>
450 </tr>
452 <tr class="eap">
453 <td><div>$(_ 'EAP method')</div></td>
454 <td><div><select name="eap" id="eap">
455 <option value="PEAP">PEAP</option>
456 <option value="TLS" >TLS</option>
457 <option value="TTLS">TTLS</option>
458 <option value="PWD" >PWD</option>
459 </select>
460 </div></td>
461 </tr>
463 <tr class="eap1">
464 <td><div>$(_ 'Phase 2 authentication')</div></td>
465 <td><div><select name="phase2" id="phase2">
466 <option value="none" >$(_ 'None')</option>
467 <option value="pap" >PAP</option>
468 <option value="mschap" >MSCHAP</option>
469 <option value="mschapv2">MSCHAPV2</option>
470 <option value="gtc" >GTC</option>
471 </select>
472 </div></td>
473 </tr>
475 <tr class="eap1">
476 <td><div>$(_ 'CA certificate')</div></td>
477 <td><div><input type="text" name="caCert" id="caCert"></div></td>
478 </tr>
480 <tr class="eap1">
481 <td><div>$(_ 'User certificate')</div></td>
482 <td><div><input type="text" name="clientCert" id="clientCert"></div></td>
483 </tr>
485 <tr class="eap">
486 <td><div>$(_ 'Identity')</div></td>
487 <td><div><input type="text" name="identity" id="identity"></div></td>
488 </tr>
490 <tr class="eap1">
491 <td><div>$(_ 'Anonymous identity')</div></td>
492 <td><div><input type="text" name="anonymousIdentity" id="anonymousIdentity"></div></td>
493 </tr>
495 <tr class="wep wpa eap">
496 <td><div>$(_ 'Password')</div></td>
497 <td><div>
498 <input type="password" name="password" value="$WIFI_KEY_ESCAPED" id="password"/>
499 <span data-img="view" title="$(_ 'Show password')"
500 onmousedown="document.getElementById('password').type='text'; return false"
501 onmouseup="document.getElementById('password').type='password'"
502 onmouseout="document.getElementById('password').type='password'"
503 ></span>
504 </div></td>
505 </tr>
507 <script type="text/javascript">
508 function wifiSettingsChange() {
509 document.getElementById('connection').className =
510 document.getElementById('keyType').value.toLowerCase() + ' ' +
511 document.getElementById('eap').value.toLowerCase();
512 }
513 document.getElementById('keyType').onchange = wifiSettingsChange;
514 document.getElementById('eap').onchange = wifiSettingsChange;
516 document.getElementById('keyType').value = "$WIFI_KEY_TYPE"; wifiSettingsChange();
517 </script>
519 <style type="text/css">
520 #connection input[type="text"], #connection input[type="password"] { width: 14rem; }
521 #connection select { width: 14.4rem; }
523 #connection td { padding: 0; margin: 0; }
524 #connection [class] div {
525 max-height: 0; overflow: hidden; padding: 0; margin: 0;
526 -webkit-transition: all 0.5s ease-in-out;
527 -moz-transition: all 0.5s ease-in-out;
528 transition: all 0.5s ease-in-out;
529 }
530 .wep .wep div, .wpa .wpa div, .eap .eap div,
531 .eap.peap .eap1 div, .eap.tls .eap1 div, .eap.ttls .eap1 div {
532 max-height: 2em !important;
533 }
534 </style>
536 </table>
537 </form>
538 </div>
539 <footer>
540 <button form="connection" type="submit" name="wifi" data-icon="ok">$(_ 'Configure')</button>
541 </footer>
542 </section>
543 EOT
544 fi
546 cat <<EOT
547 <section>
548 <header>
549 $(_ 'Configuration file')
550 EOT
551 [ -w /etc/network.conf ] && cat <<EOT
552 <form action="index.cgi">
553 <input type="hidden" name="file" value="/etc/network.conf"/>
554 <button name="action" value="edit" data-icon="edit">$(_ 'Edit')</button>
555 </form>
556 EOT
557 cat <<EOT
558 </header>
559 <div>$(_ "These values are the wifi settings in the main /etc/network.conf configuration file")</div>
560 <pre>$(grep ^WIFI /etc/network.conf | sed 's|WIFI_KEY=.*|WIFI_KEY="********"|' | syntax_highlighter conf)</pre>
561 </section>
564 <section>
565 <header>$(_ 'Output of iwconfig')</header>
566 <pre>$(iwconfig)</pre>
567 </section>
568 EOT
569 ;;
572 *)
573 # Main Network page starting with a summary
574 xhtml_header
576 stop_disabled=''; start_disabled=''
577 if cat /sys/class/net/*/operstate | fgrep -q up; then
578 start_disabled='disabled'
579 else
580 stop_disabled='disabled'
581 fi
583 if [ ! -w /etc/network.conf ]; then
584 start_disabled='disabled'; stop_disabled='disabled'
585 fi
587 cat <<EOT
588 <h2>$(_ 'Networking')</h2>
590 <p>$(_ 'Manage network connections and services')</p>
592 <form action="index.cgi" id="indexform"></form>
594 <form id="mainform"><!--
595 --><button name="start" data-icon="start" $start_disabled>$(_ 'Start' )</button><!--
596 --><button name="stop" data-icon="stop" $stop_disabled >$(_ 'Stop' )</button><!--
597 --><button name="restart" data-icon="restart" $stop_disabled >$(_ 'Restart')</button>
598 </form>
600 <div class="float-right"><!--
601 -->$(_ 'Configuration:')<!--
602 --><button form="indexform" name="file" value="/etc/network.conf" data-icon="conf">network.conf</button><!--
603 --><button form="mainform" name="eth" data-icon="eth">Ethernet</button><!--
604 --><button form="mainform" name="wifi" data-icon="wifi">Wireless</button>
605 </div>
608 <section>
609 <header>$(_ 'Network interfaces')</header>
610 $(list_network_interfaces)
611 </section>
614 <section>
615 <header id="hosts">$(_ 'Hosts')</header>
616 <pre>$(cat /etc/hosts)</pre>
617 EOT
618 [ -w /etc/hosts ] && cat <<EOT
619 <footer>
620 <form action="index.cgi">
621 <input type="hidden" name="file" value="/etc/hosts"/>
622 <button name="action" value="edit" data-icon="edit">$(_ 'Edit')</button>
623 </form>
624 </footer>
625 EOT
626 cat <<EOT
627 </section>
630 <section>
631 <header>$(_ 'Hostname')</header>
632 <footer>
633 EOT
634 if [ -w /etc/hostname ]; then
635 cat <<EOT
636 <form>
637 <!-- was: name="hostname"; please don't use 'name' in name: unwanted webkit styling -->
638 <input type="text" name="host" value="$(cat /etc/hostname)"/><!--
639 --><button type="submit" data-icon="ok">$(_ 'Change')</button>
640 </form>
641 EOT
642 else
643 cat /etc/hostname
644 fi
645 cat <<EOT
646 </footer>
647 </section>
650 <section>
651 <header id="ifconfig">$(_ 'Output of ifconfig')</header>
652 <pre>$(ifconfig)</pre>
653 </section>
656 <section>
657 <header id="routing">$(_ 'Routing table')</header>
658 <pre>$(route -n)</pre>
659 </section>
662 <section>
663 <header id="dns">$(_ 'Domain name resolution')</header>
664 <pre>$(cat /etc/resolv.conf)</pre>
665 </section>
668 <section>
669 <header id="arp">$(_ 'ARP table')</header>
670 <pre>$(arp)</pre>
671 </section>
674 <section>
675 <header id="connections">$(_ 'IP Connections')</header>
676 <pre>$(netstat -anp 2>/dev/null | sed -e '/UNIX domain sockets/,$d' \
677 -e 's#\([0-9]*\)/#<a href="boot.cgi?daemons=pid=\1">\1</a>/#')</pre>
678 </section>
679 EOT
680 ;;
681 esac
683 xhtml_footer
684 exit 0