www.usr.com/support/gpl/USR9113_release1.0.tar.gz
[bcm963xx.git] / userapps / broadcom / cfm / html / scinflt.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--
3         (c) 2005 U.S. Robotics Corporation
4 -->
5 <html>
6 <head>
7         <title>Add Incoming IP Filter</title>
8
9         <link href="usr_layout.css" type="text/css" rel="stylesheet" /><script src="usr_layout.js" type="text/javascript"></script>
10         <link href="usr_menus_dropdown.css" rel="stylesheet" type="text/css"><script src="usr_menus_dropdown.js" type="text/javascript"></script><script src="usr_menus_build.js" type="text/javascript"></script>
11         <link href="usr_device.css" type="text/css" rel="stylesheet" /><script src="usr_device.js" type="text/javascript"></script><link href="usr_91xx.css" type="text/css" rel="stylesheet" /><script src="usr_91xx.js" type="text/javascript"></script><script src="usr_resources.js" type="text/javascript"></script>
12
13    <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
14
15    <script type="text/javascript" src="util.js"></script>
16    <script type="text/javascript">
17 <!-- hide
18
19
20 var ifCount = 0;
21
22 function btnApply() {
23    var loc = 'scinflt.cmd?action=add';
24    var okChk = 0;
25
26    with ( document.forms[0] ) {
27       if ( txtfltname.value == '' ) {
28          msg = 'Please enter incoming IP filtering name.';
29          alert(msg);
30          return;
31       }
32       
33       if ( isValidName(txtfltname.value) == false ) {
34          msg = "The filter name is invalid. Only alphanumeric characters are allowed.";
35          alert(msg);
36          return;
37       }      
38
39       if ( srcaddr.value == "" && srcmask.value == "" && srcport.value == "" &&
40            dstaddr.value == "" && dstmask.value == "" && dstport.value == "" &&
41            protocol.selectedIndex < 0 ) {
42          msg = 'At least one condition must be specified.'
43          alert(msg);
44          return;
45       }      
46
47       if ( srcaddr.value != "" && isValidIpAddress(srcaddr.value) == false ) {
48          msg = 'Source address "' + srcaddr.value + '" is invalid IP address.';
49          alert(msg);
50          return;
51       }
52
53       if ( srcmask.value != "" && isValidSubnetMask(srcmask.value) == false ) {
54          msg = 'Source subnet mask "' + srcmask.value + '" is invalid subnet mask.';
55          alert(msg);
56          return;
57       }
58
59       if ( srcaddr.value == "" && srcmask.value != "" ) {
60          msg = 'Cannot have source subnet mask without source IP address.';
61          alert(msg);
62          return;
63       }
64
65       if ( srcport.value != "" && isValidPort(srcport.value) == false ) {
66          msg = 'Source port "' + srcport.value + '" is invalid port number or port range.';
67          alert(msg);
68          return;
69       }
70
71       if ( dstaddr.value != "" && isValidIpAddress(dstaddr.value) == false ) {
72          msg = 'Destination address "' + dstaddr.value + '" is invalid IP address.';
73          alert(msg);
74          return;
75       }
76
77       if ( dstmask.value != "" && isValidSubnetMask(dstmask.value) == false ) {
78          msg = 'Destination subnet mask "' + dstmask.value + '" is invalid subnet mask.';
79          alert(msg);
80          return;
81       }
82
83       if ( dstaddr.value == "" && dstmask.value != "" ) {
84          msg = 'Cannot have destination subnet mask without destination IP address.';
85          alert(msg);
86          return;
87       }
88
89       if ( dstport.value != "" && isValidPort(dstport.value) == false ) {
90          msg = 'Destination port "' + dstport.value + '" is invalid port number or port range.';
91          alert(msg);
92          return;
93       }
94
95       if ( (srcport.value != "" || dstport.value != "") &&
96            (protocol.selectedIndex < 0 || protocol.selectedIndex == 3) ) {
97          msg = 'TCP or UDP Protocol must be selected together with port number';
98          alert(msg);
99          return;
100       }       
101
102       // wan interfaces
103       if (ifCount == 1) {
104          if (ifChk.checked)
105             okChk = 1;
106       }
107       else {
108          for (i = 0; i < ifCount; i++) 
109             if (ifChk[i].checked)
110                okChk++;
111       }
112       if (!okChk) {
113          alert('At least one configured Bridge interface must be selected.');
114          return;
115       }    
116       loc += '&wanIf=';
117       if (chkAll.checked)
118          loc += 'ALL';
119       else {
120          var first = true;
121          if (ifCount == 1)
122             loc += ifChk.value
123          else {
124            for (i = 0; i < ifCount; i++)
125             if (ifChk[i].checked) {
126                if (!first)
127                   loc += '|';
128                loc += ifChk[i].value;
129                first = false;
130             }
131          }   
132       }
133       
134       // incoming IP filter name
135       loc += '&fltName=' + encodeUrl(txtfltname.value);
136
137       // protocol
138       idx = protocol.selectedIndex;
139       val = protocol.options[idx].value;
140       loc += '&protocol=' + val;
141
142       // source address
143       if ( srcaddr.value != "" )
144          loc += '&srcAddr=' + srcaddr.value;
145
146       // source subnet mask
147       if ( srcmask.value != "" )
148          loc += '&srcMask=' + srcmask.value;
149
150       // source port
151       if ( srcport.value != "" )
152          loc += '&srcPort=' + srcport.value;
153
154       // destination address
155       if ( dstaddr.value != "" )
156          loc += '&dstAddr=' + dstaddr.value;
157
158       // destination subnet mask
159       if ( dstaddr.value != "" )
160          loc += '&dstMask=' + dstmask.value;
161
162       // destination port
163       if ( dstport.value != "" )
164          loc += '&dstPort=' + dstport.value;
165    }
166
167    var code = 'location = "' + loc + '"';
168    eval(code);
169 }
170
171 function toggle(cb) {
172    var chkCount = 0;
173    with ( document.forms[0] ) {
174       if (ifCount == 1)
175          chkAll.checked = cb.checked;
176       else {      
177          for (i = 0; i < ifCount; i++)
178             if (ifChk[i].checked)
179                chkCount++;
180          if (chkCount == ifCount)
181             chkAll.checked = true;
182          else
183             chkAll.checked = false;
184       }
185    }
186 }
187
188 function toggleIfs(cb) {
189    var chkStatus = false;
190    with ( document.forms[0] ) {
191       if (chkAll.checked)
192          chkStatus = true;
193       if (ifCount == 1)
194          ifChk.checked = chkStatus;
195       else
196          for (i = 0; i < ifCount; i++)
197             ifChk[i].checked = chkStatus;
198    }
199 }
200
201 // done hiding -->
202       </script>
203    </head>
204    <body onload="initMenu();">
205
206 <script type="text/javascript">
207         writeHeader("Add Incoming IP Filter");
208 </script>
209
210 <form>
211
212         <p>Create a filter to identify the incoming IP traffic by specifying at least one
213         condition below. If multiple conditions are specified, all of them take effect.
214         Press <b>Apply</b> to save and activate the filter.</p>
215
216             <table border="0" cellpadding="0" cellspacing="0">
217                <tr>
218                   <td><label for="txtfltname">Filter name:</label></td>
219                   <td><input type='text' maxlength="15" size="22" name="txtfltname" id="txtfltname"></td>
220                </tr>
221                <tr>
222                   <td><label for="">Protocol:</label></td>
223                   <td><select name='protocol' id='protocol'>
224                         <option value="0">TCP/UDP</option>
225                         <option value="1">TCP</option>
226                         <option value="2">UDP</option>
227                                                                 <option value="3">ICMP</option>
228                      </select></td>
229                </tr>
230                <tr>
231                   <td><label for="srcaddr">Source IP address:</label></td>
232                   <td><input type='text' size="22" name="srcaddr" id="srcaddr"></td>
233                </tr>
234                <tr>
235                   <td><label for="srcmask">Source subnet mask:</label></td>
236                   <td><input type='text' size="22" name="srcmask" id="srcmask"></td>
237                </tr>
238                <tr>
239                   <td><label for="srcport">Source port:</label></td>
240                   <td><input type='text' size="22" name="srcport" id="srcport"> (port or port:port)</td>
241                </tr>
242                <tr>
243                   <td><label for="dstaddr">Destination IP address:</label></td>
244                   <td><input type='text' size="22" name="dstaddr" id="dstaddr"></td>
245                </tr>
246                <tr>
247                   <td><label for="dstmask">Destination subnet mask:</label></td>
248                   <td><input type='text' size="22" name="dstmask" id="dstmask"></td>
249                </tr>
250                <tr>
251                   <td><label for="dstport">Destination port:</label></td>
252                   <td><input type='text' size="22" name="dstport" id="dstport"> (port or port:port)</td>
253                </tr>
254             </table>
255
256             <p><b>WAN Interfaces:</b> (Configured in Routing mode and Firewall enabled only)</p>
257                                 <p><input type='checkbox' name='chkAll' id='chkAll' checked onclick='toggleIfs(this)'> <label for="chkAll">Select all</label></p>
258
259             <table>
260                <tr>
261                   <script type="text/javascript">
262 <!-- hide
263 {
264    var i = 0;
265    var interfaceInfo = '<%ejGetOther(wanInterfaceInfo, firewall)%>';
266    var interfaces = interfaceInfo.split('|');
267
268    for ( i = 0; i < interfaces.length; i++ ) {
269       var names = interfaces[i].split('/');
270       document.writeln("<tr> <input type='checkbox' name='ifChk' checked value=" + 
271                         names[1] + '>' + '&nbsp;&nbsp;' + interfaces[i] + "</tr>");
272       ifCount++;
273    }
274 }
275 // done hiding -->
276 </script>
277       </tr>
278    </table>
279         <p><input type='button' onClick='btnApply()' value='Apply'></p>
280 </form>
281
282 <script type="text/javascript">
283         writeFooter();
284 </script>
285
286 </body>
287 </html>