httpd, web gui: ipv6 support: include ipv6 routing table
[tomato.git] / release / src / router / www / advanced-routing.asp
blobd916206a57fff25fbc5ffa5fbf53ed71409904ab
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
9 -->
10 <html>
11 <head>
12 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
13 <meta name='robots' content='noindex,nofollow'>
14 <title>[<% ident(); %>] Advanced: Routing</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'>
16 <link rel='stylesheet' type='text/css' href='color.css'>
17 <script type='text/javascript' src='tomato.js'></script>
19 <!-- / / / -->
20 <style type='text/css'>
21 #ara-grid .co1, #ara-grid .co2, #ara-grid .co3 {
22 width: 20%;
24 #ara-grid .co4 {
25 width: 6%;
27 #ara-grid .co5 {
28 width: 34%;
31 #ars-grid .co1, #ars-grid .co2, #ars-grid .co3 {
32 width: 20%;
34 #ars-grid .co4 {
35 width: 6%;
37 #ars-grid .co5 {
38 width: 10%;
40 #ars-grid .co6 {
41 width: 24%;
43 </style>
45 <script type='text/javascript' src='debug.js'></script>
47 <script type='text/javascript'>
48 // <% nvram("wk_mode,dr_setting,lan_stp,routes_static,dhcp_routes,lan_ifname,wan_ifname,wan_iface,emf_enable"); %>
49 // <% activeroutes(); %>
51 var ara = new TomatoGrid();
53 ara.setup = function() {
54 var i, a;
56 this.init('ara-grid', 'sort');
57 this.headerSet(['Destination', 'Gateway / Next Hop', 'Subnet Mask', 'Metric', 'Interface']);
58 for (i = 0; i < activeroutes.length; ++i) {
59 a = activeroutes[i];
60 if (a[0] == nvram.lan_ifname) a[0] += ' (LAN)';
61 else if (a[0] == nvram.wan_iface) a[0] += ' (WAN)';
62 else if (a[0] == nvram.wan_ifname) a[0] += ' (MAN)';
63 this.insertData(-1, [a[1],a[2],a[3],a[4],a[0]]);
68 var ars = new TomatoGrid();
70 ars.verifyFields = function(row, quiet) {
71 var f = fields.getAll(row);
72 f[5].value = f[5].value.replace('>', '_');
73 return v_ip(f[0], quiet) && v_ip(f[1], quiet) && v_netmask(f[2], quiet) && v_range(f[3], quiet, 0, 10) && v_nodelim(f[5], quiet, 'Description');
76 ars.setup = function() {
77 this.init('ars-grid', '', 20, [
78 { type: 'text', maxlen: 15 }, { type: 'text', maxlen: 15 }, { type: 'text', maxlen: 15 },
79 { type: 'text', maxlen: 3 }, { type: 'select', options: [['LAN','LAN'],['WAN','WAN'],['MAN','MAN']] }, { type: 'text', maxlen: 32 }]);
80 this.headerSet(['Destination', 'Gateway', 'Subnet Mask', 'Metric', 'Interface', 'Description']);
81 var routes = nvram.routes_static.split('>');
82 for (var i = 0; i < routes.length; ++i) {
83 var r;
84 if (r = routes[i].match(/^(.+)<(.+)<(.+)<(\d+)<(LAN|WAN|MAN)<(.*)$/)) {
85 this.insertData(-1, [r[1], r[2], r[3], r[4], r[5],r[6]]);
88 this.showNewEditor();
89 this.resetNewEditor();
93 function verifyFields(focused, quiet)
95 return 1;
98 function save()
100 if (ars.isEditing()) return;
102 var fom = E('_fom');
103 var data = ars.getAllData();
104 var r = [];
105 for (var i = 0; i < data.length; ++i) r.push(data[i].join('<'));
106 fom.routes_static.value = r.join('>');
108 /* ZEBRA-BEGIN */
109 var wan = '0';
110 var lan = '0';
112 switch (E('_dr_setting').value) {
113 case '1':
114 lan = '1 2';
115 break;
116 case '2':
117 wan = '1 2';
118 break;
119 case '3':
120 lan = '1 2';
121 wan = '1 2';
122 break;
124 fom.dr_lan_tx.value = fom.dr_lan_rx.value = lan;
125 fom.dr_wan_tx.value = fom.dr_wan_rx.value = wan;
126 /* ZEBRA-END */
128 fom.lan_stp.value = E('_f_stp').checked ? 1 : 0;
129 fom.dhcp_routes.value = E('_f_dhcp_routes').checked ? '1' : '0';
130 fom._service.value = (fom.dhcp_routes.value != nvram.dhcp_routes) ? 'wan-restart' : 'routing-restart';
132 /* EMF-BEGIN */
133 fom.emf_enable.value = E('_f_emf').checked ? 1 : 0;
134 if (fom.emf_enable.value != nvram.emf_enable) fom._service.value = '*';
135 /* EMF-END */
137 form.submit(fom, 1);
140 function submit_complete()
142 reloadPage();
145 function earlyInit()
147 ara.setup();
148 ars.setup();
151 function init()
153 ara.recolor();
154 ars.recolor();
156 </script>
157 </head>
158 <body onload='init()'>
159 <form id='_fom' method='post' action='tomato.cgi'>
160 <table id='container' cellspacing=0>
161 <tr><td colspan=2 id='header'>
162 <div class='title'>Tomato</div>
163 <div class='version'>Version <% version(); %></div>
164 </td></tr>
165 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
166 <td id='content'>
167 <div id='ident'><% ident(); %></div>
169 <!-- / / / -->
171 <input type='hidden' name='_nextpage' value='advanced-routing.asp'>
172 <input type='hidden' name='_service' value='routing-restart'>
174 <input type='hidden' name='routes_static'>
175 <input type='hidden' name='lan_stp'>
176 <input type='hidden' name='dhcp_routes'>
177 <input type='hidden' name='emf_enable'>
178 <input type='hidden' name='dr_lan_tx'>
179 <input type='hidden' name='dr_lan_rx'>
180 <input type='hidden' name='dr_wan_tx'>
181 <input type='hidden' name='dr_wan_rx'>
183 <div class='section-title'>Current Routing Table</div>
184 <div class='section'>
185 <table class='tomato-grid' id='ara-grid'></table>
186 </div>
188 <div class='section-title'>Static Routing Table</div>
189 <div class='section'>
190 <table class='tomato-grid' id='ars-grid'></table>
191 </div>
193 <div class='section-title'>Miscellaneous</div>
194 <div class='section'>
195 <script type='text/javascript'>
196 createFieldTable('', [
197 { title: 'Mode', name: 'wk_mode', type: 'select', options: [['gateway','Gateway'],['router','Router']], value: nvram.wk_mode },
198 /* ZEBRA-BEGIN */
199 { title: 'RIPv1 &amp; v2', name: 'dr_setting', type: 'select', options: [[0,'Disabled'],[1,'LAN'],[2,'WAN'],[3,'Both']], value: nvram.dr_setting },
200 /* ZEBRA-END */
201 /* EMF-BEGIN */
202 { title: 'Efficient Multicast Forwarding', name: 'f_emf', type: 'checkbox', value: nvram.emf_enable != '0' },
203 /* EMF-END */
204 { title: 'DHCP Routes', name: 'f_dhcp_routes', type: 'checkbox', value: nvram.dhcp_routes != '0' },
205 { title: 'Spanning-Tree Protocol', name: 'f_stp', type: 'checkbox', value: nvram.lan_stp != '0' }
207 </script>
208 </div>
211 <!-- / / / -->
213 </td></tr>
214 <tr><td id='footer' colspan=2>
215 <span id='footer-msg'></span>
216 <input type='button' value='Save' id='save-button' onclick='save()'>
217 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'>
218 </td></tr>
219 </table>
220 </form>
221 <script type='text/javascript'>earlyInit()</script>
222 </body>
223 </html>