tazpanel view network.cgi @ rev 441

non-auth by default
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Apr 08 09:55:46 2015 +0200 (2015-04-08)
parents 9aeb8fa5beaa
children 169f1ccfb613
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=$(gettext '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
28 # Sleep until connection established (max 20 seconds)
29 for i in $(seq 20); do
30 [ -n "$(iwconfig 2>/dev/null | fgrep Link)" ] && break
31 sleep 1
32 done
33 }
36 # Connect to a Wi-Fi network
37 connect_wifi() {
38 /etc/init.d/network.sh stop | log
39 sed -i \
40 -e "s|^WIFI_ESSID=.*|WIFI_ESSID=\"$(GET essid)\"|" \
41 -e "s|^WIFI_BSSID=.*|WIFI_BSSID=\"$(GET bssid)\"|" \
42 -e "s|^WIFI_KEY_TYPE=.*|WIFI_KEY_TYPE=\"$(GET keyType)\"|" \
43 -e "s|^WIFI_KEY=.*|WIFI_KEY=\"$(GET password)\"|" \
44 -e "s|^WIFI_EAP_METHOD=.*|WIFI_EAP_METHOD=\"$(GET eap)\"|" \
45 -e "s|^WIFI_CA_CERT=.*|WIFI_CA_CERT=\"$(GET caCert)\"|" \
46 -e "s|^WIFI_CLIENT_CERT=.*|WIFI_CLIENT_CERT=\"$(GET clientCert)\"|" \
47 -e "s|^WIFI_IDENTITY=.*|WIFI_IDENTITY=\"$(GET identity)\"|" \
48 -e "s|^WIFI_ANONYMOUS_IDENTITY=.*|WIFI_ANONYMOUS_IDENTITY=\"$(GET anonymousIdentity)\"|" \
49 -e "s|^WIFI_PHASE2=.*|WIFI_PHASE2=\"$(GET phase2)\"|" \
50 /etc/network.conf
51 . /etc/network.conf
52 start_wifi
53 }
56 # Start an Ethernet connection
58 start_eth() {
59 case "$(GET staticip)" in
60 on) DHCP='no'; STATIC='yes';;
61 *) DHCP='yes'; STATIC='no';;
62 esac
64 /etc/init.d/network.sh stop | log
65 sleep 2
66 sed -i \
67 -e "s|^INTERFACE=.*|INTERFACE=\"$(GET iface)\"|" \
68 -e 's|^WIFI=.*|WIFI="no"|' \
69 -e "s|^DHCP=.*|DHCP=\"$DHCP\"|" \
70 -e "s|^STATIC=.*|STATIC=\"$STATIC\"|" \
71 -e "s|^IP=.*|IP=\"$(GET ip)\"|" \
72 -e "s|^NETMASK=.*|NETMASK=\"$(GET netmask)\"|" \
73 -e "s|^GATEWAY=.*|GATEWAY=\"$(GET gateway)\"|" \
74 -e "s|^DNS_SERVER=.*|DNS_SERVER=\"$(GET dns)\"|" \
75 /etc/network.conf
76 /etc/init.d/network.sh start | log
77 . /etc/network.conf
78 }
81 # Use /etc/wpa/wpa.conf as single database for known networks, passwords, etc.
82 # Translate this data to use in javascript.
84 parse_wpa_conf() {
85 awk '
86 BEGIN { print "networks = ["; begin_list = 1; network = 0; }
87 {
88 if ($0 == "network={") {
89 if (begin_list == 0) print ",";
90 begin_list = 0;
91 printf "{"; begin_obj = 1;
92 network = 1; next;
93 }
94 if (network == 1) {
95 if ($0 ~ "=") {
96 if (begin_obj == 0) printf ", ";
97 begin_obj = 0;
98 split($0, a, "=");
99 if (a[2] ~ "\"")
100 printf "%s:%s", a[1], a[2];
101 else
102 printf "%s:\"%s\"", a[1], a[2];
103 }
104 }
105 if (network == 1 && $0 ~ "}") { printf "}"; network = 0; next; }
106 }
107 END {print "\n];"}
108 ' /etc/wpa/wpa.conf | sed 's|\t||g;'
109 }
112 # Waiting for network link up
114 wait_up() {
115 for i in $(seq 10); do
116 [ -z "$(cat /sys/class/net/*/operstate | fgrep up)"] && sleep 1
117 done
118 }
120 # Actions commands before page is displayed
122 case " $(GET) " in
123 *\ start\ *)
124 /etc/init.d/network.sh start | log
125 # Here we sleep a bit to let udhcp get the lease before reloading
126 # the page with status
127 wait_up ;;
128 *\ stop\ *)
129 /etc/init.d/network.sh stop | log ;;
130 *\ restart\ *)
131 /etc/init.d/network.sh restart | log
132 wait_up ;;
133 *\ start_wifi\ *)
134 start_wifi ;;
135 *\ start_eth\ *)
136 start_eth ;;
137 *\ connect_wifi\ *)
138 connect_wifi ;;
139 *\ host\ *)
140 get_hostname="$(GET host)"
141 echo $(eval_gettext 'Changed hostname: $get_hostname') | log
142 echo "$get_hostname" > /etc/hostname ;;
143 esac
146 # Get values only now since they could have been modified by actions.
148 . /etc/network.conf
154 #
155 # Main Commands for pages
156 #
158 case " $(GET) " in
160 *\ scan\ *)
161 # Scan open ports
162 scan=$(GET scan); back=$(GET back)
163 xhtml_header
164 LOADING_MSG=$(gettext 'Scanning open ports...'); loading_msg
166 cat <<EOT
167 <section>
168 <header>
169 $(eval_gettext 'Port scanning for $scan')
170 $(back_button "$back" "$(gettext 'Network')" "")
171 </header>
172 <pre>$(pscan -b $scan)</pre>
173 </section>
174 EOT
175 ;;
178 *\ eth\ *)
179 # Wired connections settings
180 xhtml_header
182 PAR1="size=\"20\" required"; PAR="$PAR1 pattern=\"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\""
184 case "$STATIC" in
185 yes) use_static='checked';;
186 *) use_static='';;
187 esac
189 stop_disabled=''; start_disabled=''
190 if cat /sys/class/net/eth*/operstate | fgrep -q up; then
191 start_disabled='disabled'
192 else
193 stop_disabled='disabled'
194 fi
196 cat <<EOT
197 <h2>$(gettext 'Ethernet connection')</h2>
198 EOT
199 [ -w /etc/network.conf ] && cat <<EOT
200 <p>$(gettext "Here you can configure a wired connection using DHCP to \
201 automatically get a random IP or configure a static/fixed IP")</p>
203 <section>
204 <header>$(gettext 'Configuration')</header>
205 <form id="conf">
206 <input type="hidden" name="eth"/>
207 <div>
208 <table>
209 <tr><td>$(gettext 'Interface')</td>
210 <td><select name="iface" value="$INTERFACE" style="width:100%">
211 $(cd /sys/class/net; ls -1 | awk -viface="$INTERFACE" '{
212 sel = ($0 == iface) ? " selected":""
213 printf "<option value=\"%s\"%s>%s", $0, sel, $0
214 }')
215 </select></td>
216 </tr>
217 <tr><td>$(gettext 'Static IP')</td>
218 <td><label><input type="checkbox" name="staticip" id="staticip" $use_static/>
219 $(gettext 'Use static IP')</td>
220 </tr>
221 <tr id="st1"><td>$(gettext 'IP address')</td>
222 <td><input type="text" name="ip" value="$IP" $PAR/></td>
223 </tr>
224 <tr id="st2"><td>$(gettext 'Netmask')</td>
225 <td><input type="text" name="netmask" value="$NETMASK" $PAR/></td>
226 </tr>
227 <tr id="st3"><td>$(gettext 'Gateway')</td>
228 <td><input type="text" name="gateway" value="$GATEWAY" $PAR/></td>
229 </tr>
230 <tr id="st4"><td>$(gettext 'DNS server')</td>
231 <td><input type="text" name="dns" value="$DNS_SERVER" $PAR/></td>
232 </tr>
233 </table>
234 </div>
235 </form>
236 <footer><!--
237 --><button form="conf" type="submit" name="start_eth" data-icon="start" $start_disabled>$(gettext 'Start' )</button><!--
238 --><button form="conf" type="submit" name="stop" data-icon="stop" $stop_disabled >$(gettext 'Stop' )</button><!--
239 --></footer>
240 </section>
242 <script type="text/javascript">
243 function static_change() {
244 staticip = document.getElementById('staticip').checked;
245 for (i = 1; i < 5; i++) {
246 document.getElementById('st' + i).style.display = staticip ? '' : 'none';
247 }
248 }
250 document.getElementById('staticip').onchange = static_change;
251 static_change();
252 </script>
253 EOT
254 cat <<EOT
255 <section>
256 <header>
257 $(gettext 'Configuration file')
258 EOT
259 [ -w /etc/network.conf ] && cat <<EOT
260 <form action="index.cgi">
261 <input type="hidden" name="file" value="/etc/network.conf"/>
262 <button name="action" value="edit" data-icon="edit">$(gettext 'Edit')</button>
263 </form>
264 EOT
265 cat <<EOT
266 </header>
267 <div>$(gettext "These values are the ethernet settings in the main /etc/network.conf configuration file")</div>
268 <pre>$(awk '{if($1 !~ "WIFI" && $1 !~ "#" && $1 != ""){print $0}}' /etc/network.conf | syntax_highlighter conf)</pre>
269 </section>
270 EOT
271 ;;
275 *\ wifi_list\ *)
276 # Catch ESSIDs and format output.
277 # We get the list of networks by Cell and without spaces.
279 HIDDEN="$(gettext '(hidden)')"
281 cat <<EOT
282 <table class="wide center zebra">
283 <thead>
284 <tr>
285 <td>$(gettext 'Name')</td>
286 <td>$(gettext 'Signal level')</td>
287 <td>$(gettext 'Channel')</td>
288 <td>$(gettext 'Encryption')</td>
289 <td>$(gettext 'Status')</td>
290 </tr>
291 </thead>
292 <tbody>
293 EOT
294 if [ -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then
295 ifconfig $WIFI_INTERFACE up
296 for i in $(iwlist $WIFI_INTERFACE scan | sed '/Cell /!d;s/.*Cell \([^ ]*\).*/Cell.\1/')
297 do
298 SCAN=$(iwlist $WIFI_INTERFACE scan last | sed "/$i/,/Cell/!d" | sed '$d')
300 BSSID=$(echo "$SCAN" | sed -n 's|.*Address: \([^ ]*\).*|\1|p')
302 CHANNEL=$(echo "$SCAN" | sed -n 's|.*Channel[:=]\([^ ]*\).*|\1|p')
304 QUALITY=$(echo "$SCAN" | sed -n 's|.*Quality[:=]\([^ ]*\).*|\1|p')
305 QUALITY_ICON="lvl$(( 5*${QUALITY:-0} ))" # lvl0 .. lvl4, lvl5
306 LEVEL=$(echo "$SCAN" | sed -n 's|.*Signal level[:=]\([^ ]*\).*|\1|p; s|-|−|')
308 ENCRYPTION=$(echo "$SCAN" | sed -n 's|.*Encryption key[:=]\([^ ]*\).*|\1|p') # on/off
310 ESSID=$(echo "$SCAN" | sed -n 's|.*ESSID:"\([^"]*\).*|\1|p')
312 # WPA Type - Group Cipher - Pairwise Ciphers - Authentication Suites
313 # {WPA|WPA2}-{TKIP|CCMP}-{TKIP|CCMP|TKIP CCMP}-{PSK|802.1x}
314 #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|-$||')"
316 # Authentication type
317 AUTH="$(echo "$SCAN" | sed -n 's|.*Authentication Suites[^:]*: *\(.*\)|\1|p')"
318 if [ -n "$(echo -n $AUTH | fgrep PSK)" ]; then
319 # WPA-Personal. Authentication using password (PSK = pre-shared key)
320 WIFI_KEY_TYPE='WPA'
321 elif [ -n "$(echo -n $AUTH | fgrep 802.1x)" ]; then
322 # WPA-Enterprise. Authentication using username, password, certificates...
323 WIFI_KEY_TYPE='EAP'
324 else
325 WIFI_KEY_TYPE='NONE'
326 fi
328 # Check encryption type
329 if [ "$ENCRYPTION" == 'on' ]; then
330 # "WPA" or "WPA2" or "WPA/WPA2" (maybe also "WPA2/WPA")
331 ENC_SIMPLE=$(echo "$SCAN" | sed -n '/.*WPA.*/ s|.*\(WPA[^ ]*\).*|\1|p')
332 ENC_SIMPLE=$(echo $ENC_SIMPLE | sed 's| |/|')
333 ENC_ICON='sechi' # high
334 if [ -z "$ENC_SIMPLE" ]; then
335 WIFI_KEY_TYPE='WEP'
336 ENC_SIMPLE='WEP'; ENC_ICON='secmi' # middle
337 fi
338 else
339 WIFI_KEY_TYPE='NONE'
340 ENC_SIMPLE="$(gettext 'None')"; ENC_ICON='seclo' # low
341 fi
343 #
344 #if echo $SCAN | grep -q 'Mode:Managed'; then
345 # AP="&amp;ap=$(echo $SCAN | sed 's/.*Address: \([^ ]*\).*/\1/')"
346 #else
347 # AP=''
348 #fi
350 # Connected or not connected...
351 if ifconfig $WIFI_INTERFACE | fgrep -q inet && \
352 iwconfig $WIFI_INTERFACE | fgrep -q "ESSID:\"$ESSID\""; then
353 status="$(gettext 'Connected')"
354 else
355 status='---'
356 fi
358 cat <<EOT
359 <tr>
360 <td><a data-icon="wifi" onclick="loadcfg('$ESSID', '$BSSID', '$WIFI_KEY_TYPE')">${ESSID:-$HIDDEN}</a></td>
361 <td><span data-icon="$QUALITY_ICON" title="Quality: $QUALITY"> $LEVEL dBm</span></td>
362 <td>$CHANNEL</td>
363 <td><span data-icon="$ENC_ICON">$ENC_SIMPLE</span></td>
364 <td>$status</td>
365 </tr>
366 EOT
367 done
368 fi
369 cat <<EOT
370 </tbody>
371 </table>
372 EOT
373 exit 0
374 ;;
377 *\ wifi\ *)
378 # Wireless connections settings
379 xhtml_header
381 . /etc/network.conf
382 cat <<EOT
383 <h2>$(gettext 'Wireless connection')</h2>
384 EOT
386 start_disabled=''; stop_disabled=''
387 if iwconfig 2>/dev/null | grep -q 'Tx-Power=off'; then
388 stop_disabled='disabled'
389 else
390 start_disabled='disabled'
391 fi
393 [ -w /etc/network.conf ] && cat <<EOT
394 <form>
395 <input type="hidden" name="wifi"/>
396 <button name="start_wifi" data-icon="start" $start_disabled>$(gettext 'Start')</button><!--
397 --><button name="stop" data-icon="stop" $stop_disabled >$(gettext 'Stop' )</button><!--
398 --><button type="submit" data-icon="refresh" $stop_disabled >$(gettext 'Scan' )</button>
399 </form>
400 EOT
402 [ -w /etc/network.conf ] &&
403 if [ -n "$start_disabled" ]; then
404 cat <<EOT
405 <section id="wifiList">
406 <div style="text-align: center;"><span id="ajaxStatus"></span>$(gettext 'Scanning wireless interface...')</div>
407 </section>
409 <script type="text/javascript">
410 ajax('network.cgi?wifi_list', '1', 'wifiList');
411 $(parse_wpa_conf)
412 </script>
413 EOT
415 # ESSID names are clickable
416 #SELECT="$(GET select)"
417 #if [ -n "$SELECT" ]; then
418 # [ "$SELECT" != "$WIFI_ESSID" ] && WIFI_KEY=''
419 # WIFI_ESSID="$SELECT"
420 #fi
422 cat <<EOT
423 <section>
424 <header>$(gettext 'Connection')</header>
425 <div>
426 <form id="connection">
427 <input type="hidden" name="connect_wifi"/>
428 <input type="hidden" name="bssid" id="bssid"/>
429 <table>
430 <tr><td>$(gettext 'Network SSID')</td>
431 <td><input type="text" name="essid" value="$WIFI_ESSID" id="essid"/></td>
432 </tr>
434 <tr><td>$(gettext 'Security')</td>
435 <td><select name="keyType" id="keyType">
436 <option value="NONE">$(gettext 'None')</option>
437 <option value="WEP" >WEP</option>
438 <option value="WPA" >WPA/WPA2 PSK</option>
439 <option value="EAP" >802.1x EAP</option>
440 </select>
441 </td>
442 </tr>
444 <tr class="eap">
445 <td><div>$(gettext 'EAP method')</div></td>
446 <td><div><select name="eap" id="eap">
447 <option value="PEAP">PEAP</option>
448 <option value="TLS" >TLS</option>
449 <option value="TTLS">TTLS</option>
450 <option value="PWD" >PWD</option>
451 </select>
452 </div></td>
453 </tr>
455 <tr class="eap1">
456 <td><div>$(gettext 'Phase 2 authentication')</div></td>
457 <td><div><select name="phase2" id="phase2">
458 <option value="none" >$(gettext 'None')</option>
459 <option value="pap" >PAP</option>
460 <option value="mschap" >MSCHAP</option>
461 <option value="mschapv2">MSCHAPV2</option>
462 <option value="gtc" >GTC</option>
463 </select>
464 </div></td>
465 </tr>
467 <tr class="eap1">
468 <td><div>$(gettext 'CA certificate')</div></td>
469 <td><div><input type="text" name="caCert" id="caCert"></div></td>
470 </tr>
472 <tr class="eap1">
473 <td><div>$(gettext 'User certificate')</div></td>
474 <td><div><input type="text" name="clientCert" id="clientCert"></div></td>
475 </tr>
477 <tr class="eap">
478 <td><div>$(gettext 'Identity')</div></td>
479 <td><div><input type="text" name="identity" id="identity"></div></td>
480 </tr>
482 <tr class="eap1">
483 <td><div>$(gettext 'Anonymous identity')</div></td>
484 <td><div><input type="text" name="anonymousIdentity" id="anonymousIdentity"></div></td>
485 </tr>
487 <tr class="wep wpa eap">
488 <td><div>$(gettext 'Password')</div></td>
489 <td><div>
490 <input type="password" name="password" value="$WIFI_KEY" id="password"/>
491 <span data-img="view" title="$(gettext 'Show password')"
492 onmousedown="document.getElementById('password').type='text'; return false"
493 onmouseup="document.getElementById('password').type='password'"
494 onmouseout="document.getElementById('password').type='password'"
495 ></span>
496 </div></td>
497 </tr>
500 <!--
501 <tr><td>$(gettext 'Access point')</td>
502 <td><input type="text" name="ap" value="$WIFI_AP"/></td>
503 </tr>
504 -->
506 <script type="text/javascript">
507 function wifiSettingsChange() {
508 document.getElementById('connection').className =
509 document.getElementById('keyType').value.toLowerCase() + ' ' +
510 document.getElementById('eap').value.toLowerCase();
511 }
512 document.getElementById('keyType').onchange = wifiSettingsChange;
513 document.getElementById('eap').onchange = wifiSettingsChange;
515 document.getElementById('keyType').value = "$WIFI_KEY_TYPE"; wifiSettingsChange();
516 </script>
518 <style type="text/css">
519 #connection input[type="text"], #connection input[type="password"] { width: 14rem; }
520 #connection select { width: 14.4rem; }
522 #connection td { padding: 0; margin: 0; }
523 #connection [class] div {
524 max-height: 0; overflow: hidden; padding: 0; margin: 0;
525 -webkit-transition: all 0.5s ease-in-out;
526 -moz-transition: all 0.5s ease-in-out;
527 transition: all 0.5s ease-in-out;
528 }
529 .wep .wep div, .wpa .wpa div, .eap .eap div,
530 .eap.peap .eap1 div, .eap.tls .eap1 div, .eap.ttls .eap1 div {
531 max-height: 2em !important;
532 }
533 </style>
535 </table>
536 </form>
537 </div>
538 <footer>
539 <button form="connection" type="submit" name="wifi" data-icon="ok">$(gettext 'Configure')</button>
540 </footer>
541 </section>
542 EOT
543 fi
545 cat <<EOT
546 <section>
547 <header>
548 $(gettext 'Configuration file')
549 EOT
550 [ -w /etc/network.conf ] && cat <<EOT
551 <form action="index.cgi">
552 <input type="hidden" name="file" value="/etc/network.conf"/>
553 <button name="action" value="edit" data-icon="edit">$(gettext 'Edit')</button>
554 </form>
555 EOT
556 cat <<EOT
557 </header>
558 <div>$(gettext "These values are the wifi settings in the main /etc/network.conf configuration file")</div>
559 <pre>$(grep ^WIFI /etc/network.conf | sed '/WIFI_KEY=/s|".*"|"********"|' | syntax_highlighter conf)</pre>
560 </section>
563 <section>
564 <header>$(gettext 'Output of iwconfig')</header>
565 <pre>$(iwconfig)</pre>
566 </section>
567 EOT
568 ;;
571 *)
572 # Main Network page starting with a summary
573 xhtml_header
575 stop_disabled=''; start_disabled=''
576 if cat /sys/class/net/*/operstate | fgrep -q up; then
577 start_disabled='disabled'
578 else
579 stop_disabled='disabled'
580 fi
582 if [ ! -w /etc/network.conf ]; then
583 start_disabled='disabled'; stop_disabled='disabled'
584 fi
586 cat <<EOT
587 <h2>$(gettext 'Networking')</h2>
589 <p>$(gettext 'Manage network connections and services')</p>
591 <form action="index.cgi" id="indexform"></form>
593 <form id="mainform"><!--
594 --><button name="start" data-icon="start" $start_disabled>$(gettext 'Start' )</button><!--
595 --><button name="stop" data-icon="stop" $stop_disabled >$(gettext 'Stop' )</button><!--
596 --><button name="restart" data-icon="restart" $stop_disabled >$(gettext 'Restart')</button>
597 </form>
599 <div class="float-right"><!--
600 -->$(gettext 'Configuration:')<!--
601 --><button form="indexform" name="file" value="/etc/network.conf" data-icon="conf">network.conf</button><!--
602 --><button form="mainform" name="eth" data-icon="eth">Ethernet</button><!--
603 --><button form="mainform" name="wifi" data-icon="wifi">Wireless</button>
604 </div>
607 <section>
608 <header>$(gettext 'Network interfaces')</header>
609 $(list_network_interfaces)
610 </section>
613 <section>
614 <header id="hosts">$(gettext 'Hosts')</header>
615 <pre>$(cat /etc/hosts)</pre>
616 EOT
617 [ -w /etc/hosts ] && cat <<EOT
618 <footer>
619 <form action="index.cgi">
620 <input type="hidden" name="file" value="/etc/hosts"/>
621 <button name="action" value="edit" data-icon="edit">$(gettext 'Edit')</button>
622 </form>
623 </footer>
624 EOT
625 cat <<EOT
626 </section>
629 <section>
630 <header>$(gettext 'Hostname')</header>
631 <footer>
632 EOT
633 if [ -w /etc/hostname ]; then
634 cat <<EOT
635 <form>
636 <!-- was: name="hostname"; please don't use 'name' in name: unwanted webkit styling -->
637 <input type="text" name="host" value="$(cat /etc/hostname)"/><!--
638 --><button type="submit" data-icon="ok">$(gettext 'Change')</button>
639 </form>
640 EOT
641 else
642 cat /etc/hostname
643 fi
644 cat <<EOT
645 </footer>
646 </section>
649 <section>
650 <header id="ifconfig">$(gettext 'Output of ifconfig')</header>
651 <pre>$(ifconfig)</pre>
652 </section>
655 <section>
656 <header id="routing">$(gettext 'Routing table')</header>
657 <pre>$(route -n)</pre>
658 </section>
661 <section>
662 <header id="dns">$(gettext 'Domain name resolution')</header>
663 <pre>$(cat /etc/resolv.conf)</pre>
664 </section>
667 <section>
668 <header id="arp">$(gettext 'ARP table')</header>
669 <pre>$(arp)</pre>
670 </section>
673 <section>
674 <header id="connections">$(gettext 'IP Connections')</header>
675 <pre>$(netstat -anp 2>/dev/null | sed -e '/UNIX domain sockets/,$d' \
676 -e 's#\([0-9]*\)/#<a href="boot.cgi?daemons=pid=\1">\1</a>/#')</pre>
677 </section>
678 EOT
679 ;;
680 esac
682 xhtml_footer
683 exit 0