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: 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>
21 <script type='text/javascript' src='debug.js'
></script>
23 <script type='text/javascript'
>
25 // <% nvram("ct_tcp_timeout,ct_udp_timeout,ct_max,nf_l7in,nf_ttl,nf_rtsp,nf_pptp,nf_h323,nf_ftp"); %>
28 var timer
= new TomatoTimer(check
);
34 if ((checker
) || (!running
)) return;
36 checker
= new XmlHttp();
37 checker
.onCompleted = function(text
, xml
) {
38 var conntrack
, total
, i
;
47 for (i
= 1; i
< 13; ++i
) {
48 E('count' + i
).innerHTML
= ' <small>('+ ((conntrack
[i
] || 0) * 1) + ' in this state)</small>';
50 E('count0').innerHTML
= '(' + ((conntrack
[0] || 0) * 1) + ' connections currently tracked)';
54 checker
.onError = function(x
) {
59 checker
.post('update.cgi', 'exec=ctcount&arg0=0');
65 E('spin').style
.visibility
= running
? 'visible' : 'hidden';
72 function expireTimer()
76 if (!expireText
) expireText
= e
.value
;
78 if (--expireTime
== 0) {
83 setTimeout(expireTimer
, 1000);
84 e
.value
= 'Expire Scheduled... ' + expireTime
;
88 function expireClicked()
91 E('expire').disabled
= true;
92 (new XmlHttp()).post('expct.cgi', '');
97 function verifyFields(focused
, quiet
)
101 for (i
= 0; i
< 10; ++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 return v_range('_ct_max', quiet
, 128, 10240);
112 var i
, tcp
, udp
, fom
;
114 if (!verifyFields(null, false)) return;
117 for (i
= 0; i
< 10; ++i
) {
118 tcp
.push(E('_f_tcp_' + i
).value
);
122 for (i
= 0; i
< 2; ++i
) {
123 udp
.push(E('_f_udp_' + i
).value
);
127 fom
.ct_tcp_timeout
.value
= tcp
.join(' ');
128 fom
.ct_udp_timeout
.value
= udp
.join(' ');
129 fom
.nf_l7in
.value
= E('_f_l7in').checked
? 1 : 0;
130 fom
.nf_rtsp
.value
= E('_f_rtsp').checked
? 1 : 0;
131 fom
.nf_pptp
.value
= E('_f_pptp').checked
? 1 : 0;
132 fom
.nf_h323
.value
= E('_f_h323').checked
? 1 : 0;
133 fom
.nf_ftp
.value
= E('_f_ftp').checked
? 1 : 0;
140 <form id='_fom' method='post' action='tomato.cgi'
>
141 <table id='container' cellspacing=
0>
142 <tr><td colspan=
2 id='header'
>
143 <div class='title'
>Tomato
</div>
144 <div class='version'
>Version <%
version(); %></div>
146 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
148 <div id='ident'
><%
ident(); %></div>
152 <input type='hidden' name='_nextpage' value='advanced-ctnf.asp'
>
153 <input type='hidden' name='_service' value='ctnf-restart'
>
155 <input type='hidden' name='ct_tcp_timeout' value=''
>
156 <input type='hidden' name='ct_udp_timeout' value=''
>
157 <input type='hidden' name='nf_l7in' value=''
>
158 <input type='hidden' name='nf_rtsp'
>
159 <input type='hidden' name='nf_pptp'
>
160 <input type='hidden' name='nf_h323'
>
161 <input type='hidden' name='nf_ftp'
>
163 <div class='section-title'
>Connections
</div>
164 <div class='section'
>
165 <script type='text/javascript'
>
166 createFieldTable('', [
167 { title
: 'Maximum Connections', name
: 'ct_max', type
: 'text', maxlen
: 5, size
: 7,
168 suffix
: ' <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()">',
169 value
: fixInt(nvram
.ct_max
|| 4096, 128, 10240, 4096) }
173 <input type='button' value='Drop Idle' onclick='expireClicked()' id='expire'
>
178 <div class='section-title'
>TCP Timeout
</div>
179 <div class='section'
>
180 <script type='text/javascript'
>
181 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) {
182 v
= [0,1800,14400,120,60,120,120,10,60,30,120];
184 titles
= ['-', 'None', 'Established', 'SYN Sent', 'SYN Received', 'FIN Wait', 'Time Wait', 'Close', 'Close Wait', 'Last ACK', 'Listen'];
185 f
= [{ title
: ' ', text
: '<small>(seconds)</small>' }];
186 for (i
= 1; i
< 11; ++i
) {
187 f
.push({ title
: titles
[i
], name
: ('f_tcp_' + (i
- 1)),
188 type
: 'text', maxlen
: 6, size
: 8, value
: v
[i
],
189 suffix
: '<span id="count' + i
+ '"></span>' });
191 createFieldTable('', f
);
195 <div class='section-title'
>UDP Timeout
</div>
196 <div class='section'
>
197 <script type='text/javascript'
>
198 if ((v
= nvram
.ct_udp_timeout
.match(/^(\d+)\s+(\d+)$/)) == null) {
201 createFieldTable('', [
202 { title
: ' ', text
: '<small>(seconds)</small>' },
203 { title
: 'Unreplied', name
: 'f_udp_0', type
: 'text', maxlen
: 6, size
: 8, value
: v
[1], suffix
: '<span id="count11"></span>' },
204 { title
: 'Assured', name
: 'f_udp_1', type
: 'text', maxlen
: 6, size
: 8, value
: v
[2], suffix
: '<span id="count12"></span>' }
209 <div class='section-title'
>Tracking / NAT Helpers
</div>
210 <div class='section'
>
211 <script type='text/javascript'
>
212 createFieldTable('', [
213 { title
: 'FTP', name
: 'f_ftp', type
: 'checkbox', value
: nvram
.nf_ftp
!= '0' },
214 { title
: 'GRE / PPTP', name
: 'f_pptp', type
: 'checkbox', value
: nvram
.nf_pptp
!= '0' },
215 { title
: 'H.323', name
: 'f_h323', type
: 'checkbox', value
: nvram
.nf_h323
!= '0' },
216 { title
: 'RTSP', name
: 'f_rtsp', type
: 'checkbox', value
: nvram
.nf_rtsp
!= '0' }
221 <div class='section-title'
>Miscellaneous
</div>
222 <div class='section'
>
223 <script type='text/javascript'
>
225 for (i
= -5; i
<= 5; ++i
) {
226 v
.push([i
, i
? ((i
> 0) ? '+' : '') + i
: 'None']);
228 createFieldTable('', [
229 { title
: 'TTL Adjust', name
: 'nf_ttl', type
: 'select', options
: v
, value
: nvram
.nf_ttl
},
230 { title
: 'Inbound Layer 7', name
: 'f_l7in', type
: 'checkbox', value
: nvram
.nf_l7in
!= '0' }
238 <tr><td id='footer' colspan=
2>
239 <span id='footer-msg'
></span>
240 <input type='button' value='Save' id='save-button' onclick='save()'
>
241 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'
>
245 <script type='text/javascript'
>verifyFields(null, 1);</script>