Get rid of "Interrupted service call" messages in syslog
[tomato.git] / release / src / router / www / basic-network.asp
blob8a535cccd46ae4581413e164d76d28f90a5d66b6
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
4 Copyright (C) 2006-2008 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(); %>] Basic: Network</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 <style type='text/css'>
22 #spin {
23 visibility: hidden;
24 vertical-align: middle;
26 </style>
28 <script type='text/javascript' src='debug.js'></script>
30 <script type='text/javascript' src='md5.js'></script>
31 <script type='text/javascript'>
32 // <% nvram("dhcp_lease,dhcp_num,dhcp_start,dhcpd_startip,dhcpd_endip,l2tp_server_ip,lan_gateway,lan_ipaddr,lan_netmask,lan_proto,mtu_enable,ppp_demand,ppp_idletime,ppp_passwd,ppp_redialperiod,ppp_service,ppp_username,pptp_server_ip,security_mode2,wan_dns,wan_gateway,wan_ipaddr,wan_mtu,wan_netmask,wan_proto,wan_wins,wds_enable,wl_channel,wl_closed,wl_crypto,wl_key,wl_key1,wl_key2,wl_key3,wl_key4,wl_lazywds,wl_mode,wl_net_mode,wl_passphrase,wl_radio,wl_radius_ipaddr,wl_radius_port,wl_ssid,wl_wds,wl_wep_bit,wl_wpa_gtk_rekey,wl_wpa_psk,wl_radius_key,wds_save,wl_auth,wl0_hwaddr"); %>
34 xob = null;
35 ghz = [['1', '1 - 2.412 GHz'],['2', '2 - 2.417 GHz'],['3', '3 - 2.422 GHz'],['4', '4 - 2.427 GHz'],['5', '5 - 2.432 GHz'],['6', '6 - 2.437 GHz'],['7', '7 - 2.442 GHz'],['8', '8 - 2.447 GHz'],['9', '9 - 2.452 GHz'],['10', '10 - 2.457 GHz'],['11', '11 - 2.462 GHz'],['12', '12 - 2.467 GHz'],['13', '13 - 2.472 GHz'],['14', '14 - 2.484 GHz']]
37 if ((!fixIP(nvram.dhcpd_startip)) || (!fixIP(nvram.dhcpd_endip))) {
38 var x = nvram.lan_ipaddr.split('.').splice(0, 3).join('.') + '.';
39 nvram.dhcpd_startip = x + nvram.dhcp_start;
40 nvram.dhcpd_endip = x + ((nvram.dhcp_start * 1) + (nvram.dhcp_num * 1) - 1);
43 function spin(x)
45 var e = E('_f_scan');
46 e.disabled = x;
47 if (x) e.value = 'Scan ' + (wscan.tries + 1);
48 else e.value = 'Scan';
49 E('spin').style.visibility = x ? 'visible' : 'hidden';
52 function scan()
54 if (xob) return;
56 xob = new XmlHttp();
57 xob.onCompleted = function(text, xml) {
58 try {
59 var i;
61 wlscandata = [];
62 eval(text);
64 for (i = 0; i < wlscandata.length; ++i) {
65 var data = wlscandata[i];
66 var ch = data[2];
67 var mac = data[0];
69 if (!wscan.inuse[ch]) {
70 wscan.inuse[ch] = {
71 count: 0,
72 rssi: -999,
73 ssid: ''
77 if (!wscan.seen[mac]) {
78 wscan.seen[mac] = 1;
79 ++wscan.inuse[ch].count;
82 if (data[4] > wscan.inuse[ch].rssi) {
83 wscan.inuse[ch].rssi = data[4];
84 wscan.inuse[ch].ssid = data[1];
87 var e = E('_wl_channel');
88 for (i = 0; i < 14; ++i) {
89 var s = ghz[i][1];
90 var u = wscan.inuse[i + 1];
91 if (u) s += ' (' + u.count + ' AP' + (u.count == 1 ? '' : 's') + ' / strongest: "' + ellipsis(u.ssid, 15) + '" ' + u.rssi + ' dBm)';
92 e.options[i].innerHTML = s;
94 e.style.width = '400px';
96 xob = null;
98 if (wscan.tries < 4) {
99 ++wscan.tries;
100 setTimeout(scan, 1000);
101 return;
104 catch (x) {
106 spin(0);
108 xob.onError = function(x) {
109 alert('error: ' + x);
110 spin(0);
111 xob = null;
114 spin(1);
115 xob.post('update.cgi', 'exec=wlscan');
118 function scanButton()
120 if (xob) return;
122 wscan = {
123 seen: [],
124 inuse: [],
125 tries: 0
128 scan();
131 function joinAddr(a) {
132 var r, i, s;
134 r = [];
135 for (i = 0; i < a.length; ++i) {
136 s = a[i];
137 if ((s != '00:00:00:00:00:00') && (s != '0.0.0.0')) r.push(s);
139 return r.join(' ');
142 function random_x(max)
144 var c = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
145 var s = '';
146 while (max-- > 0) s += c.substr(Math.floor(c.length * Math.random()), 1);
147 return s;
150 function random_psk(id)
152 var e = E(id);
153 e.value = random_x(63);
154 verifyFields(null, 1);
157 function random_wep()
159 E('_wl_passphrase').value = random_x(16);
160 generate_wep();
163 function v_wep(e, quiet)
165 var s = e.value.toUpperCase().replace(/[^0-9A-F]/g, '');
166 if (s.length != e.maxLength) {
167 ferror.set(e, 'Invalid WEP key, ', quiet);
168 return 0;
170 e.value = s;
171 ferror.clear(e);
172 return 1;
175 // compatible w/ Linksys' and Netgear's (key 1) method for 128-bits
176 function generate_wep()
178 function _wepgen(pass, i)
180 while (pass.length < 64) pass += pass;
181 return hex_md5(pass.substr(0, 64)).substr(i, (E('_wl_wep_bit').value == 128) ? 26 : 10);
184 var e = E('_wl_passphrase');
185 var pass = e.value;
186 if (!v_length(e, false, 3)) return;
187 E('_wl_key1').value = _wepgen(pass, 0);
188 pass += '#$%';
189 E('_wl_key2').value = _wepgen(pass, 2);
190 pass += '!@#';
191 E('_wl_key3').value = _wepgen(pass, 4);
192 pass += '%&^';
193 E('_wl_key4').value = _wepgen(pass, 6);
194 verifyFields(null, 1);
197 function verifyFields(focused, quiet)
199 var i;
200 var ok = 1;
201 var a, b, c, d, e;
204 // --- visibility ---
206 var vis = {
207 _wan_na: 1,
209 _wan_proto: 1,
210 _ppp_username: 1,
211 _ppp_passwd: 1,
212 _ppp_service: 1,
213 _l2tp_server_ip: 1,
214 _wan_ipaddr: 1,
215 _wan_netmask: 1,
216 _wan_gateway: 1,
217 _pptp_server_ip: 1,
218 _ppp_demand: 1,
219 _ppp_idletime: 1,
220 _ppp_redialperiod: 1,
221 _mtu_enable: 1,
222 _f_wan_mtu: 1,
224 _dhcp_lease: 1,
225 _f_dhcpd_enable: 1,
226 _dhcpd_startip: 1,
227 _dhcpd_endip: 1,
228 _f_dns_1: 1,
229 _f_dns_2: 1,
230 _f_dns_3: 1,
231 _lan_gateway: 1,
232 _lan_ipaddr: 1,
233 _lan_netmask: 1,
234 _wan_wins: 1,
236 _f_wl_radio: 1,
237 _f_wmode: 1,
238 _wl_net_mode: 1,
239 _wl_ssid: 1,
240 _f_bcast: 1,
241 _wl_channel: 1,
242 _f_scan: 1,
244 _security_mode2: 1,
245 _wl_crypto: 1,
246 _wl_wpa_psk: 1,
247 _f_psk_random1: 1,
248 _f_psk_random2: 1,
249 _wl_wpa_gtk_rekey: 1,
250 _wl_radius_key: 1,
251 _wl_radius_ipaddr: 1,
252 _wl_radius_port: 1,
253 _wl_wep_bit: 1,
254 _wl_passphrase: 1,
255 _f_wep_gen: 1,
256 _f_wep_random: 1,
257 _wl_key1: 1,
258 _wl_key2: 1,
259 _wl_key3: 1,
260 _wl_key4: 1,
262 _f_wl_lazywds: 1,
263 _f_wds_0: 1
266 var wan = E('_wan_proto').value;
267 var wmode = E('_f_wmode').value;
269 if (wmode == 'wet') {
270 wan = 'disabled';
271 vis._wan_proto = 0;
272 vis._f_dhcpd_enable = 0;
273 vis._dhcp_lease = 0;
275 else vis._wan_na = 0;
277 switch (wan) {
278 case 'disabled':
279 vis._ppp_username = 0;
280 vis._ppp_service = 0;
281 vis._l2tp_server_ip = 0;
282 vis._wan_ipaddr = 0;
283 vis._wan_netmask = 0;
284 vis._wan_gateway = 0;
285 vis._pptp_server_ip = 0;
286 vis._ppp_demand = 0;
287 vis._mtu_enable = 0;
288 vis._f_wan_mtu = 0;
289 break;
290 case 'dhcp':
291 vis._l2tp_server_ip = 0;
292 vis._ppp_demand = 0;
293 vis._ppp_service = 0;
294 vis._ppp_username = 0;
295 vis._pptp_server_ip = 0;
296 vis._wan_gateway = 0;
297 vis._wan_ipaddr = 0;
298 vis._wan_netmask = 0;
300 vis._lan_gateway = 0;
301 break;
302 case 'pppoe':
303 vis._l2tp_server_ip = 0;
304 vis._pptp_server_ip = 0;
305 vis._wan_gateway = 0;
306 vis._wan_ipaddr = 0;
307 vis._wan_netmask = 0;
309 vis._lan_gateway = 0;
310 break;
311 case 'static':
312 vis._l2tp_server_ip = 0;
313 vis._ppp_demand = 0;
314 vis._ppp_service = 0;
315 vis._ppp_username = 0;
316 vis._pptp_server_ip = 0;
318 vis._lan_gateway = 0;
319 break;
320 case 'pptp':
321 vis._l2tp_server_ip = 0;
322 vis._ppp_service = 0;
323 vis._wan_gateway = 0;
325 vis._lan_gateway = 0;
326 break;
327 case 'l2tp':
328 vis._ppp_service = 0;
329 vis._pptp_server_ip = 0;
330 vis._wan_gateway = 0;
331 vis._wan_ipaddr = 0;
332 vis._wan_netmask = 0;
334 vis._lan_gateway = 0;
335 break;
338 vis._ppp_idletime = (E('_ppp_demand').value == 1) && vis._ppp_demand
339 vis._ppp_redialperiod = !vis._ppp_idletime && vis._ppp_demand;
341 if (vis._mtu_enable) {
342 if (E('_mtu_enable').value == 0) {
343 vis._f_wan_mtu = 2;
344 a = E('_f_wan_mtu');
345 switch (E('_wan_proto').value) {
346 case 'pppoe':
347 a.value = 1492;
348 break;
349 case 'pptp':
350 case 'l2tp':
351 a.value = 1460;
352 break;
353 default:
354 a.value = 1500;
355 break;
360 if (!E('_f_dhcpd_enable').checked) vis._dhcp_lease = 0;
362 if (!E('_f_wl_radio').checked) {
363 vis._f_wl_lazywds = 2;
364 vis._f_wds_0 = 2;
365 vis._f_wmode = 2;
366 vis._security_mode2 = 2;
367 vis._wl_channel = 2;
368 vis._f_bcast = 2;
369 vis._wl_crypto = 2;
370 vis._wl_net_mode = 2;
371 vis._wl_wpa_psk = 2;
372 vis._wl_radius_key = 2;
373 vis._wl_wpa_gtk_rekey = 2;
374 vis._wl_radius_ipaddr = 2;
375 vis._wl_ssid = 2;
376 vis._wl_wep_bit = 2;
379 switch (wmode) {
380 case 'apwds':
381 case 'wds':
382 break;
383 case 'wet':
384 case 'sta':
385 vis._f_bcast = 0;
386 default:
387 vis._f_wl_lazywds = 0;
388 vis._f_wds_0 = 0;
389 break;
392 var sm2 = E('_security_mode2').value;
393 switch (sm2) {
394 case 'disabled':
395 vis._wl_crypto = 0;
396 vis._wl_wep_bit = 0;
397 vis._wl_wpa_psk = 0;
398 vis._wl_radius_key = 0;
399 vis._wl_radius_ipaddr = 0;
400 vis._wl_wpa_gtk_rekey = 0;
401 break;
402 case 'wep':
403 vis._wl_crypto = 0;
404 vis._wl_wpa_psk = 0;
405 vis._wl_radius_key = 0;
406 vis._wl_radius_ipaddr = 0;
407 vis._wl_wpa_gtk_rekey = 0;
408 break;
409 case 'radius':
410 vis._wl_crypto = 0;
411 vis._wl_wpa_psk = 0;
412 break;
413 default: // wpa*
414 vis._wl_wep_bit = 0;
415 if (sm2.indexOf('personal') != -1) {
416 vis._wl_radius_key = 0;
417 vis._wl_radius_ipaddr = 0;
419 else {
420 vis._wl_wpa_psk = 0;
422 break;
425 if ((E('_f_wl_lazywds').value == 1) && (vis._f_wds_0 == 1)) {
426 vis._f_wds_0 = 2;
431 vis._ppp_passwd = vis._ppp_username;
432 vis._dhcpd_startip = vis._dhcpd_endip = vis._wan_wins = vis._dhcp_lease;
433 vis._f_scan = vis._wl_channel;
434 vis._f_psk_random1 = vis._wl_wpa_psk;
435 vis._f_psk_random2 = vis._wl_radius_key;
436 vis._wl_radius_port = vis._wl_radius_ipaddr;
437 vis._wl_key1 = vis._wl_key2 = vis._wl_key3 = vis._wl_key4 = vis._f_wep_gen = vis._f_wep_random = vis._wl_passphrase = vis._wl_wep_bit;
439 for (i = 1; i < 10; ++i) {
440 vis['_f_wds_' + i] = vis._f_wds_0;
442 for (a in vis) {
443 b = E(a);
444 c = vis[a];
445 b.disabled = (c != 1);
446 PR(b).style.display = c ? '' : 'none';
450 // --- verify ---
452 if (wmode == 'sta') {
453 if (wan == 'disabled') {
454 ferror.set('_wan_proto', 'Wireless Client mode requires a valid WAN setting (usually DHCP).', quiet);
455 return 0;
458 ferror.clear('_wan_proto');
460 if ((vis._f_wmode == 1) && (wmode != 'ap') && (sm2.substr(0, 4) == 'wpa2')) {
461 ferror.set('_security_mode2', 'WPA2 is supported only in AP mode.', quiet);
462 return 0;
464 ferror.clear('_security_mode2');
466 a = E('_wl_wpa_psk');
467 ferror.clear(a);
468 if (vis._wl_wpa_psk == 1) {
469 if ((a.value.length < 8) || ((a.value.length == 64) && (a.value.search(/[^0-9A-Fa-f]/) != -1))) {
470 ferror.set('_wl_wpa_psk', 'Invalid pre-shared key. Please enter at least 8 characters or 64 hexadecimal digits.', quiet);
471 ok = 0;
475 // IP address
476 a = ['_l2tp_server_ip','_pptp_server_ip', '_wan_gateway','_wan_ipaddr','_lan_ipaddr', '_wl_radius_ipaddr', '_dhcpd_startip', '_dhcpd_endip'];
477 for (i = a.length - 1; i >= 0; --i)
478 if ((vis[a[i]]) && (!v_ip(a[i], quiet))) ok = 0;
480 // IP address, blank -> 0.0.0.0
481 a = ['_f_dns_1', '_f_dns_2', '_f_dns_3','_wan_wins','_lan_gateway'];
482 for (i = a.length - 1; i >= 0; --i)
483 if ((vis[a[i]]) && (!v_ipz(a[i], quiet))) ok = 0;
485 // netmask
486 a = ['_wan_netmask','_lan_netmask'];
487 for (i = a.length - 1; i >= 0; --i)
488 if ((vis[a[i]]) && (!v_netmask(a[i], quiet))) ok = 0;
490 // range
491 a = [['_ppp_idletime', 3, 1440],['_ppp_redialperiod', 1, 86400],['_f_wan_mtu', 576, 1500],
492 ['_dhcp_lease', 1, 10080],['_wl_wpa_gtk_rekey', 60, 7200], ['_wl_radius_port', 1, 65535]];
493 for (i = a.length - 1; i >= 0; --i) {
494 v = a[i];
495 if ((vis[v[0]]) && (!v_range(v[0], quiet, v[1], v[2]))) ok = 0;
498 // length
499 a = [['_wl_ssid', 1], ['_wl_radius_key', 1]];
500 for (i = a.length - 1; i >= 0; --i) {
501 v = a[i];
502 if ((vis[v[0]]) && (!v_length(v[0], quiet, v[1], E(v[0]).maxlength))) ok = 0;
505 if (vis._wl_key1) {
506 a = (E('_wl_wep_bit').value == 128) ? 26 : 10;
507 for (i = 1; i <= 4; ++i) {
508 b = E('_wl_key' + i);
509 b.maxLength = a;
510 if ((b.value.length > 0) || (E('_f_wepidx_' + i).checked)) {
511 if (!v_wep(b, quiet)) ok = 0;
513 else ferror.clear(b);
517 ferror.clear('_f_wds_0');
518 if (vis._f_wds_0 == 1) {
519 b = 0;
520 for (i = 0; i < 10; ++i) {
521 a = E('_f_wds_' + i);
522 if (!v_macz(a, quiet)) ok = 0;
523 else if (!isMAC0(a.value)) b = 1;
525 if (!b) {
526 ferror.set('_f_wds_0', 'WDS MAC address required.', quiet);
527 ok = 0;
531 a = E('_dhcpd_startip');
532 b = E('_dhcpd_endip');
534 if ((!a._error_msg) && (!b._error_msg)) {
535 c = aton(E('_lan_netmask').value);
536 d = aton(E('_lan_ipaddr').value) & c;
537 e = 'Invalid IP address or subnet mask';
538 if ((aton(a.value) & c) != d) {
539 ferror.set(a, e, quiet);
540 ok = 0;
542 if ((aton(b.value) & c) != d) {
543 ferror.set(b, e, quiet);
544 ok = 0;
548 if ((!a._error_msg) && (!b._error_msg)) {
549 if (aton(a.value) > aton(b.value)) {
550 c = a.value;
551 a.value = b.value;
552 b.value = c;
555 elem.setInnerHTML('dhcp_count', '(' + ((aton(b.value) - aton(a.value)) + 1) + ')');
558 return ok;
561 function earlyInit()
563 verifyFields(null, 1);
566 function save()
568 var a, b, c;
569 var i;
571 if (!verifyFields(null, false)) return;
573 var fom = E('_fom');
574 var wmode = fom.f_wmode.value;
575 var sm2 = fom.security_mode2.value;
576 var wradio = fom.f_wl_radio.checked;
578 fom.lan_proto.value = fom.f_dhcpd_enable.checked ? 'dhcp' : 'static';
580 fom.wan_mtu.value = fom.f_wan_mtu.value;
581 fom.wan_mtu.disabled = fom.f_wan_mtu.disabled;
583 if (wmode == 'apwds') fom.wl_mode.value = 'ap';
584 else fom.wl_mode.value = wmode;
586 if (wmode == 'wet') {
587 fom.wan_proto.value = 'disabled';
588 fom.wan_proto.disabled = 0;
589 fom.lan_proto.value = 'static';
592 a = [];
593 for (i = 0; i < 10; ++i) a.push(E('_f_wds_' + i).value);
594 fom.wl_wds.value = joinAddr(a);
596 fom.wds_save.value = nvram.wds_save;
597 if (wmode.indexOf('wds') != -1) {
598 fom.wds_enable.value = 1;
599 fom.wl_lazywds.value = fom.f_wl_lazywds.value;
600 if (fom.wl_lazywds.value == 1) fom.wl_wds.value = '';
601 else fom.wds_save.value = fom.wl_wds.value;
603 else {
604 fom.wds_enable.value = 0;
605 fom.wl_wds.value = '';
606 fom.wl_lazywds.value = 0;
609 fom.wan_dns.value = joinAddr([fom.f_dns_1.value, fom.f_dns_2.value, fom.f_dns_3.value])
611 fom.wl_radio.value = fom.f_wl_radio.checked ? 1 : 0;
612 fom.wl_radio.disabled = fom.f_wl_radio.disabled;
614 fom.wl_auth.value = nvram.wl_auth;
616 switch (sm2) {
617 case 'disabled':
618 case 'radius':
619 case 'wep':
620 fom.security_mode.value = sm2;
621 fom.wl_akm.value = '';
622 break;
623 default:
624 c = [];
625 if (sm2.indexOf('personal') != -1) {
626 if (sm2.indexOf('wpa2_') == -1) c.push('psk');
627 if (sm2.indexOf('wpa_') == -1) c.push('psk2');
629 else {
630 if (sm2.indexOf('wpa2_') == -1) c.push('wpa');
631 if (sm2.indexOf('wpa_') == -1) c.push('wpa2');
633 c = c.join(' ');
634 fom.security_mode.value = c;
635 fom.wl_akm.value = c;
636 break;
638 fom.wl_auth_mode.value = (sm2 == 'radius') ? 'radius' : 'none';
639 fom.wl_wep.value = ((sm2 == 'radius') || (sm2 == 'wep')) ? 'enabled': 'disabled';
640 fom.wl_auth_mode.disabled = fom.wl_wep.disabled = fom.security_mode.disabled = fom.wl_akm.disabled = fom.security_mode2.disabled;
642 if (sm2.indexOf('wpa') != -1) fom.wl_auth.value = 0;
644 fom.wl_gmode.value = (fom.wl_net_mode.value == 'b-only') ? 0 : (fom.wl_net_mode.value == 'g-only') ? 2 : 1;
645 fom.wl_gmode.disabled = fom.wl_net_mode.disabled;
647 fom.wl_closed.value = fom.f_bcast.checked ? 0 : 1;
648 fom.wl_closed.disabled = fom.f_bcast.disabled;
650 fom.wl_key.value = fields.radio.selected(fom.f_wepidx).value;
651 fom.wl_key.disabled = fom.wl_key1.disabled;
653 fom.wl_mode.disabled = fom.wl_wds.disabled = fom.wds_enable.disabled = !fom.f_wl_radio.checked;
655 if (nvram.lan_ipaddr != fom.lan_ipaddr.value) {
656 fom._moveip.value = 1;
657 form.submit(fom);
659 else {
660 form.submit(fom, 1);
663 </script>
665 </head>
666 <body>
667 <form id='_fom' method='post' action='tomato.cgi'>
668 <table id='container' cellspacing=0>
669 <tr><td colspan=2 id='header'>
670 <div class='title'>Tomato</div>
671 <div class='version'>Version <% version(); %></div>
672 </td></tr>
673 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
674 <td id='content'>
675 <div id='ident'><% ident(); %></div>
677 <!-- / / / -->
679 <input type='hidden' name='_nextpage' value='basic-network.asp'>
680 <input type='hidden' name='_nextwait' value='10'>
681 <input type='hidden' name='_service' value='*'>
682 <input type='hidden' name='_moveip' value='0'>
684 <input type='hidden' name='wan_mtu'>
685 <input type='hidden' name='wl_mode'>
686 <input type='hidden' name='wds_enable'>
687 <input type='hidden' name='wl_wds'>
688 <input type='hidden' name='wds_save'>
689 <input type='hidden' name='lan_proto'>
690 <input type='hidden' name='wan_dns'>
691 <input type='hidden' name='wl_radio'>
692 <input type='hidden' name='wl_closed'>
693 <input type='hidden' name='wl_key'>
694 <input type='hidden' name='wl_gmode'>
695 <input type='hidden' name='security_mode'>
696 <input type='hidden' name='wl_akm'>
697 <input type='hidden' name='wl_auth'>
698 <input type='hidden' name='wl_auth_mode'>
699 <input type='hidden' name='wl_wep'>
700 <input type='hidden' name='wl_lazywds'>
703 <div class='section-title'>WAN / Internet</div>
704 <div class='section'>
705 <script type='text/javascript'>
706 createFieldTable('', [
707 { text: '<span id="_wan_na"><i>Wireless Ethernet Bridge Mode</i></span>' },
708 { title: 'Type', name: 'wan_proto', type: 'select', options: [['dhcp','DHCP'],['pppoe','PPPoE'],['static','Static'],['pptp','PPTP'],['l2tp','L2TP'],['disabled','Disabled']],
709 value: nvram.wan_proto },
710 { title: 'Username', name: 'ppp_username', type: 'text', maxlen: 50, size: 54, value: nvram.ppp_username },
711 { title: 'Password', name: 'ppp_passwd', type: 'password', maxlen: 50, size: 54, value: nvram.ppp_passwd },
712 { title: 'Service Name', name: 'ppp_service', type: 'text', maxlen: 50, size: 54, value: nvram.ppp_service },
713 { title: 'L2TP Server', name: 'l2tp_server_ip', type: 'text', maxlen: 15, size: 17, value: nvram.l2tp_server_ip },
714 { title: 'IP Address', name: 'wan_ipaddr', type: 'text', maxlen: 15, size: 17, value: nvram.wan_ipaddr },
715 { title: 'Subnet Mask', name: 'wan_netmask', type: 'text', maxlen: 15, size: 17, value: nvram.wan_netmask },
716 { title: 'Gateway', name: 'wan_gateway', type: 'text', maxlen: 15, size: 17, value: nvram.wan_gateway },
717 { title: 'Gateway', name: 'pptp_server_ip', type: 'text', maxlen: 15, size: 17, value: nvram.pptp_server_ip },
718 { title: 'Connect Mode', name: 'ppp_demand', type: 'select', options: [['1', 'Connect On Demand'],['0', 'Keep Alive']],
719 value: nvram.ppp_demand },
720 { title: 'Max Idle Time', indent: 2, name: 'ppp_idletime', type: 'text', maxlen: 5, size: 7, suffix: ' <i>(minutes)</i>',
721 value: nvram.ppp_idletime },
722 { title: 'Check Interval', indent: 2, name: 'ppp_redialperiod', type: 'text', maxlen: 5, size: 7, suffix: ' <i>(seconds)</i>',
723 value: nvram.ppp_redialperiod },
724 { title: 'MTU', multi: [
725 { name: 'mtu_enable', type: 'select', options: [['0', 'Default'],['1','Manual']], value: nvram.mtu_enable },
726 { name: 'f_wan_mtu', type: 'text', maxlen: 4, size: 6, value: nvram.wan_mtu } ] }
728 </script>
729 </div>
731 <div class='section-title'>LAN</div>
732 <div class='section'>
733 <script type='text/javascript'>
734 dns = nvram.wan_dns.split(/\s+/);
735 ipp = nvram.lan_ipaddr.split('.').splice(0, 3).join('.');
737 createFieldTable('', [
738 { title: 'Router IP Address', name: 'lan_ipaddr', type: 'text', maxlen: 15, size: 17, value: nvram.lan_ipaddr },
739 { title: 'Subnet Mask', name: 'lan_netmask', type: 'text', maxlen: 15, size: 17, value: nvram.lan_netmask },
740 { title: 'Default Gateway', name: 'lan_gateway', type: 'text', maxlen: 15, size: 17, value: nvram.lan_gateway },
741 { title: 'Static DNS', name: 'f_dns_1', type: 'text', maxlen: 15, size: 17, value: dns[0] || '0.0.0.0' },
742 { title: '', name: 'f_dns_2', type: 'text', maxlen: 15, size: 17, value: dns[1] || '0.0.0.0' },
743 { title: '', name: 'f_dns_3', type: 'text', maxlen: 15, size: 17, value: dns[2] || '0.0.0.0' },
744 { title: 'DHCP Server', name: 'f_dhcpd_enable', type: 'checkbox', value: (nvram.lan_proto == 'dhcp') },
745 { title: 'IP Address Range', indent: 2, multi: [
746 { name: 'dhcpd_startip', type: 'text', maxlen: 15, size: 17, value: nvram.dhcpd_startip, suffix: ' - ' },
747 { name: 'dhcpd_endip', type: 'text', maxlen: 15, size: 17, value: nvram.dhcpd_endip, suffix: ' <i id="dhcp_count"></i>' }
748 ] },
750 { title: 'Lease Time', indent: 2, name: 'dhcp_lease', type: 'text', maxlen: 6, size: 8, suffix: ' <i>(minutes)</i>',
751 value: (nvram.dhcp_lease > 0) ? nvram.dhcp_lease : 1440 },
752 { title: 'WINS', indent: 2, name: 'wan_wins', type: 'text', maxlen: 15, size: 17, value: nvram.wan_wins }
754 </script>
755 </div>
758 <div class='section-title'>Wireless</div>
759 <div class='section'>
760 <script type='text/javascript'>
761 f = [
762 { title: 'Enable Wireless', name: 'f_wl_radio', type: 'checkbox',
763 value: (nvram.wl_radio == '1') && (nvram.wl_net_mode != 'disabled') },
764 { title: 'MAC Address', text: '<a href="advanced-mac.asp">' + nvram.wl0_hwaddr + '</a>' },
765 { title: 'Wireless Mode', name: 'f_wmode', type: 'select',
766 options: [['ap', 'Access Point'],['apwds', 'Access Point + WDS'],['sta', 'Wireless Client'],['wet', 'Wireless Ethernet Bridge'],['wds', 'WDS']],
767 value: ((nvram.wl_mode == 'ap') && (nvram.wds_enable == '1')) ? 'apwds' : nvram.wl_mode },
768 { title: 'B/G Mode', name: 'wl_net_mode', type: 'select', value: (nvram.wl_net_mode == 'disabled') ? 'mixed' : nvram.wl_net_mode, options:[['mixed','Mixed'],['b-only','B Only'],['g-only','G Only']] },
769 { title: 'SSID', name: 'wl_ssid', type: 'text', maxlen: 32, size: 34, value: nvram.wl_ssid },
770 { title: 'Broadcast', indent: 2, name: 'f_bcast', type: 'checkbox', value: (nvram.wl_closed == '0') },
771 { title: 'Channel', name: 'wl_channel', type: 'select', options: ghz, suffix: ' <input type="button" id="_f_scan" value="Scan" onclick="scanButton()"> <img src="spin.gif" id="spin">',
772 value: nvram.wl_channel },
773 null,
774 { title: 'Security', name: 'security_mode2', type: 'select',
775 options: [['disabled','Disabled'],['wep','WEP'],['wpa_personal','WPA Personal'],['wpa_enterprise','WPA Enterprise'],['wpa2_personal','WPA2 Personal'],['wpa2_enterprise','WPA2 Enterprise'],['wpaX_personal','WPA / WPA2 Personal'],['wpaX_enterprise','WPA / WPA2 Enterprise'],['radius','Radius']],
776 value: nvram.security_mode2 },
777 { title: 'Encryption', indent: 2, name: 'wl_crypto', type: 'select',
778 options: [['tkip','TKIP'],['aes','AES'],['tkip+aes','TKIP / AES']], value: nvram.wl_crypto },
779 { title: 'Shared Key', indent: 2, name: 'wl_wpa_psk', type: 'text', maxlen: 64, size: 66,
780 suffix: ' <input type="button" id="_f_psk_random1" value="Random" onclick="random_psk(\'_wl_wpa_psk\')">',
781 value: nvram.wl_wpa_psk },
782 { title: 'Shared Key', indent: 2, name: 'wl_radius_key', type: 'text', maxlen: 80, size: 32,
783 suffix: ' <input type="button" id="_f_psk_random2" value="Random" onclick="random_psk(\'_wl_radius_key\')">',
784 value: nvram.wl_radius_key },
785 { title: 'Group Key Renewal', indent: 2, name: 'wl_wpa_gtk_rekey', type: 'text', maxlen: 4, size: 6, suffix: ' <i>(seconds)</i>',
786 value: nvram.wl_wpa_gtk_rekey },
787 { title: 'Radius Server', indent: 2, multi: [
788 { name: 'wl_radius_ipaddr', type: 'text', maxlen: 15, size: 17, value: nvram.wl_radius_ipaddr },
789 { name: 'wl_radius_port', type: 'text', maxlen: 5, size: 7, prefix: ' : ', value: nvram.wl_radius_port } ] },
790 { title: 'Encryption', indent: 2, name: 'wl_wep_bit', type: 'select', options: [['128','128-bits'],['64','64-bits']],
791 value: nvram.wl_wep_bit },
792 { title: 'Passphrase', indent: 2, name: 'wl_passphrase', type: 'text', maxlen: 16, size: 20,
793 suffix: ' <input type="button" id="_f_wep_gen" value="Generate" onclick="generate_wep()"> <input type="button" id="_f_wep_random" value="Random" onclick="random_wep()">',
794 value: nvram.wl_passphrase }
797 for (i = 1; i <= 4; ++i) {
798 f.push(
799 { title: ('Key ' + i), indent: 2, name: ('wl_key' + i), type: 'text', maxlen: 26, size: 34,
800 suffix: '<input type="radio" onchange="verifyFields(this,1)" onclick="verifyFields(this,1)" name="f_wepidx" id="_f_wepidx_' + i + '" value="' + i + '"' + ((nvram.wl_key == i) ? ' checked>' : '>'),
801 value: nvram['wl_key' + i] });
804 f.push(null,
805 { title: 'WDS', name: 'f_wl_lazywds', type: 'select',
806 options: [['0','Link With...'],['1','Automatic']], value: nvram.wl_lazywds } );
807 wds = ((nvram.wl_wds == '') ? nvram.wds_save : nvram.wl_wds).split(/\s+/);
808 for (i = 0; i < 10; i += 2) {
809 f.push({ title: (i ? '' : 'MAC Address'), indent: 2, multi: [
810 { name: 'f_wds_' + i, type: 'text', maxlen: 17, size: 20, value: wds[i] || '00:00:00:00:00:00' },
811 { name: 'f_wds_' + (i + 1), type: 'text', maxlen: 17, size: 20, value: wds[i + 1] || '00:00:00:00:00:00' } ] } );
814 createFieldTable('', f);
815 </script>
816 </div>
818 <!-- / / / -->
820 </td></tr>
821 <tr><td id='footer' colspan=2>
822 <span id='footer-msg'></span>
823 <input type='button' value='Save' id='save-button' onclick='save()'>
824 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'>
825 </td></tr>
826 </table>
827 </form>
828 <script type='text/javascript'>earlyInit()</script>
829 <div style='height:100px'></div>
830 </body>
831 </html>