RSA Keylength to 1024
[tomato.git] / release / src / router / www / advanced-dhcpdns.asp
blob92aa529ffa5b9e16187340cdacaa8cb1c402a8c5
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: DHCP / DNS</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'>
16 <% css(); %>
17 <script type='text/javascript' src='tomato.js'></script>
19 <!-- / / / -->
21 <style type='text/css'>
22 textarea {
23 width: 98%;
24 height: 15em;
26 </style>
28 <script type='text/javascript' src='debug.js'></script>
30 <script type='text/javascript'>
32 // <% nvram("dhcpd_dmdns,dns_addget,dhcpd_gwmode,dns_intcpt,dhcpd_slt,dhcpc_minpkt,dnsmasq_custom,dnsmasq_norw,dhcpd_lmax,dhcpc_custom,dns_norebind,dhcpd_static_only"); %>
34 if ((isNaN(nvram.dhcpd_lmax)) || ((nvram.dhcpd_lmax *= 1) < 1)) nvram.dhcpd_lmax = 255;
36 function verifyFields(focused, quiet)
38 var b = (E('_f_dhcpd_sltsel').value == 1);
39 elem.display('_dhcpd_sltman', b);
40 if ((b) && (!v_range('_f_dhcpd_slt', quiet, 1, 43200))) return 0;
41 if (!v_length('_dnsmasq_custom', quiet, 0, 2048)) return 0;
42 if (!v_range('_dhcpd_lmax', quiet, 1, 0xFFFF)) return 0;
43 if (!v_length('_dhcpc_custom', quiet, 0, 80)) return 0;
44 return 1;
47 function nval(a, b)
49 return (a == null || (a + '').trim() == '') ? b : a;
52 function save()
54 if (!verifyFields(null, false)) return;
56 var a;
57 var fom = E('_fom');
59 fom.dhcpd_dmdns.value = E('_f_dhcpd_dmdns').checked ? 1 : 0;
60 a = E('_f_dhcpd_sltsel').value;
61 fom.dhcpd_slt.value = (a != 1) ? a : E('_f_dhcpd_slt').value;
62 fom.dns_addget.value = E('_f_dns_addget').checked ? 1 : 0;
63 fom.dns_norebind.value = E('_f_dns_norebind').checked ? 1 : 0;
64 fom.dhcpd_gwmode.value = E('_f_dhcpd_gwmode').checked ? 1 : 0;
65 fom.dns_intcpt.value = E('_f_dns_intcpt').checked ? 1 : 0;
66 fom.dhcpc_minpkt.value = E('_f_dhcpc_minpkt').checked ? 1 : 0;
67 fom.dhcpd_static_only.value = E('_f_dhcpd_static_only').checked ? '1' : '0';
69 if (fom.dhcpc_minpkt.value != nvram.dhcpc_minpkt ||
70 fom.dhcpc_custom.value != nvram.dhcpc_custom) {
71 nvram.dhcpc_minpkt = fom.dhcpc_minpkt.value;
72 nvram.dhcpc_custom = fom.dhcpc_custom.value;
73 fom._service.value = '*';
75 else {
76 fom._service.value = 'dnsmasq-restart';
79 if (fom.dns_intcpt.value != nvram.dns_intcpt) {
80 nvram.dns_intcpt = fom.dns_intcpt.value;
81 if (fom._service.value != '*') fom._service.value += ',firewall-restart';
84 /* IPV6-BEGIN */
85 if (fom.dhcpd_dmdns.value != nvram.dhcpd_dmdns) {
86 nvram.dhcpd_dmdns = fom.dhcpd_dmdns.value;
87 if (fom._service.value != '*') fom._service.value += ',radvd-restart';
89 /* IPV6-END */
91 form.submit(fom, 1);
94 function toggleVisibility(whichone) {
95 if(E('sesdiv' + whichone).style.display=='') {
96 E('sesdiv' + whichone).style.display='none';
97 E('sesdiv' + whichone + 'showhide').innerHTML='(Click here to show)';
98 cookie.set('adv_dhcpdns_' + whichone + '_vis', 0);
99 } else {
100 E('sesdiv' + whichone).style.display='';
101 E('sesdiv' + whichone + 'showhide').innerHTML='(Click here to hide)';
102 cookie.set('adv_dhcpdns_' + whichone + '_vis', 1);
106 function init() {
107 var c;
108 if (((c = cookie.get('adv_dhcpdns_notes_vis')) != null) && (c == '1')) {
109 toggleVisibility("notes");
112 </script>
114 </head>
115 <body onload='init()'>
116 <form id='_fom' method='post' action='tomato.cgi'>
117 <table id='container' cellspacing=0>
118 <tr><td colspan=2 id='header'>
119 <div class='title'>Tomato</div>
120 <div class='version'>Version <% version(); %></div>
121 </td></tr>
122 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
123 <td id='content'>
124 <div id='ident'><% ident(); %></div>
126 <!-- / / / -->
128 <input type='hidden' name='_nextpage' value='advanced-dhcpdns.asp'>
129 <input type='hidden' name='_service' value=''>
131 <input type='hidden' name='dhcpd_dmdns'>
132 <input type='hidden' name='dhcpd_slt'>
133 <input type='hidden' name='dns_addget'>
134 <input type='hidden' name='dns_norebind'>
135 <input type='hidden' name='dhcpd_gwmode'>
136 <input type='hidden' name='dns_intcpt'>
137 <input type='hidden' name='dhcpc_minpkt'>
138 <input type='hidden' name='dhcpd_static_only'>
140 <div class='section-title'>DHCP / DNS Server (LAN)</div>
141 <div class='section'>
142 <script type='text/javascript'>
143 createFieldTable('', [
144 { title: 'Use internal DNS', name: 'f_dhcpd_dmdns', type: 'checkbox', value: nvram.dhcpd_dmdns == '1' },
145 { title: 'Use received DNS with user-entered DNS', name: 'f_dns_addget', type: 'checkbox', value: nvram.dns_addget == '1' },
146 { title: 'Prevent DNS-rebind attacks', name: 'f_dns_norebind', type: 'checkbox', value: nvram.dns_norebind == '1' },
147 { title: 'Intercept DNS port<br>(UDP 53)', name: 'f_dns_intcpt', type: 'checkbox', value: nvram.dns_intcpt == '1' },
148 { title: 'Use user-entered gateway if WAN is disabled', name: 'f_dhcpd_gwmode', type: 'checkbox', value: nvram.dhcpd_gwmode == '1' },
149 { title: 'Ignore DHCP requests from unknown devices', name: 'f_dhcpd_static_only', type: 'checkbox', value: nvram.dhcpd_static_only == '1' },
150 { title: 'Maximum active DHCP leases', name: 'dhcpd_lmax', type: 'text', maxlen: 5, size: 8, value: nvram.dhcpd_lmax },
151 { title: 'Static lease time', multi: [
152 { name: 'f_dhcpd_sltsel', type: 'select', options: [[0,'Same as normal lease time'],[-1,'"Infinite"'],[1,'Custom']],
153 value: (nvram.dhcpd_slt < 1) ? nvram.dhcpd_slt : 1 },
154 { name: 'f_dhcpd_slt', type: 'text', maxlen: 5, size: 8, prefix: '<span id="_dhcpd_sltman"> ', suffix: ' <i>(minutes)</i></span>',
155 value: (nvram.dhcpd_slt >= 1) ? nvram.dhcpd_slt : 3600 } ] },
156 { title: '<a href="http://www.thekelleys.org.uk/" target="_new">Dnsmasq</a><br>Custom configuration', name: 'dnsmasq_custom', type: 'textarea', value: nvram.dnsmasq_custom }
158 </script>
160 <!-- / / / -->
162 <div class='section-title'>DHCP Client (WAN)</div>
163 <div class='section'>
164 <script type='text/javascript'>
165 createFieldTable('', [
166 { title: 'DHCPC Options', name: 'dhcpc_custom', type: 'text', maxlen: 80, size: 34, value: nvram.dhcpc_custom },
167 { title: 'Reduce packet size', name: 'f_dhcpc_minpkt', type: 'checkbox', value: nvram.dhcpc_minpkt == '1' }
169 </script>
170 </div>
172 <!-- / / / -->
174 <div class='section-title'>Notes <small><i><a href='javascript:toggleVisibility("notes");'><span id='sesdivnotesshowhide'>(Click here to show)</span></a></i></small></div>
175 <div class='section' id='sesdivnotes' style='display:none'>
177 <i>DHCP / DNS Server (LAN):</i><br>
178 <ul>
179 <li><b>Use internal DNS</b> - Allow dnsmasq to be your DNS server on LAN.</li>
180 <li><b>Use received DNS with user-entered DNS</b> - Add DNS servers received from your WAN connection to the static DNS server list (see <a href='basic-network.asp'>Network</a> configuration).</li>
181 <li><b>Prevent DNS-rebind attacks</b> - Enable DNS rebinding protection on Dnsmasq.</li>
182 <li><b>Intercept DNS port</b> - Any DNS requests/packets sent out to UDP port 53 are redirected to the internal DNS server.</li>
183 <li><b>Use user-entered gateway if WAN is disabled</b> - DHCP will use the IP address of the router as the default gateway on each LAN.</li>
184 <li><b>Ignore DHCP requests (...)</b> - Dnsmasq will ignore DHCP requests to Only MAC addresses listed on the <a href='basic-static.asp'>Static DHCP/ARP</a> page won't be able to obtain an IP address through DHCP.</li>
185 <li><b>Maximum active DHCP leases</b> - Self-explanatory.</li>
186 <li><b>Static lease time</b> - Absolute maximum amount of time allowed for any DHCP lease to be valid.</li>
187 <li><b>Custom configuration</b> - Extra options to be added to the Dnsmasq configuration file.</li>
188 </ul>
190 <i>DHCP Client (WAN):</i><br>
191 <ul>
192 <li><b>DHCPC Options</b> - Extra options for the DHCP client.</li>
193 <li><b>Reduce packet size</b> - Self-explanatory.</li>
194 </ul>
196 <i>Other relevant notes/hints:</i><br>
197 <ul>
198 <li>The contents of file /etc/dnsmasq.custom are also added to the end of Dnsmasq's configuration file (if it exists).</li>
199 </ul>
201 </div>
203 <!-- / / / -->
205 </td></tr>
206 <tr><td id='footer' colspan=2>
207 <span id='footer-msg'></span>
208 <input type='button' value='Save' id='save-button' onclick='save()'>
209 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'>
210 </td></tr>
211 </table>
212 </form>
213 <script type='text/javascript'>verifyFields(null, true);</script>
214 </body>
215 </html>