Migrate UI cleanup phase 4 from MIPS into ARM
[tomato.git] / release / src-rt-6.x.4708 / router / www / advanced-dhcpdns.asp
blob971ae0fd12d4689fac8c5f6220f4748f0b7c2dc1
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 <meta name="viewport" content="width=device-width">
15 <title>[<% ident(); %>] Advanced: DHCP / DNS</title>
16 <link rel='stylesheet' type='text/css' href='tomato.css'>
17 <% css(); %>
18 <script type='text/javascript' src='tomato.js'></script>
20 <!-- / / / -->
22 <style type='text/css'>
23 textarea {
24 width: 98%;
25 height: 15em;
27 </style>
29 <script type='text/javascript' src='debug.js'></script>
31 <script type='text/javascript'>
33 // <% nvram("dnsmasq_q,ipv6_radvd,ipv6_dhcpd,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"); %>
35 if ((isNaN(nvram.dhcpd_lmax)) || ((nvram.dhcpd_lmax *= 1) < 1)) nvram.dhcpd_lmax = 255;
37 function verifyFields(focused, quiet)
39 var b = (E('_f_dhcpd_sltsel').value == 1);
40 elem.display('_dhcpd_sltman', b);
41 if ((b) && (!v_range('_f_dhcpd_slt', quiet, 1, 43200))) return 0;
42 if (!v_length('_dnsmasq_custom', quiet, 0, 2048)) return 0;
43 if (!v_range('_dhcpd_lmax', quiet, 1, 0xFFFF)) return 0;
44 if (!v_length('_dhcpc_custom', quiet, 0, 80)) return 0;
45 return 1;
48 function nval(a, b)
50 return (a == null || (a + '').trim() == '') ? b : a;
53 function save()
55 if (!verifyFields(null, false)) return;
57 var a;
58 var fom = E('_fom');
60 fom.dhcpd_dmdns.value = E('_f_dhcpd_dmdns').checked ? 1 : 0;
61 a = E('_f_dhcpd_sltsel').value;
62 fom.dhcpd_slt.value = (a != 1) ? a : E('_f_dhcpd_slt').value;
63 fom.dns_addget.value = E('_f_dns_addget').checked ? 1 : 0;
64 fom.dns_norebind.value = E('_f_dns_norebind').checked ? 1 : 0;
65 fom.dhcpd_gwmode.value = E('_f_dhcpd_gwmode').checked ? 1 : 0;
66 fom.dns_intcpt.value = E('_f_dns_intcpt').checked ? 1 : 0;
67 fom.dhcpc_minpkt.value = E('_f_dhcpc_minpkt').checked ? 1 : 0;
68 fom.dhcpd_static_only.value = E('_f_dhcpd_static_only').checked ? '1' : '0';
69 fom.ipv6_radvd.value = E('_f_ipv6_radvd').checked ? '1' : '0';
70 fom.ipv6_dhcpd.value = E('_f_ipv6_dhcpd').checked ? '1' : '0';
72 fom.dnsmasq_q.value = 0;
73 if (fom.f_dnsmasq_q4.checked) fom.dnsmasq_q.value |= 1;
74 if (fom.f_dnsmasq_q6.checked) fom.dnsmasq_q.value |= 2;
75 if (fom.f_dnsmasq_qr.checked) fom.dnsmasq_q.value |= 4;
77 if (fom.dhcpc_minpkt.value != nvram.dhcpc_minpkt ||
78 fom.dhcpc_custom.value != nvram.dhcpc_custom) {
79 nvram.dhcpc_minpkt = fom.dhcpc_minpkt.value;
80 nvram.dhcpc_custom = fom.dhcpc_custom.value;
81 fom._service.value = '*';
83 else {
84 fom._service.value = 'dnsmasq-restart';
88 if (fom.dns_intcpt.value != nvram.dns_intcpt) {
89 nvram.dns_intcpt = fom.dns_intcpt.value;
90 if (fom._service.value != '*') fom._service.value += ',firewall-restart';
93 /* IPV6-BEGIN */
94 if (fom.dhcpd_dmdns.value != nvram.dhcpd_dmdns) {
95 nvram.dhcpd_dmdns = fom.dhcpd_dmdns.value;
96 if (fom._service.value != '*') fom._service.value += ',dnsmasq-restart';
98 /* IPV6-END */
100 form.submit(fom, 1);
103 function toggleVisibility(whichone) {
104 if(E('sesdiv' + whichone).style.display=='') {
105 E('sesdiv' + whichone).style.display='none';
106 E('sesdiv' + whichone + 'showhide').innerHTML='(Click here to show)';
107 cookie.set('adv_dhcpdns_' + whichone + '_vis', 0);
108 } else {
109 E('sesdiv' + whichone).style.display='';
110 E('sesdiv' + whichone + 'showhide').innerHTML='(Click here to hide)';
111 cookie.set('adv_dhcpdns_' + whichone + '_vis', 1);
115 function init() {
116 var c;
117 if (((c = cookie.get('adv_dhcpdns_notes_vis')) != null) && (c == '1')) {
118 toggleVisibility("notes");
121 </script>
123 </head>
124 <body onload='init()'>
125 <form id='_fom' method='post' action='tomato.cgi'>
126 <table id='container' cellspacing=0>
127 <tr><td colspan=2 id='header'>
128 <div class='title'>Tomato</div>
129 <div class='version'>Version <% version(); %></div>
130 </td></tr>
131 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
132 <td id='content'>
133 <div id='ident'><% ident(); %></div>
135 <!-- / / / -->
137 <input type='hidden' name='_nextpage' value='advanced-dhcpdns.asp'>
138 <input type='hidden' name='_service' value=''>
140 <input type='hidden' name='dhcpd_dmdns'>
141 <input type='hidden' name='dhcpd_slt'>
142 <input type='hidden' name='dns_addget'>
143 <input type='hidden' name='dns_norebind'>
144 <input type='hidden' name='dhcpd_gwmode'>
145 <input type='hidden' name='dns_intcpt'>
146 <input type='hidden' name='dhcpc_minpkt'>
147 <input type='hidden' name='dhcpd_static_only'>
148 <input type='hidden' name='ipv6_radvd'>
149 <input type='hidden' name='ipv6_dhcpd'>
150 <input type='hidden' name='dnsmasq_q'>
152 <div class='section-title'>DHCP / DNS Server (LAN)</div>
153 <div class='section'>
154 <script type='text/javascript'>
155 createFieldTable('', [
156 { title: 'Use internal DNS', name: 'f_dhcpd_dmdns', type: 'checkbox', value: nvram.dhcpd_dmdns == '1' },
157 { title: 'Use received DNS with user-entered DNS', name: 'f_dns_addget', type: 'checkbox', value: nvram.dns_addget == '1' },
158 { title: 'Prevent DNS-rebind attacks', name: 'f_dns_norebind', type: 'checkbox', value: nvram.dns_norebind == '1' },
159 { title: 'Intercept DNS port<br>(UDP 53)', name: 'f_dns_intcpt', type: 'checkbox', value: nvram.dns_intcpt == '1' },
160 { title: 'Use user-entered gateway if WAN is disabled', name: 'f_dhcpd_gwmode', type: 'checkbox', value: nvram.dhcpd_gwmode == '1' },
161 { title: 'Ignore DHCP requests from unknown devices', name: 'f_dhcpd_static_only', type: 'checkbox', value: nvram.dhcpd_static_only == '1' },
162 { title: 'Maximum active DHCP leases', name: 'dhcpd_lmax', type: 'text', maxlen: 5, size: 8, value: nvram.dhcpd_lmax },
163 { title: 'Static lease time', multi: [
164 { name: 'f_dhcpd_sltsel', type: 'select', options: [[0,'Same as normal lease time'],[-1,'"Infinite"'],[1,'Custom']],
165 value: (nvram.dhcpd_slt < 1) ? nvram.dhcpd_slt : 1 },
166 { name: 'f_dhcpd_slt', type: 'text', maxlen: 5, size: 8, prefix: '<span id="_dhcpd_sltman"> ', suffix: ' <i>(minutes)</i></span>',
167 value: (nvram.dhcpd_slt >= 1) ? nvram.dhcpd_slt : 3600 } ] },
168 { title: 'Announce IPv6 on LAN (SLAAC)', name: 'f_ipv6_radvd', type: 'checkbox', value: nvram.ipv6_radvd == '1' },
169 { title: 'Announce IPv6 on LAN (DHCP)', name: 'f_ipv6_dhcpd', type: 'checkbox', value: nvram.ipv6_dhcpd == '1' },
170 { title: 'Mute dhcpv4 logging', name: 'f_dnsmasq_q4', type: 'checkbox', value: (nvram.dnsmasq_q & 1) },
171 { title: 'Mute dhcpv6 logging', name: 'f_dnsmasq_q6', type: 'checkbox', value: (nvram.dnsmasq_q & 2) },
172 { title: 'Mute RA logging', name: 'f_dnsmasq_qr', type: 'checkbox', value: (nvram.dnsmasq_q & 4) },
173 { title: '<a href="http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html" target="_new">Dnsmasq</a><br>Custom configuration', name: 'dnsmasq_custom', type: 'textarea', value: nvram.dnsmasq_custom }
175 </script>
177 <!-- / / / -->
179 <div class='section-title'>DHCP Client (WAN)</div>
180 <div class='section'>
181 <script type='text/javascript'>
182 createFieldTable('', [
183 { title: 'DHCPC Options', name: 'dhcpc_custom', type: 'text', maxlen: 80, size: 34, value: nvram.dhcpc_custom },
184 { title: 'Reduce packet size', name: 'f_dhcpc_minpkt', type: 'checkbox', value: nvram.dhcpc_minpkt == '1' }
186 </script>
187 </div>
189 <!-- / / / -->
191 <div class='section-title'>Notes <small><i><a href='javascript:toggleVisibility("notes");'><span id='sesdivnotesshowhide'>(Click here to show)</span></a></i></small></div>
192 <div class='section' id='sesdivnotes' style='display:none'>
194 <i>DHCP / DNS Server (LAN):</i><br>
195 <ul>
196 <li><b>Use internal DNS</b> - Allow dnsmasq to be your DNS server on LAN.</li>
197 <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>
198 <li><b>Prevent DNS-rebind attacks</b> - Enable DNS rebinding protection on Dnsmasq.</li>
199 <li><b>Intercept DNS port</b> - Any DNS requests/packets sent out to UDP port 53 are redirected to the internal DNS server.</li>
200 <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>
201 <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>
202 <li><b>Maximum active DHCP leases</b> - Self-explanatory.</li>
203 <li><b>Static lease time</b> - Absolute maximum amount of time allowed for any DHCP lease to be valid.</li>
204 <li><b>Custom configuration</b> - Extra options to be added to the Dnsmasq configuration file.</li>
205 </ul>
207 <i>DHCP Client (WAN):</i><br>
208 <ul>
209 <li><b>DHCPC Options</b> - Extra options for the DHCP client.</li>
210 <li><b>Reduce packet size</b> - Self-explanatory.</li>
211 </ul>
213 <i>Other relevant notes/hints:</i><br>
214 <ul>
215 <li>The contents of file /etc/dnsmasq.custom are also added to the end of Dnsmasq's configuration file (if it exists).</li>
216 </ul>
218 </div>
220 <!-- / / / -->
222 </td></tr>
223 <tr><td id='footer' colspan=2>
224 <span id='footer-msg'></span>
225 <input type='button' value='Save' id='save-button' onclick='save()'>
226 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'>
227 </td></tr>
228 </table>
229 </form>
230 <script type='text/javascript'>verifyFields(null, true);</script>
231 </body>
232 </html>