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,lan_ifname,wan_ifname"); %>
49 // <% activeroutes(); %>
51 var ara
= new TomatoGrid();
53 ara
.setup = function() {
56 this.init('ara-grid', 'sort');
57 this.headerSet(['Destination', 'Gateway', '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_ifname
) a
[0] += ' (WAN)';
62 this.insertData(-1, [a
[1],a
[2],a
[3],a
[4],a
[0]]);
67 var ars
= new TomatoGrid();
69 ars
.verifyFields = function(row
, quiet
) {
70 var f
= fields
.getAll(row
);
71 f
[5].value
= f
[5].value
.replace('>', '_');
72 return v_ip(f
[0], quiet
) && v_ip(f
[1], quiet
) && v_netmask(f
[2], quiet
) && v_range(f
[3], quiet
, 0, 10);
75 ars
.setup = function() {
76 this.init('ars-grid', '', 20, [
77 { type
: 'text', maxlen
: 15 }, { type
: 'text', maxlen
: 15 }, { type
: 'text', maxlen
: 15 },
78 { type
: 'text', maxlen
: 3 }, { type
: 'select', options
: [['LAN','LAN'],['WAN','WAN']] }, { type
: 'text', maxlen
: 32 }]);
79 this.headerSet(['Destination', 'Gateway', 'Subnet Mask', 'Metric', 'Interface', 'Description']);
80 var routes
= nvram
.routes_static
.split('>');
81 for (var i
= 0; i
< routes
.length
; ++i
) {
83 if (r
= routes
[i
].match(/^(.+)<(.+)<(.+)<(\d+)<(LAN|WAN)<(.*)$/)) {
84 this.insertData(-1, [r
[1], r
[2], r
[3], r
[4], r
[5],r
[6]]);
88 this.resetNewEditor();
92 function verifyFields(focused
, quiet
)
99 if (ars
.isEditing()) return;
102 var data
= ars
.getAllData();
104 for (var i
= 0; i
< data
.length
; ++i
) r
.push(data
[i
].join('<'));
105 fom
.routes_static
.value
= r
.join('>');
109 switch (E('_dr_setting').value
) {
121 fom
.dr_lan_tx
.value
= fom
.dr_lan_rx
.value
= lan
;
122 fom
.dr_wan_tx
.value
= fom
.dr_wan_rx
.value
= wan
;
124 fom
.lan_stp
.value
= E('_f_stp').checked
? 1 : 0;
142 <body onload='init()'
>
143 <form id='_fom' method='post' action='tomato.cgi'
>
144 <table id='container' cellspacing=
0>
145 <tr><td colspan=
2 id='header'
>
146 <div class='title'
>Tomato
</div>
147 <div class='version'
>Version <%
version(); %></div>
149 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
151 <div id='ident'
><%
ident(); %></div>
155 <input type='hidden' name='_nextpage' value='advanced-routing.asp'
>
156 <input type='hidden' name='_service' value='routing-restart'
>
158 <input type='hidden' name='routes_static'
>
159 <input type='hidden' name='lan_stp'
>
160 <input type='hidden' name='dr_lan_tx'
>
161 <input type='hidden' name='dr_lan_rx'
>
162 <input type='hidden' name='dr_wan_tx'
>
163 <input type='hidden' name='dr_wan_rx'
>
165 <div class='section-title'
>Current Routing Table
</div>
166 <div class='section'
>
167 <table class='tomato-grid' id='ara-grid'
></table>
170 <div class='section-title'
>Static Routing Table
</div>
171 <div class='section'
>
172 <table class='tomato-grid' id='ars-grid'
></table>
175 <div class='section-title'
>Miscellaneous
</div>
176 <div class='section'
>
177 <script type='text/javascript'
>
178 createFieldTable('', [
179 { title
: 'Mode', name
: 'wk_mode', type
: 'select', options
: [['gateway','Gateway'],['router','Router']], value
: nvram
.wk_mode
},
180 { title
: 'RIPv1 & v2', name
: 'dr_setting', type
: 'select', options
: [[0,'Disabled'],[1,'LAN'],[2,'WAN'],[3,'Both']], value
: nvram
.dr_setting
},
181 { title
: 'Spanning-Tree Protocol', name
: 'f_stp', type
: 'checkbox', value
: nvram
.lan_stp
!= '0' },
190 <tr><td id='footer' colspan=
2>
191 <span id='footer-msg'
></span>
192 <input type='button' value='Save' id='save-button' onclick='save()'
>
193 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'
>
197 <script type='text/javascript'
>earlyInit()</script>