1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
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.
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>
20 <style type='text/css'
>
21 #ara-grid .co1
, #ara-grid
.co2
, #ara-grid
.co3
{
31 #ars-grid .co1
, #ars-grid
.co2
, #ars-grid
.co3
{
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() {
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
) {
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
) {
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]]);
89 this.resetNewEditor();
93 function verifyFields(focused
, quiet
)
100 if (ars
.isEditing()) return;
103 var data
= ars
.getAllData();
105 for (var i
= 0; i
< data
.length
; ++i
) r
.push(data
[i
].join('<'));
106 fom
.routes_static
.value
= r
.join('>');
112 switch (E('_dr_setting').value
) {
124 fom
.dr_lan_tx
.value
= fom
.dr_lan_rx
.value
= lan
;
125 fom
.dr_wan_tx
.value
= fom
.dr_wan_rx
.value
= wan
;
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';
133 fom
.emf_enable
.value
= E('_f_emf').checked
? 1 : 0;
134 if (fom
.emf_enable
.value
!= nvram
.emf_enable
) fom
._service
.value
= '*';
140 function submit_complete()
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>
165 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
167 <div id='ident'
><%
ident(); %></div>
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>
188 <div class='section-title'
>Static Routing Table
</div>
189 <div class='section'
>
190 <table class='tomato-grid' id='ars-grid'
></table>
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
},
199 { title
: 'RIPv1 & v2', name
: 'dr_setting', type
: 'select', options
: [[0,'Disabled'],[1,'LAN'],[2,'WAN'],[3,'Both']], value
: nvram
.dr_setting
},
202 { title
: 'Efficient Multicast Forwarding', name
: 'f_emf', type
: 'checkbox', value
: nvram
.emf_enable
!= '0' },
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' }
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();'
>
221 <script type='text/javascript'
>earlyInit()</script>