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(); %>] 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>
21 <script type='text/javascript' src='debug.js'
></script>
23 <script type='text/javascript'
>
24 // <% nvram("ipv6_6rd_prefix_length,ipv6_prefix,ipv6_prefix_length,ipv6_accept_ra,ipv6_rtr_addr,ipv6_service,ipv6_dns,ipv6_tun_addr,ipv6_tun_addrlen,ipv6_ifname,ipv6_tun_v4end,ipv6_relay,ipv6_tun_mtu,ipv6_tun_ttl,ipv6_6rd_ipv4masklen,ipv6_6rd_prefix,ipv6_6rd_borderrelay"); %>
26 nvram
.ipv6_accept_ra
= fixInt(nvram
.ipv6_accept_ra
, 0, 3, 0);
28 function verifyFields(focused
, quiet
)
39 _f_ipv6_prefix_length
: 1,
40 _f_ipv6_rtr_addr_auto
: 1,
45 _f_ipv6_accept_ra_wan
: 1,
46 _f_ipv6_accept_ra_lan
: 1,
54 _ipv6_6rd_ipv4masklen
: 1,
55 _ipv6_6rd_prefix_length
: 1,
57 _ipv6_6rd_borderrelay
: 1
60 c
= E('_ipv6_service').value
;
64 vis
._f_ipv6_rtr_addr_auto
= 0;
65 vis
._f_ipv6_rtr_addr
= 0;
66 vis
._f_ipv6_dns_1
= 0;
67 vis
._f_ipv6_dns_2
= 0;
68 vis
._f_ipv6_dns_3
= 0;
69 vis
._f_ipv6_accept_ra_wan
= 0;
70 vis
._f_ipv6_accept_ra_lan
= 0;
73 vis
._ipv6_6rd_ipv4masklen
= 0;
74 vis
._ipv6_6rd_prefix_length
= 0;
75 vis
._ipv6_6rd_prefix
= 0;
76 vis
._ipv6_6rd_borderrelay
= 0;
77 vis
._f_ipv6_prefix
= 0;
78 vis
._f_ipv6_prefix_length
= 0;
79 vis
._ipv6_tun_v4end
= 0;
81 vis
._ipv6_tun_addr
= 0;
82 vis
._ipv6_tun_addrlen
= 0;
83 vis
._ipv6_tun_ttl
= 0;
84 vis
._ipv6_tun_mtu
= 0;
86 E('_f_ipv6_rtr_addr_auto').value
= 1;
87 vis
._f_ipv6_rtr_addr_auto
= 2;
91 vis
._f_ipv6_prefix
= 0;
92 vis
._ipv6_tun_v4end
= 0;
94 vis
._ipv6_tun_addr
= 0;
95 vis
._ipv6_tun_addrlen
= 0;
98 vis
._f_ipv6_accept_ra_wan
= 0;
99 vis
._f_ipv6_accept_ra_lan
= 0;
100 vis
._f_ipv6_rtr_addr_auto
= 0;
101 vis
._f_ipv6_rtr_addr
= 0;
102 vis
._f_ipv6_prefix_length
= 0;
105 _fom
.f_ipv6_accept_ra_wan
.checked
= true;
107 vis
._f_ipv6_prefix
= 0;
108 vis
._f_ipv6_rtr_addr_auto
= 0;
109 vis
._f_ipv6_rtr_addr
= 0;
111 vis
._f_ipv6_prefix_length
= 0;
112 vis
._f_ipv6_accept_ra_lan
= 0;
113 vis
._f_ipv6_accept_ra_wan
= 0;
117 vis
._ipv6_ifname
= 0;
118 vis
._ipv6_tun_v4end
= 0;
120 vis
._ipv6_tun_addr
= 0;
121 vis
._ipv6_tun_addrlen
= 0;
122 vis
._ipv6_tun_ttl
= 0;
123 vis
._ipv6_tun_mtu
= 0;
124 vis
._ipv6_6rd_ipv4masklen
= 0;
125 vis
._ipv6_6rd_prefix_length
= 0;
126 vis
._ipv6_6rd_prefix
= 0;
127 vis
._ipv6_6rd_borderrelay
= 0;
130 vis
._ipv6_ifname
= 0;
131 vis
._f_ipv6_prefix
= 0;
132 vis
._f_ipv6_rtr_addr_auto
= 0;
133 vis
._f_ipv6_rtr_addr
= 0;
134 vis
._ipv6_tun_v4end
= 0;
135 vis
._ipv6_tun_addr
= 0;
136 vis
._ipv6_tun_addrlen
= 0;
137 vis
._f_ipv6_accept_ra_wan
= 0;
138 vis
._f_ipv6_accept_ra_lan
= 0;
139 vis
._ipv6_6rd_ipv4masklen
= 0;
140 vis
._ipv6_6rd_prefix_length
= 0;
141 vis
._ipv6_6rd_prefix
= 0;
142 vis
._ipv6_6rd_borderrelay
= 0;
145 vis
._ipv6_ifname
= 0;
147 vis
._f_ipv6_accept_ra_wan
= 0;
148 vis
._f_ipv6_accept_ra_lan
= 0;
149 vis
._ipv6_6rd_ipv4masklen
= 0;
150 vis
._ipv6_6rd_prefix_length
= 0;
151 vis
._ipv6_6rd_prefix
= 0;
152 vis
._ipv6_6rd_borderrelay
= 0;
156 if (vis
._f_ipv6_rtr_addr_auto
&& E('_f_ipv6_rtr_addr_auto').value
== 0) {
157 vis
._f_ipv6_rtr_addr
= 2;
164 b
.disabled
= (c
!= 1);
165 PR(b
).style
.display
= c
? '' : 'none';
170 if (vis
._ipv6_ifname
== 1) {
171 if (E('_ipv6_service').value
!= 'other') {
172 if (!v_length('_ipv6_ifname', quiet
|| !ok
, 2)) ok
= 0;
174 else ferror
.clear('_ipv6_ifname');
179 a = [['_ipv6_ifname', 2]];
180 for (i = a.length - 1; i >= 0; --i) {
182 if ((vis[v[0]]) && (!v_length(v[0], quiet || !ok, v[1]))) ok = 0;
187 a
= ['_ipv6_tun_v4end'];
188 for (i
= a
.length
- 1; i
>= 0; --i
)
189 if ((vis
[a
[i
]]) && (!v_ip(a
[i
], quiet
|| !ok
))) ok
= 0;
191 a
= ['_ipv6_6rd_borderrelay'];
192 for (i
= a
.length
- 1; i
>= 0; --i
)
193 if ((vis
[a
[i
]]) && (!v_ip(a
[i
], quiet
|| !ok
))) ok
= 0;
196 a
= [['_f_ipv6_prefix_length', 3, 64], ['_ipv6_tun_addrlen', 3, 127], ['_ipv6_tun_ttl', 0, 255], ['_ipv6_relay', 1, 254]];
197 for (i
= a
.length
- 1; i
>= 0; --i
) {
199 if ((vis
[b
[0]]) && (!v_range(b
[0], quiet
|| !ok
, b
[1], b
[2]))) ok
= 0;
205 if ((!v_range(b
, 1, 0, 0)) && (!v_range(b
, quiet
|| !ok
, 1280, 1480))) ok
= 0;
206 else ferror
.clear(E(b
));
210 b
= '_f_ipv6_prefix';
211 c
= vis
._f_ipv6_accept_ra_wan
&& (E('_f_ipv6_accept_ra_wan').checked
|| E('_f_ipv6_accept_ra_lan').checked
);
212 if (vis
[b
] && (E(b
).value
.length
> 0 || (!c
))) {
213 if (!v_ipv6_addr(b
, quiet
|| !ok
)) ok
= 0;
215 else ferror
.clear(b
);
218 a
= ['_ipv6_tun_addr'];
219 for (i
= a
.length
- 1; i
>= 0; --i
)
220 if ((vis
[a
[i
]]) && (!v_ipv6_addr(a
[i
], quiet
|| !ok
))) ok
= 0;
222 if (vis
._f_ipv6_rtr_addr
== 2) {
223 b
= E('_f_ipv6_prefix');
224 ip
= (b
.value
.length
> 0) ? ZeroIPv6PrefixBits(b
.value
, E('_f_ipv6_prefix_length').value
) : '';
225 b
.value
= CompressIPv6Address(ip
);
226 E('_f_ipv6_rtr_addr').value
= (ip
.length
> 0) ? CompressIPv6Address(ip
+ '1') : '';
229 // optional IPv6 address
230 a
= ['_f_ipv6_rtr_addr', '_f_ipv6_dns_1', '_f_ipv6_dns_2', '_f_ipv6_dns_3'];
231 for (i
= a
.length
- 1; i
>= 0; --i
)
232 if ((vis
[a
[i
]]==1) && (E(a
[i
]).value
.length
> 0) && (!v_ipv6_addr(a
[i
], quiet
|| !ok
))) ok
= 0;
239 verifyFields(null, 1);
242 function joinIPv6Addr(a
) {
246 for (i
= 0; i
< a
.length
; ++i
) {
247 s
= CompressIPv6Address(a
[i
]);
248 if ((s
) && (s
!= '')) r
.push(s
);
258 if (!verifyFields(null, false)) return;
262 fom
.ipv6_dns
.value
= joinIPv6Addr([fom
.f_ipv6_dns_1
.value
, fom
.f_ipv6_dns_2
.value
, fom
.f_ipv6_dns_3
.value
]);
264 fom
.ipv6_accept_ra
.value
= 0;
265 if (fom
.f_ipv6_accept_ra_wan
.checked
&& !fom
.f_ipv6_accept_ra_wan
.disabled
)
266 fom
.ipv6_accept_ra
.value
|= 1;
267 if (fom
.f_ipv6_accept_ra_lan
.checked
&& !fom
.f_ipv6_accept_ra_lan
.disabled
)
268 fom
.ipv6_accept_ra
.value
|= 2;
270 fom
.ipv6_prefix_length
.value
= fom
.f_ipv6_prefix_length
.value
;
271 fom
.ipv6_prefix
.value
= fom
.f_ipv6_prefix
.value
;
273 switch(E('_ipv6_service').value
) {
275 fom
.ipv6_prefix_length
.value
= 64;
276 fom
.ipv6_prefix
.value
= '';
277 fom
.ipv6_rtr_addr
.value
= fom
.f_ipv6_rtr_addr
.value
;
283 fom
.ipv6_prefix
.value
= '';
284 fom
.ipv6_rtr_addr
.value
= '';
287 fom
.ipv6_rtr_addr
.disabled
= fom
.f_ipv6_rtr_addr_auto
.disabled
;
288 if (fom
.f_ipv6_rtr_addr_auto
.value
== 1)
289 fom
.ipv6_rtr_addr
.value
= fom
.f_ipv6_rtr_addr
.value
;
291 fom
.ipv6_rtr_addr
.value
= '';
302 <form id='_fom' method='post' action='tomato.cgi'
>
303 <table id='container' cellspacing=
0>
304 <tr><td colspan=
2 id='header'
>
305 <div class='title'
>Tomato
</div>
306 <div class='version'
>Version <%
version(); %></div>
308 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
310 <div id='ident'
><%
ident(); %></div>
314 <input type='hidden' name='_nextpage' value='basic-ipv6.asp'
>
315 <input type='hidden' name='_nextwait' value='
10'
>
316 <input type='hidden' name='_service' value='*'
>
318 <input type='hidden' name='ipv6_dns'
>
319 <input type='hidden' name='ipv6_prefix'
>
320 <input type='hidden' name='ipv6_prefix_length'
>
321 <input type='hidden' name='ipv6_rtr_addr'
>
322 <input type='hidden' name='ipv6_accept_ra'
>
324 <div class='section-title'
>IPv6 Configuration
</div>
325 <div class='section'
>
326 <script type='text/javascript'
>
327 dns
= nvram
.ipv6_dns
.split(/\s+/);
329 createFieldTable('', [
330 { title
: 'IPv6 Service Type', name
: 'ipv6_service', type
: 'select',
331 options
: [['', 'Disabled'],['native','Native IPv6 from ISP'],['native-pd','DHCPv6 with Prefix Delegation'],['6to4','6to4 Anycast Relay'],['sit','6in4 Static Tunnel'],['6rd','6rd Relay'],['6rd-pd','6rd from DHCPv4 (Option 212)'],['other','Other (Manual Configuration)']],
332 value
: nvram
.ipv6_service
},
333 { title
: 'IPv6 WAN Interface', name
: 'ipv6_ifname', type
: 'text', maxlen
: 8, size
: 10, value
: nvram
.ipv6_ifname
},
335 { title
: 'Assigned / Routed Prefix', name
: 'f_ipv6_prefix', type
: 'text', maxlen
: 46, size
: 48, value
: nvram
.ipv6_prefix
},
336 { title
: '6rd Routed Prefix', name
: 'ipv6_6rd_prefix', type
: 'text', maxlen
: 46, size
: 48, value
: nvram
.ipv6_6rd_prefix
},
337 { title
: '6rd Prefix Length', name
: 'ipv6_6rd_prefix_length', type
: 'text', maxlen
: 3, size
: 5, value
: nvram
.ipv6_6rd_prefix_length
, suffix
: ' <small>(Usually 32)</small>' },
338 { title
: 'Prefix Length', name
: 'f_ipv6_prefix_length', type
: 'text', maxlen
: 3, size
: 5, value
: nvram
.ipv6_prefix_length
},
339 { title
: 'Router IPv6 Address', multi
: [
340 { name
: 'f_ipv6_rtr_addr_auto', type
: 'select', options
: [['0', 'Default'],['1','Manual']], value
: (nvram
.ipv6_rtr_addr
== '' ? '0' : '1') },
341 { name
: 'f_ipv6_rtr_addr', type
: 'text', maxlen
: 46, size
: 48, value
: nvram
.ipv6_rtr_addr
}
343 { title
: 'Static DNS', name
: 'f_ipv6_dns_1', type
: 'text', maxlen
: 46, size
: 48, value
: dns
[0] || '' },
344 { title
: '', name
: 'f_ipv6_dns_2', type
: 'text', maxlen
: 46, size
: 48, value
: dns
[1] || '' },
345 { title
: '', name
: 'f_ipv6_dns_3', type
: 'text', maxlen
: 46, size
: 48, value
: dns
[2] || '' },
346 { title
: 'Accept RA from', multi
: [
347 { suffix
: ' WAN ', name
: 'f_ipv6_accept_ra_wan', type
: 'checkbox', value
: (nvram
.ipv6_accept_ra
& 1) },
348 { suffix
: ' LAN ', name
: 'f_ipv6_accept_ra_lan', type
: 'checkbox', value
: (nvram
.ipv6_accept_ra
& 2) }
351 { title
: 'Tunnel Remote Endpoint (IPv4 Address)', name
: 'ipv6_tun_v4end', type
: 'text', maxlen
: 15, size
: 17, value
: nvram
.ipv6_tun_v4end
},
352 { title
: '6RD Tunnel Border Relay (IPv4 Address)', name
: 'ipv6_6rd_borderrelay', type
: 'text', maxlen
: 15, size
: 17, value
: nvram
.ipv6_6rd_borderrelay
},
353 { title
: '6RD IPv4 Mask Length', name
: 'ipv6_6rd_ipv4masklen', type
: 'text', maxlen
: 3, size
: 5, value
: nvram
.ipv6_6rd_ipv4masklen
, suffix
: ' <small>(usually 0)</small>' },
354 { title
: 'Relay Anycast Address', name
: 'ipv6_relay', type
: 'text', maxlen
: 3, size
: 5, prefix
: '192.88.99.  ', value
: nvram
.ipv6_relay
},
355 { title
: 'Tunnel Client IPv6 Address', multi
: [
356 { name
: 'ipv6_tun_addr', type
: 'text', maxlen
: 46, size
: 48, value
: nvram
.ipv6_tun_addr
, suffix
: ' / ' },
357 { name
: 'ipv6_tun_addrlen', type
: 'text', maxlen
: 3, size
: 5, value
: nvram
.ipv6_tun_addrlen
}
359 { title
: 'Tunnel MTU', name
: 'ipv6_tun_mtu', type
: 'text', maxlen
: 4, size
: 8, value
: nvram
.ipv6_tun_mtu
, suffix
: ' <small>(0 for default)</small>' },
360 { title
: 'Tunnel TTL', name
: 'ipv6_tun_ttl', type
: 'text', maxlen
: 3, size
: 8, value
: nvram
.ipv6_tun_ttl
}
366 <script type='text/javascript'
>show_notice1('<% notice("ip6tables"); %>');</script>
371 <tr><td id='footer' colspan=
2>
372 <span id='footer-msg'
></span>
373 <input type='button' value='Save' id='save-button' onclick='save()'
>
374 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'
>
378 <script type='text/javascript'
>earlyInit()</script>
379 <div style='height:
100px'
></div>