Tomato 1.28
[tomato.git] / release / src / router / www / advanced-dhcpdns.asp
blobbb09995f86862e438abb9b05b80a0d0ae0289f80
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 <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 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"); %>
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 return 1;
46 function save()
48 if (!verifyFields(null, false)) return;
50 var a;
51 var fom = E('_fom');
53 fom.dhcpd_dmdns.value = E('_f_dhcpd_dmdns').checked ? 1 : 0;
54 a = E('_f_dhcpd_sltsel').value;
55 fom.dhcpd_slt.value = (a != 1) ? a : E('_f_dhcpd_slt').value;
56 fom.dns_addget.value = E('_f_dns_addget').checked ? 1 : 0;
57 fom.dhcpd_gwmode.value = E('_f_dhcpd_gwmode').checked ? 1 : 0;
58 fom.dns_intcpt.value = E('_f_dns_intcpt').checked ? 1 : 0;
59 fom.dhcpc_minpkt.value = E('_f_dhcpc_minpkt').checked ? 1 : 0;
61 if (fom.dhcpc_minpkt.value != nvram.dhcpc_minpkt) {
62 nvram.dhcpc_minpkt = fom.dhcpc_minpkt.value;
63 fom._service.value = '*';
65 else {
66 fom._service.value = 'dnsmasq-restart';
69 if (fom.dns_intcpt.value != nvram.dns_intcpt) {
70 nvram.dns_intcpt = fom.dns_intcpt.value;
71 if (fom._service.value != '*') fom._service.value += ',firewall-restart';
74 form.submit(fom, 1);
76 </script>
78 </head>
79 <body>
80 <form id='_fom' method='post' action='tomato.cgi'>
81 <table id='container' cellspacing=0>
82 <tr><td colspan=2 id='header'>
83 <div class='title'>Tomato</div>
84 <div class='version'>Version <% version(); %></div>
85 </td></tr>
86 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
87 <td id='content'>
88 <div id='ident'><% ident(); %></div>
90 <!-- / / / -->
92 <input type='hidden' name='_nextpage' value='advanced-dhcpdns.asp'>
93 <input type='hidden' name='_service' value=''>
95 <input type='hidden' name='dhcpd_dmdns'>
96 <input type='hidden' name='dhcpd_slt'>
97 <input type='hidden' name='dns_addget'>
98 <input type='hidden' name='dhcpd_gwmode'>
99 <input type='hidden' name='dns_intcpt'>
100 <input type='hidden' name='dhcpc_minpkt'>
102 <div class='section-title'>DHCP / DNS Server (LAN)</div>
103 <div class='section'>
104 <script type='text/javascript'>
105 createFieldTable('', [
106 { title: 'Use internal DNS', name: 'f_dhcpd_dmdns', type: 'checkbox', value: nvram.dhcpd_dmdns == '1' },
107 { title: 'Use received DNS with user-entered DNS', name: 'f_dns_addget', type: 'checkbox', value: nvram.dns_addget == '1' },
108 { title: 'Intercept DNS port<br>(UDP 53)', name: 'f_dns_intcpt', type: 'checkbox', value: nvram.dns_intcpt == '1' },
109 { title: 'Use user-entered gateway if WAN is disabled', name: 'f_dhcpd_gwmode', type: 'checkbox', value: nvram.dhcpd_gwmode == '1' },
110 { title: 'Maximum active DHCP leases', name: 'dhcpd_lmax', type: 'text', maxlen: 5, size: 8, value: nvram.dhcpd_lmax },
111 { title: 'Static lease time', multi: [
112 { name: 'f_dhcpd_sltsel', type: 'select', options: [[0,'Same as normal lease time'],[-1,'"Infinite"'],[1,'Custom']],
113 value: (nvram.dhcpd_slt < 1) ? nvram.dhcpd_slt : 1 },
114 { name: 'f_dhcpd_slt', type: 'text', maxlen: 5, size: 8, prefix: '<span id="_dhcpd_sltman"> ', suffix: ' <i>(minutes)</i></span>',
115 value: (nvram.dhcpd_slt >= 1) ? nvram.dhcpd_slt : 3600 } ] },
116 { title: '<a href="http://www.thekelleys.org.uk/" target="_new">Dnsmasq</a><br>Custom configuration', name: 'dnsmasq_custom', type: 'textarea', value: nvram.dnsmasq_custom }
118 </script>
119 <br>
120 Note: The file /etc/dnsmasq.custom is also added to the end of Dnsmasq's configuration file if it exists.
121 </div>
122 <br>
124 <div class='section-title'>DHCP Client (WAN)</div>
125 <div class='section'>
126 <script type='text/javascript'>
127 createFieldTable('', [
128 { title: 'Reduce packet size', name: 'f_dhcpc_minpkt', type: 'checkbox', value: nvram.dhcpc_minpkt == '1' }
130 </script>
131 </div>
134 <!-- / / / -->
136 </td></tr>
137 <tr><td id='footer' colspan=2>
138 <span id='footer-msg'></span>
139 <input type='button' value='Save' id='save-button' onclick='save()'>
140 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'>
141 </td></tr>
142 </table>
143 </form>
144 <script type='text/javascript'>verifyFields(null, true);</script>
145 </body>
146 </html>