tazpanel view network.cgi @ rev 68

network.cgi: add routing table
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Apr 12 00:47:59 2011 +0200 (2011-04-12)
parents 95dc2475f4ae
children e4a7503f7efd
line source
1 #!/bin/sh
2 #
3 # Network configuration CGI interface
4 #
5 echo "Content-Type: text/html"
6 echo ""
8 # Common functions from libtazpanel
9 . lib/libtazpanel
10 get_config
12 # Include gettext helper script.
13 . /usr/bin/gettext.sh
15 # Export package name for gettext.
16 TEXTDOMAIN='tazpanel'
17 export TEXTDOMAIN
19 TITLE="- Network"
21 # Actions commands before page is displayed
22 case "$QUERY_STRING" in
23 start)
24 # Here we sleep a bit to let udhcp get the lease before reloading
25 # page with status
26 /etc/init.d/network.sh start >/dev/null
27 sleep 2 ;;
28 stop)
29 /etc/init.d/network.sh stop >/dev/null ;;
30 *)
31 continue ;;
32 esac
34 #
35 # Main Commands for pages
36 #
38 case "$QUERY_STRING" in
39 eth)
40 # Wired connections settings
41 xhtml_header
43 cat << EOT
44 <h2>`gettext "Ethernet connection`</h2>
45 <pre>
46 `grep ^[A-V] /etc/network.conf`
47 </pre>
48 EOT
49 ;;
50 wifi)
51 # Wireless connections settings
52 xhtml_header
54 cat << EOT
55 <h2>`gettext "Wireless connection`</h2>
56 <pre>
57 `grep ^WIFI_ /etc/network.conf`
58 </pre>
59 EOT
60 ;;
61 *)
62 # Main Network page starting with a summary
63 xhtml_header
65 cat << EOT
66 <h2>`gettext "Networking`</h2>
67 <p>
68 `gettext "Manage network connections and services`
69 </p>
70 <div id="actions">
71 <p>
72 `gettext "Connection:"`
73 <a class="button" href="$SCRIPT_NAME?start">`gettext "Start"`</a>
74 <a class="button" href="$SCRIPT_NAME?stop">`gettext "Stop"`</a>
75 </p>
76 </div>
78 `list_network_interfaces`
80 <h3>`gettext "Output of ifconfig"`</h3>
81 <pre>
82 `ifconfig`
83 </pre>
85 <h3>`gettext "Routing table"`</h3>
86 <pre>
87 `route -n`
88 </pre>
90 <h3>`gettext "Domain name resolution"`</h3>
91 <pre>
92 `cat /etc/resolv.conf`
93 </pre>
95 <h3>`gettext "ARP table"`</h3>
96 <pre>
97 `arp`
98 </pre>
99 EOT
100 ;;
101 esac
103 xhtml_footer
104 exit 0