1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
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.
12 <meta http-equiv='content-type' content='text/html;charset=utf-
8'
>
13 <meta name='robots' content='noindex,nofollow'
>
14 <title>[<%
ident(); %>] Forwarding: Basic IPv6
</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>
20 <style type='text/css'
>
43 <script type='text/javascript' src='debug.js'
></script>
45 <script type='text/javascript'
>
47 // <% nvram("ipv6_portforward"); %>
49 var fog
= new TomatoGrid();
51 fog
.sortCompare = function(a
, b
) {
52 var col
= this.sortColumn
;
53 var da
= a
.getRowData();
54 var db
= b
.getRowData();
61 r
= cmpInt(da
[col
], db
[col
]);
64 r
= cmpText(da
[col
], db
[col
]);
68 return this.sortAscending
? r
: -r
;
71 fog
.dataToView = function(data
) {
72 return [(data
[0] != '0') ? 'On' : '', ['TCP', 'UDP', 'Both'][data
[1] - 1], (data
[2].match(/(.+)-(.+)/)) ? (RegExp
.$1 + ' -<br>' + RegExp
.$2) : data
[2], data
[3], data
[4], data
[5]];
75 fog
.fieldValuesToData = function(row
) {
76 var f
= fields
.getAll(row
);
77 return [f
[0].checked
? 1 : 0, f
[1].value
, f
[2].value
, f
[3].value
, f
[4].value
, f
[5].value
];
80 fog
.verifyFields = function(row
, quiet
) {
81 var f
= fields
.getAll(row
);
83 f
[2].value
= f
[2].value
.trim();
84 if ((f
[2].value
.length
) && (!_v_iptaddr(f
[2], quiet
, 0, 0, 1))) return 0;
86 f
[3].value
= f
[3].value
.trim();
87 if ((f
[3].value
.length
) && !v_hostname(f
[3], 1)) {
88 if (!v_ipv6_addr(f
[3], quiet
)) return 0;
91 if (!v_iptport(f
[4], quiet
)) return 0;
93 f
[5].value
= f
[5].value
.replace(/>/g
, '_');
94 if (!v_nodelim(f
[5], quiet
, 'Description')) return 0;
98 fog
.resetNewEditor = function() {
99 var f
= fields
.getAll(this.newEditor
);
101 f
[1].selectedIndex
= 0;
106 ferror
.clearAll(fields
.getAll(this.newEditor
));
109 fog
.setup = function() {
110 this.init('fo-grid', 'sort', 50, [
111 { type
: 'checkbox' },
112 { type
: 'select', options
: [[1, 'TCP'],[2, 'UDP'],[3,'Both']] },
113 { type
: 'text', maxlen
: 140 },
114 { type
: 'text', maxlen
: 140 },
115 { type
: 'text', maxlen
: 16 },
116 { type
: 'text', maxlen
: 32 }]);
117 this.headerSet(['On', 'Proto', 'Src Address', 'Dest Address', 'Dest Ports', 'Description']);
118 var nv
= nvram
.ipv6_portforward
.split('>');
119 for (var i
= 0; i
< nv
.length
; ++i
) {
122 if (r
= nv
[i
].match(/^(\d)<(\d)<(.*)<(.*)<(.+?)<(.*)$/)) {
125 r
[5] = r
[5].replace(/:/g
, '-');
126 fog
.insertData(-1, r
.slice(1, 7));
133 function srcSort(a
, b
)
135 if (a
[2].length
) return -1;
136 if (b
[2].length
) return 1;
142 if (fog
.isEditing()) return;
144 var data
= fog
.getAllData().sort(srcSort
);
146 for (var i
= 0; i
< data
.length
; ++i
) {
147 data
[i
][4] = data
[i
][4].replace(/-/g
, ':');
148 s
+= data
[i
].join('<') + '>';
151 fom
.ipv6_portforward
.value
= s
;
152 form
.submit(fom
, 0, 'tomato.cgi');
158 fog
.resetNewEditor();
162 <body onload='init()'
>
163 <form id='_fom' method='post' action='javascript:{}'
>
164 <table id='container' cellspacing=
0>
165 <tr><td colspan=
2 id='header'
>
166 <div class='title'
>Tomato
</div>
167 <div class='version'
>Version <%
version(); %></div>
169 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
171 <div id='ident'
><%
ident(); %></div>
175 <input type='hidden' name='_nextpage' value='forward-basic-ipv6.asp'
>
176 <input type='hidden' name='_service' value='firewall-restart'
>
178 <input type='hidden' name='ipv6_portforward'
>
180 <div class='section-title'
>IPv6 Port Forwarding
</div>
181 <div class='section'
>
182 <table class='tomato-grid' cellspacing=
1 id='fo-grid'
></table>
183 <script type='text/javascript'
>fog
.setup();</script>
187 Opens access to ports on machines inside the LAN, but does
<b>not
</b> re-map ports.
189 <li><b>Src Address
</b> <i>(optional)
</i> - Forward only if from this address. Ex:
"2001:4860:800b::/48",
"me.example.com".
190 <li><b>Dest Address
</b> <i>(optional)
</i> - The destination address inside the LAN.
191 <li><b>Dest Ports
</b> - The ports to be opened for forwarding. Ex:
"2345",
"200,300",
"200-300,400".
196 <script type='text/javascript'
>show_notice1('<% notice("ip6tables"); %>');</script>
201 <tr><td id='footer' colspan=
2>
202 <span id='footer-msg'
></span>
203 <input type='button' value='Save' id='save-button' onclick='save()'
>
204 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'
>