RSA Keylength to 1024
[tomato.git] / release / src / router / www / advanced-ctnf.asp
blobab182084d7e8ae0abe3616dba2d35c2dfe588831
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: Conntrack / Netfilter</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 <!-- / / / -->
21 <script type='text/javascript' src='debug.js'></script>
23 <script type='text/javascript'>
25 // <% nvram("ct_tcp_timeout,ct_udp_timeout,ct_timeout,ct_max,ct_hashsize,nf_l7in,nf_ttl,nf_sip,nf_rtsp,nf_pptp,nf_h323,nf_ftp"); %>
27 var checker = null;
28 var timer = new TomatoTimer(check);
29 var running = 0;
31 function check()
33 timer.stop();
34 if ((checker) || (!running)) return;
36 checker = new XmlHttp();
37 checker.onCompleted = function(text, xml) {
38 var conntrack, total, i;
39 conntrack = null;
40 total = 0;
41 try {
42 eval(text);
44 catch (ex) {
45 conntrack = [];
47 for (i = 1; i < 13; ++i) {
48 E('count' + i).innerHTML = '&nbsp; <small>('+ ((conntrack[i] || 0) * 1) + ' in this state)</small>';
50 E('count0').innerHTML = '(' + ((conntrack[0] || 0) * 1) + ' connections currently tracked)';
51 checker = null;
52 timer.start(3000);
54 checker.onError = function(x) {
55 checker = null;
56 timer.start(6000);
59 checker.post('update.cgi', 'exec=ctcount&arg0=0');
62 function clicked()
64 running ^= 1;
65 E('spin').style.visibility = running ? 'visible' : 'hidden';
66 if (running) check();
70 var expireText;
72 function expireTimer()
74 var e = E('expire');
76 if (!expireText) expireText = e.value;
78 if (--expireTime == 0) {
79 e.disabled = false;
80 e.value = expireText;
82 else {
83 setTimeout(expireTimer, 1000);
84 e.value = 'Expire Scheduled... ' + expireTime;
88 function expireClicked()
90 expireTime = 18;
91 E('expire').disabled = true;
92 (new XmlHttp()).post('expct.cgi', '');
93 expireTimer();
97 function verifyFields(focused, quiet)
99 var i, v;
101 for (i = 1; i < 9; ++i) {
102 if (!v_range('_f_tcp_' + i, quiet, 1, 432000)) return 0;
104 for (i = 0; i < 2; ++i) {
105 if (!v_range('_f_udp_' + i, quiet, 1, 432000)) return 0;
107 for (i = 0; i < 2; ++i) {
108 if (!v_range('_f_ct_' + i, quiet, 1, 432000)) return 0;
111 if (!v_range('_ct_max', quiet, 128, 300000)) return 0;
113 /* LINUX26-BEGIN */
114 if (!v_range('_ct_hashsize', quiet, 127, 65535)) return 0;
115 /* LINUX26-END */
117 v = (E('_f_nf_ttl').value == '');
118 E('_f_ttl_val').style.display = v ? '' : 'none';
119 if ((v) && !v_range('_f_ttl_val', quiet, 0, 255)) return 0;
121 return 1;
124 function save()
126 var i, tcp, udp, ct, fom;
128 if (!verifyFields(null, false)) return;
130 tcp = [];
131 tcp.push('0');
132 for (i = 1; i < 9; ++i) {
133 tcp.push(E('_f_tcp_' + i).value);
135 tcp.push('0');
137 udp = [];
138 for (i = 0; i < 2; ++i) {
139 udp.push(E('_f_udp_' + i).value);
142 ct = [];
143 for (i = 0; i < 2; ++i) {
144 ct.push(E('_f_ct_' + i).value);
147 fom = E('_fom');
148 fom.ct_tcp_timeout.value = tcp.join(' ');
149 fom.ct_udp_timeout.value = udp.join(' ');
150 fom.ct_timeout.value = ct.join(' ');
151 fom.nf_l7in.value = E('_f_l7in').checked ? 1 : 0;
152 /* LINUX26-BEGIN */
153 fom.nf_sip.value = E('_f_sip').checked ? 1 : 0;
154 /* LINUX26-END */
155 fom.nf_rtsp.value = E('_f_rtsp').checked ? 1 : 0;
156 fom.nf_pptp.value = E('_f_pptp').checked ? 1 : 0;
157 fom.nf_h323.value = E('_f_h323').checked ? 1 : 0;
158 fom.nf_ftp.value = E('_f_ftp').checked ? 1 : 0;
160 i = E('_f_nf_ttl').value;
161 if (i == '')
162 fom.nf_ttl.value = 'c:' + E('_f_ttl_val').value;
163 else
164 fom.nf_ttl.value = i;
166 form.submit(fom, 1);
168 </script>
170 </head>
171 <body>
172 <form id='_fom' method='post' action='tomato.cgi'>
173 <table id='container' cellspacing=0>
174 <tr><td colspan=2 id='header'>
175 <div class='title'>Tomato</div>
176 <div class='version'>Version <% version(); %></div>
177 </td></tr>
178 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
179 <td id='content'>
180 <div id='ident'><% ident(); %></div>
182 <!-- / / / -->
184 <input type='hidden' name='_nextpage' value='advanced-ctnf.asp'>
185 <input type='hidden' name='_service' value='ctnf-restart'>
187 <input type='hidden' name='ct_tcp_timeout' value=''>
188 <input type='hidden' name='ct_udp_timeout' value=''>
189 <input type='hidden' name='ct_timeout' value=''>
190 <input type='hidden' name='nf_l7in' value=''>
191 <input type='hidden' name='nf_ttl'>
192 <input type='hidden' name='nf_rtsp'>
193 <input type='hidden' name='nf_pptp'>
194 <input type='hidden' name='nf_h323'>
195 <input type='hidden' name='nf_ftp'>
196 /* LINUX26-BEGIN */
197 <input type='hidden' name='nf_sip'>
198 /* LINUX26-END */
200 <div class='section-title'>Connections</div>
201 <div class='section'>
202 <script type='text/javascript'>
203 createFieldTable('', [
204 { title: 'Maximum Connections', name: 'ct_max', type: 'text', maxlen: 6, size: 8,
205 suffix: '&nbsp; <a href="javascript:clicked()" id="count0">[ count current... ]</a> <img src="spin.gif" style="vertical-align:bottom;padding-left:10px;visibility:hidden" id="spin" onclick="clicked()">',
206 value: fixInt(nvram.ct_max || 4096, 128, 300000, 4096) }
207 /* LINUX26-BEGIN */
208 ,{ title: 'Hash Table Size', name: 'ct_hashsize', type: 'text', maxlen: 6, size: 8, value: nvram.ct_hashsize || 1023 }
209 /* LINUX26-END */
211 </script>
212 <br>
213 <input type='button' value='Drop Idle' onclick='expireClicked()' id='expire'>
214 <br><br>
215 </div>
218 <div class='section-title'>TCP Timeout</div>
219 <div class='section'>
220 <script type='text/javascript'>
221 if ((v = nvram.ct_tcp_timeout.match(/^(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/)) == null) {
222 v = [0,0,1200,120,60,120,120,10,60,30,0];
224 titles = ['-', 'None', 'Established', 'SYN Sent', 'SYN Received', 'FIN Wait', 'Time Wait', 'Close', 'Close Wait', 'Last ACK', 'Listen'];
225 f = [{ title: ' ', text: '<small>(seconds)</small>' }];
226 for (i = 1; i < 11; ++i) {
227 f.push({ title: titles[i], name: ('f_tcp_' + (i - 1)),
228 type: 'text', maxlen: 6, size: 8, value: v[i],
229 hidden: (i == 1 || i == 10) ? 1 : 0,
230 suffix: '<span id="count' + i + '"></span>' });
232 createFieldTable('', f);
233 </script>
234 </div>
236 <div class='section-title'>UDP Timeout</div>
237 <div class='section'>
238 <script type='text/javascript'>
239 if ((v = nvram.ct_udp_timeout.match(/^(\d+)\s+(\d+)$/)) == null) {
240 v = [0,30,180];
242 createFieldTable('', [
243 { title: ' ', text: '<small>(seconds)</small>' },
244 { title: 'Unreplied', name: 'f_udp_0', type: 'text', maxlen: 6, size: 8, value: v[1], suffix: '<span id="count11"></span>' },
245 { title: 'Assured', name: 'f_udp_1', type: 'text', maxlen: 6, size: 8, value: v[2], suffix: '<span id="count12"></span>' }
247 </script>
248 </div>
250 <div class='section-title'>Other Timeouts</div>
251 <div class='section'>
252 <script type='text/javascript'>
253 if ((v = nvram.ct_timeout.match(/^(\d+)\s+(\d+)$/)) == null) {
254 v = [0,600,30];
256 createFieldTable('', [
257 { title: ' ', text: '<small>(seconds)</small>' },
258 { title: 'Generic', name: 'f_ct_0', type: 'text', maxlen: 6, size: 8, value: v[1] },
259 { title: 'ICMP', name: 'f_ct_1', type: 'text', maxlen: 6, size: 8, value: v[2] }
261 </script>
262 </div>
264 <div class='section-title'>Tracking / NAT Helpers</div>
265 <div class='section'>
266 <script type='text/javascript'>
267 createFieldTable('', [
268 { title: 'FTP', name: 'f_ftp', type: 'checkbox', value: nvram.nf_ftp != '0' },
269 { title: 'GRE / PPTP', name: 'f_pptp', type: 'checkbox', value: nvram.nf_pptp != '0' },
270 { title: 'H.323', name: 'f_h323', type: 'checkbox', value: nvram.nf_h323 != '0' },
271 /* LINUX26-BEGIN */
272 { title: 'SIP', name: 'f_sip', type: 'checkbox', value: nvram.nf_sip != '0' },
273 /* LINUX26-END */
274 { title: 'RTSP', name: 'f_rtsp', type: 'checkbox', value: nvram.nf_rtsp != '0' }
276 </script>
277 </div>
279 <div class='section-title'>Miscellaneous</div>
280 <div class='section'>
281 <script type='text/javascript'>
282 v = [];
283 for (i = -5; i <= 5; ++i) {
284 v.push([i + '', i ? ((i > 0) ? '+' : '') + i : 'None']);
286 v.push(['', 'Custom']);
288 createFieldTable('', [
289 { title: 'TTL Adjust', multi: [
290 { name: 'f_nf_ttl', type: 'select', options: v, value: nvram.nf_ttl.substr(0, 2) == 'c:' ? '' : nvram.nf_ttl },
291 { name: 'f_ttl_val', type: 'text', maxlen: 3, size: 6, value: nvram.nf_ttl.substr(0, 2) == 'c:' ? nvram.nf_ttl.substr(2, 5) : '' }
292 ] },
293 { title: 'Inbound Layer 7', name: 'f_l7in', type: 'checkbox', value: nvram.nf_l7in != '0' }
295 </script>
296 </div>
298 <!-- / / / -->
300 </td></tr>
301 <tr><td id='footer' colspan=2>
302 <span id='footer-msg'></span>
303 <input type='button' value='Save' id='save-button' onclick='save()'>
304 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'>
305 </td></tr>
306 </table>
307 </form>
308 <script type='text/javascript'>verifyFields(null, 1);</script>
309 </body>
310 </html>