www.usr.com/support/gpl/USR9113_release1.0.tar.gz
[bcm963xx.git] / userapps / broadcom / cfm / html / lancfg.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>Device Setup</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
21 var dhcpStart = '<%ejGetJS(dhcpEthStart)%>';
22 var dhcpEnd = '<%ejGetJS(dhcpEthEnd)%>';
23 var dhcpLease = '<%ejGetJS(dhcpLeasedTime)%>';
24 var nat = '<%ejGetJS(enblNat)%>';
25 var prtcl = '<%ejGetOther(memInfo, ntwkPrtcl)%>';
26 var ipExtension = '<%ejGetJS(pppIpExtension)%>';
27 var dhcpEnbl = '<%ejGetJS(enblDhcpSrv)%>';
28 var natEnbl = '<%ejGetOther(sysInfo, enblNat)%>';
29 var manualMod = 0;
30
31 function hideDhcpInfo(hide) {
32    var status = 'visible';
33
34    if ( hide == 1 )
35       status = 'hidden';
36    if (document.getElementById)  // DOM3 = IE5, NS6
37       document.getElementById('dhcpInfo').style.visibility = status;
38    else {
39       if (document.layers == false) // IE4
40          document.all.dhcpInfo.style.visibility = status;
41    }
42 }
43
44 function disableDhcpSrv() {
45    with ( document.forms[0] ) {
46       dhcpSrvType[1].checked = false;
47       dhcpEthStart.disabled = 1;
48       dhcpEthEnd.disabled = 1;
49       dhcpLeasedTime.value = '';
50       dhcpLeasedTime.disabled = 1;
51    }
52 }
53
54 function hideRelayInfo(hide) {
55    var status = 'visible';
56
57    if ( hide == 1 )
58       status = 'hidden';
59    if (document.getElementById)  // DOM3 = IE5, NS6
60       document.getElementById('relayInfo').style.visibility = status;
61    else {
62       if (document.layers == false) // IE4
63          document.all.relayInfo.style.visibility = status;
64    }
65 }
66
67 function enableDhcpSrv(formLoad) {
68    with ( document.forms[0] ) {
69       dhcpSrvType[1].checked = true;
70       dhcpEthStart.disabled = 0;
71       dhcpEthEnd.disabled = 0;
72       if (formLoad == 0)
73          setDhcpAddresses(ethIpAddress.value);
74       else {
75          dhcpEthStart.value = dhcpStart;
76          dhcpEthEnd.value = dhcpEnd;
77       }
78       dhcpLeasedTime.value = dhcpLease;
79       dhcpLeasedTime.disabled = 0;
80    }   
81 }
82
83 function disableDhcpSrvRelay() {
84    with ( document.forms[0] ) {
85       dhcpSrvType[2].checked = false;
86       dhcpSrvAddr.disabled = 1;
87    }
88 }
89
90 function enableDhcpSrvRelay() {
91    with ( document.forms[0] ) {
92       dhcpSrvType[2].checked = true;
93       if (dhcpEthStart.value != "")
94          dhcpSrvAddr.value = dhcpEthStart.value;
95       else
96          dhcpSrvAddr.value = dhcpStart;
97       dhcpSrvAddr.disabled = 0;
98    }
99 }
100
101 function typeClick() {
102    with ( document.forms[0] ) {
103       // if any protocol has NAT enabled then
104       // don't show DHCP relay
105       if ( nat == '1' || natEnbl == '1' ) {
106          if ( dhcpSrvType[0].checked == true )
107             disableDhcpSrv();
108          else
109             enableDhcpSrv(0);
110       } else {
111          if ( dhcpSrvType[0].checked == true ) {
112             disableDhcpSrv();
113             disableDhcpSrvRelay();
114          } else if ( dhcpSrvType[1].checked == true ) {
115             enableDhcpSrv(0);
116             disableDhcpSrvRelay();
117          } else {
118             enableDhcpSrvRelay();
119             disableDhcpSrv();
120          }
121       }
122    }
123 }
124
125 function frmLoad() {
126    with ( document.forms[0] ) {
127       ethIpAddress.value = '<%ejGetJS(ethIpAddress)%>';
128       ethSubnetMask.value = '<%ejGetJS(ethSubnetMask)%>';
129
130       if ( prtcl == 'Bridge' ) {
131          hideDhcpInfo(1);
132       } else if ( (ipExtension == '1') &&
133                   ((prtcl == 'PPPoE') || (prtcl == 'PPPoA')) ) {
134          hideDhcpInfo(1);
135       } else {
136          hideDhcpInfo(0);
137          // if any protocol has NAT enabled then
138          // don't show DHCP relay
139          if ( nat == '1' || natEnbl == '1' ) {
140             hideRelayInfo(1);
141             if ( dhcpEnbl == '1' )
142                enableDhcpSrv(1);
143             else {
144                dhcpSrvType[0].checked = true;
145                disableDhcpSrv();
146             }
147          } else {
148             hideRelayInfo(0);
149             if ( dhcpEnbl == '1' ) {
150                enableDhcpSrv(1);
151                disableDhcpSrvRelay();
152             } else if ( dhcpEnbl == '2' ) {
153                enableDhcpSrvRelay();
154                disableDhcpSrv();
155             } else {
156                dhcpSrvType[0].checked = true;
157                disableDhcpSrv();
158                disableDhcpSrvRelay();
159             }
160          }
161          lan2IpAddress.value = '<%ejGetJS(lan2IpAddress)%>';
162          lan2SubnetMask.value = '<%ejGetJS(lan2SubnetMask)%>';
163          if ('<%ejGetJS(enblLan2)%>' == '1') {
164             enblLan2.checked = true;
165             hideLan2Info(0);
166          } else {
167             enblLan2.checked = false;
168             hideLan2Info(1);
169          }
170       }
171    }
172 }
173
174 function hideLan2Info(hide) {
175    var status = 'visible';
176
177    if ( hide == 1 )
178       status = 'hidden';
179    if (document.getElementById)  // DOM3 = IE5, NS6
180       document.getElementById('lan2Info').style.visibility = status;
181    else {
182       if (document.layers == false) // IE4
183          document.all.lan2Info.style.visibility = status;
184    }
185 }
186
187 function lan2CbClick(cb) {
188    if ( cb.checked == true )
189       hideLan2Info(0);
190    else
191       hideLan2Info(1);
192 }
193
194 function btnNext() {
195    var ifc = '<%ejGetWlJS(wlInterface)%>';
196    var loc = '';
197
198    if ( ifc == '1' )
199       loc = 'wlsetup.cgi?';
200    else
201       loc = 'ntwksum2.cgi?';
202
203    with ( document.forms[0] ) {
204       if ( isValidIpAddress(ethIpAddress.value) == false ) {
205          alert('Address "' + ethIpAddress.value + '" is invalid IP address.');
206          return;
207       }
208       if ( isValidIpAddress(ethSubnetMask.value) == false ) {
209          alert('Subnet mask "' + ethSubnetMask.value + '" has invalid IP address.');
210          return;
211       }
212       loc += 'ethIpAddress=' + ethIpAddress.value;
213       loc += '&ethSubnetMask=' + ethSubnetMask.value;
214
215       if ( dhcpSrvType[1].checked == true ) {
216          if ( isValidIpAddress(dhcpEthStart.value) == false ) {
217             alert('Start IP address "' + dhcpEthStart.value + '" is invalid IP address.');
218             return;
219          }
220          if ( isValidIpAddress(dhcpEthEnd.value) == false ) {
221             alert('Stop IP address "' + dhcpEthEnd.value + '" is invalid IP address.');
222             return;
223          }
224          if ( isNaN(dhcpLeasedTime.value) == true ) {
225             alert('Leased time "' + dhcpLeasedTime.value + '" has invalid value.');
226             return;
227          }
228
229          loc += '&dhcpEthStart=' + dhcpEthStart.value;
230          loc += '&dhcpEthEnd=' + dhcpEthEnd.value;
231          loc += '&dhcpLeasedTime=' + dhcpLeasedTime.value;
232          loc += '&enblDhcpSrv=1';
233       } else {
234          if ( nat == '1' || natEnbl == '1' )
235             loc += '&enblDhcpSrv=0';
236          else {
237             if ( dhcpSrvType[2].checked == true ) {
238                if ( isValidIpAddress(dhcpSrvAddr.value) == false ) {
239                   alert('DHCP server IP address "' + dhcpSrvAddr.value + '" is invalid IP address.');
240                   return;
241                }
242                loc += '&dhcpEthStart=' + dhcpSrvAddr.value;
243                loc += '&enblDhcpSrv=2';
244             } else
245                loc += '&enblDhcpSrv=0';
246          }
247       }
248       if (enblLan2.checked == true) {
249          if ( isValidIpAddress(lan2IpAddress.value) == false ) {
250             alert('Address "' + lan2IpAddress.value + '" is invalid IP address.');
251             return;
252          }
253          if ( isValidIpAddress(lan2SubnetMask.value) == false ) {
254             alert('Subnet mask "' + lan2SubnetMask.value + '" has invalid IP address.');
255             return;
256          }
257          loc += '&enblLan2=1';
258          loc += '&lan2IpAddress=' + lan2IpAddress.value;
259          loc += '&lan2SubnetMask=' + lan2SubnetMask.value;
260       }
261       else
262          loc += '&enblLan2=0';
263    }
264
265    var code = 'location="' + loc + '"';
266    eval(code);
267 }
268
269 function btnBack() {
270    var loc;
271
272    if ( prtcl == 'PPPoE' || prtcl == 'PPPoA' )
273       loc = 'enblservice.html';
274    else if ( prtcl == 'MER' || prtcl == 'IPoA' )
275       loc = 'natcfg2.html';
276    else if ( prtcl == 'Bridge' )
277       loc = 'enblbridge.html';
278    else
279       loc = 'ntwkprtcl.html';
280
281    var code = 'location="' + loc + '"';
282    eval(code);
283 }
284
285 function setDhcpAddresses(lanIp) {
286    with ( document.forms[0] ) {
287       if (manualMod == 1) {
288          dhcpEthStart.value = dhcpStart;
289          dhcpEthEnd.value = dhcpEnd;
290          return false;
291       }
292       if ( isValidIpAddress(lanIp) == false ) {
293          alert('Address "' + lanIp + '" is invalid IP address.');
294          return;
295       }
296       addrParts = lanIp.split('.');
297       if ( addrParts.length != 4 ) 
298          return false;
299       t1 = parseInt(addrParts[3]) + 1;
300       if (dhcpEthStart.value != '' && t1 >= 255) {
301          alert("Last portion of IP Address has to be less than 254 for Enabled DHCP Server");
302          return false;
303       }
304       dhcpEthStart.value = dhcpEthEnd.value = "";  
305       for (i = 0; i < 3; i++) {
306          dhcpEthStart.value = dhcpEthStart.value + addrParts[i] + ".";
307          dhcpEthEnd.value = dhcpEthEnd.value + addrParts[i] + ".";
308       }       
309       dhcpEthStart.value = dhcpEthStart.value + t1;
310       dhcpEthEnd.value = dhcpEthEnd.value + 254;
311    }     
312 }
313
314 function manualModDhcp() {
315    with ( document.forms[0] ) {
316       manualMod = 1;
317       dhcpStart = dhcpEthStart.value;
318       dhcpEnd = dhcpEthEnd.value;
319    }
320 }   
321
322
323 // done hiding -->
324 </script>
325             <base target="_self">
326    </head>
327    <body onload="initMenu(); frmLoad();">
328
329 <script type="text/javascript">
330         writeHeader("Device Setup");
331 </script>
332
333 <form>
334         <p>Configure the router&rsquo;s IP address and subnet mask for LAN interface.</p>
335
336         <table border="0" cellpadding="1" cellspacing="0">
337                 <tr>
338                         <td><label for="ethIpAddress">IP address:</label></td>
339                         <td><input type='text' name='ethIpAddress' id='ethIpAddress' onChange="setDhcpAddresses(this.value)"></td>
340                 </tr>
341                 <tr>
342                         <td><label for="ethSubnetMask">Subnet mask:</label></td>
343                         <td><input type='text' name='ethSubnetMask' id='ethSubnetMask'></td>
344                 </tr>
345         </table>
346
347         <div id='dhcpInfo'>
348                 <p>
349                         <input type='radio' name='dhcpSrvType' id='dhcpSrvTypeDisable' onClick='typeClick()'> <label for="dhcpSrvTypeDisable">Disable DHCP server</label><br/>
350                         <input type='radio' name='dhcpSrvType' id='dhcpSrvTypeEnable' onClick='typeClick()'> <label for="dhcpSrvTypeEnable">Enable DHCP server</label>
351                 </p>
352                 <table border="0" cellpadding="0" cellspacing="0" style="margin-left: 2em;">
353                         <tr>
354                                 <td><label for="dhcpEthStart">Start IP address:</label></td>
355                                 <td><input type='text' name='dhcpEthStart' id='dhcpEthStart' onChange='manualModDhcp()'></td>
356                         </tr>
357                         <tr>
358                                 <td><label for="dhcpEthEnd">End IP address:</label></td>
359                                 <td><input type='text' name='dhcpEthEnd' id='dhcpEthEnd' onChange='manualModDhcp()'></td>
360                         </tr>
361                         <tr>
362                                 <td><label for="dhcpLeasedTime">Lease time:</label></td>
363                                 <td><input type='text' name='dhcpLeasedTime' id='dhcpLeasedTime'> hours</td>
364                         </tr>
365                 </table>
366
367                 <div id='relayInfo'>
368                         <p><input type='radio' name='dhcpSrvType' id='dhcpSrvTypeRelay' onClick='typeClick()'> <label for="dhcpSrvTypeRelay">Enable DHCP server relay</label></p>
369                         <p style="margin-left: 2em;"><label for="dhcpSrvAddr">DHCP server IP address:</label> <input type='text' name='dhcpSrvAddr' id='dhcpSrvAddr'></p>
370                 </div>
371
372                 <p><input type='checkbox' name='enblLan2' id='enblLan2' onClick='lan2CbClick(this)'> <label for="enblLan2">Configure the second IP address and subnet mask for LAN interface</label></p>
373                 <div id='lan2Info'>
374                         <table border="0" cellpadding="0" cellspacing="0" ID="Table1" style="margin-left: 2em;">
375                                 <tr>
376                                         <td><label for="lan2IpAddress">IP address:</label></td>
377                                         <td><input type='text' name='lan2IpAddress' id='lan2IpAddress' ID="Text1"></td>
378                                 </tr>
379                                 <tr>
380                                         <td><label for="lan2SubnetMask">Subnet mask:</label></td>
381                                         <td><input type='text' name='lan2SubnetMask' id='lan2SubnetMask' ID="Text2"></td>
382                                 </tr>
383                         </table>
384                 </div>
385         </div>
386 <p><input type='button' onClick='btnBack()' value='Back'> <input type='button' onClick='btnNext()' value='Next'></p>
387 </form>
388
389 <script type="text/javascript">
390         writeFooter();
391 </script>
392
393 </body>
394 </html>