New routers supported
[tomato.git] / release / src / router / www / forward-dmz.asp
blobab7b5bb364dac79b3074489faf4a95e5455d0345
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(); %>] Forwarding: DMZ</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 <script type='text/javascript' src='debug.js'></script>
23 <script type='text/javascript' src='interfaces.js'></script>
25 <script type='text/javascript'>
27 // <% nvram("dmz_enable,dmz_ipaddr,dmz_sip,dmz_ifname,dmz_ra,lan_ifname,lan1_ifname,lan2_ifname,lan3_ifname"); %>
29 var lipp = '<% lipp(); %>.';
31 function verifyFields(focused, quiet)
33 var sip, dip, off;
35 off = !E('_f_dmz_enable').checked;
37 dip = E('_f_dmz_ipaddr')
38 dip.disabled = off;
40 sip = E('_f_dmz_sip');
41 sip.disabled = off;
43 sip = E('_f_dmz_ra');
44 sip.disabled = off;
46 var dif = E('_dmz_ifname');
47 dif.disabled = off;
48 if (dif.options[(dif.selectedIndex)].disabled) dif.selectedIndex = 0;
50 if (off) {
51 ferror.clearAll(dip, sip);
52 return 1;
55 if (dip.value.indexOf('.') == -1) dip.value = lipp + dip.value;
56 if (!v_ip(dip)) return 0;
58 if ((sip.value.length) && (!v_iptaddr(sip, quiet, 15))) return 0;
59 ferror.clear(sip);
61 return 1;
64 function save()
66 var fom;
67 var en;
68 var s;
70 if (!verifyFields(null, false)) return;
72 fom = E('_fom');
73 en = fom.f_dmz_enable.checked;
74 fom.dmz_enable.value = en ? 1 : 0;
75 if (en) {
76 // shorten it if possible to be more compatible with original
77 s = fom.f_dmz_ipaddr.value;
78 fom.dmz_ipaddr.value = (s.indexOf(lipp) == 0) ? s.replace(lipp, '') : s;
80 fom.dmz_sip.value = fom.f_dmz_sip.value.split(/\s*,\s*/).join(',');
81 fom.dmz_ra.value = E('_f_dmz_ra').checked ? 1 : 0;
82 form.submit(fom, 0);
85 function init() {
86 var dif = E('_dmz_ifname');
87 if(nvram.lan_ifname.length < 1)
88 dif.options[0].disabled=true;
89 if(nvram.lan1_ifname.length < 1)
90 dif.options[1].disabled=true;
91 if(nvram.lan2_ifname.length < 1)
92 dif.options[2].disabled=true;
93 if(nvram.lan3_ifname.length < 1)
94 dif.options[3].disabled=true;
95 if(nvram.dmz_enable == '1')
96 verifyFields(null,true);
99 </script>
101 </head>
102 <body onload='init()'>
103 <form id='_fom' method='post' action='tomato.cgi'>
104 <table id='container' cellspacing=0>
105 <tr><td colspan=2 id='header'>
106 <div class='title'>Tomato</div>
107 <div class='version'>Version <% version(); %></div>
108 </td></tr>
109 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
110 <td id='content'>
111 <div id='ident'><% ident(); %></div>
113 <!-- / / / -->
115 <input type='hidden' name='_nextpage' value='forward-dmz.asp'>
116 <input type='hidden' name='_service' value='firewall-restart'>
118 <input type='hidden' name='dmz_enable'>
119 <input type='hidden' name='dmz_ipaddr'>
120 <input type='hidden' name='dmz_sip'>
121 <input type='hidden' name='dmz_ra'>
123 <div class='section-title'>DMZ</div>
124 <div class='section'>
125 <script type='text/javascript'>
126 createFieldTable('', [
127 { title: 'Enable DMZ', name: 'f_dmz_enable', type: 'checkbox', value: (nvram.dmz_enable == '1') },
128 { title: 'Destination Address', indent: 2, name: 'f_dmz_ipaddr', type: 'text', maxlen: 15, size: 17,
129 value: (nvram.dmz_ipaddr.indexOf('.') != -1) ? nvram.dmz_ipaddr : (lipp + nvram.dmz_ipaddr) },
130 { title: 'Destination Interface', indent: 2, name: 'dmz_ifname', type: 'select',
131 options: [['br0','LAN (br0)'],['br1','LAN1 (br1)'],['br2','LAN2 (br2)'],['br3','LAN3 (br3)']], value: nvram.dmz_ifname },
132 { title: 'Source Address<br>Restriction', indent: 2, name: 'f_dmz_sip', type: 'text', maxlen: 512, size: 64,
133 value: nvram.dmz_sip, suffix: '<br><small>(optional; ex: "1.1.1.1", "1.1.1.0/24", "1.1.1.1 - 2.2.2.2" or "me.example.com")</small>' },
134 null,
135 { title: 'Leave Remote Access', indent: 2, name: 'f_dmz_ra', type: 'checkbox', value: (nvram.dmz_ra == '1'), suffix: ' &nbsp;<small>(Redirect remote access ports for SSH and HTTP(s) to router)</small>' }
137 </script>
138 </div>
140 <br>
141 <script type='text/javascript'>if (nvram.dmz_enable == '1') show_notice1('<% notice("iptables"); %>');</script>
143 <!-- / / / -->
145 </td></tr>
146 <tr><td id='footer' colspan=2>
147 <span id='footer-msg'></span>
148 <input type='button' value='Save' id='save-button' onclick='save()'>
149 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'>
150 </td></tr>
151 </table>
152 </form>
153 <script type='text/javascript'>verifyFields(null, 1);</script>
154 </body>
155 </html>