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_prefix,ipv6_prefix_length,ipv6_radvd,ipv6_accept_ra,ipv6_rtr_addr,ipv6_service,ipv6_dns,ipv6_tun_addr,ipv6_tun_addrlen,ipv6_ifname,ipv6_tun_v4end,ipv6_tun_mtu,ipv6_tun_ttl"); %>
26 nvram
.ipv6_accept_ra
= fixInt(nvram
.ipv6_accept_ra
, 0, 3, 0);
28 function verifyFields(focused
, quiet
)
39 _ipv6_prefix_length
: 1,
40 _f_ipv6_rtr_addr_auto
: 1,
46 _f_ipv6_accept_ra_wan
: 1,
47 _f_ipv6_accept_ra_lan
: 1,
56 switch(E('_ipv6_service').value
) {
59 vis
._f_ipv6_rtr_addr_auto
= 0;
60 vis
._f_ipv6_rtr_addr
= 0;
61 vis
._f_ipv6_dns_1
= 0;
62 vis
._f_ipv6_dns_2
= 0;
63 vis
._f_ipv6_dns_3
= 0;
64 vis
._f_ipv6_radvd
= 0;
65 vis
._f_ipv6_accept_ra_wan
= 0;
66 vis
._f_ipv6_accept_ra_lan
= 0;
70 vis
._ipv6_prefix_length
= 0;
71 E('_f_ipv6_rtr_addr_auto').value
= 1;
72 vis
._ipv6_tun_v4end
= 0;
73 vis
._ipv6_tun_addr
= 0;
74 vis
._ipv6_tun_addrlen
= 0;
75 vis
._ipv6_tun_ttl
= 0;
76 vis
._ipv6_tun_mtu
= 0;
80 vis
._f_ipv6_rtr_addr_auto
= 0;
81 vis
._f_ipv6_rtr_addr
= 0;
85 vis
._ipv6_tun_v4end
= 0;
86 vis
._ipv6_tun_addr
= 0;
87 vis
._ipv6_tun_addrlen
= 0;
88 vis
._ipv6_tun_ttl
= 0;
89 vis
._ipv6_tun_mtu
= 0;
95 if (vis
._f_ipv6_rtr_addr_auto
&& E('_f_ipv6_rtr_addr_auto').value
== 0) {
96 vis
._f_ipv6_rtr_addr
= 2;
102 b
.disabled
= (c
!= 1);
103 PR(b
).style
.display
= c
? '' : 'none';
108 if (vis
._ipv6_ifname
== 1) {
109 if (E('_ipv6_service').value
!= 'other') {
110 if (!v_length('_ipv6_ifname', quiet
|| !ok
, 2)) ok
= 0;
112 else ferror
.clear('_ipv6_ifname');
117 a = [['_ipv6_ifname', 2]];
118 for (i = a.length - 1; i >= 0; --i) {
120 if ((vis[v[0]]) && (!v_length(v[0], quiet || !ok, v[1]))) ok = 0;
125 a
= ['_ipv6_tun_v4end'];
126 for (i
= a
.length
- 1; i
>= 0; --i
)
127 if ((vis
[a
[i
]]) && (!v_ip(a
[i
], quiet
|| !ok
))) ok
= 0;
130 a
= [['_ipv6_prefix_length', 3, 64], ['_ipv6_tun_addrlen', 3, 127], ['_ipv6_tun_ttl', 0, 255]];
131 for (i
= a
.length
- 1; i
>= 0; --i
) {
133 if ((vis
[b
[0]]) && (!v_range(b
[0], quiet
|| !ok
, b
[1], b
[2]))) ok
= 0;
139 if ((!v_range(b
, 1, 0, 0)) && (!v_range(b
, quiet
|| !ok
, 1280, 1480))) ok
= 0;
140 else ferror
.clear(E(b
));
144 a
= ['_ipv6_prefix', '_ipv6_tun_addr'];
145 for (i
= a
.length
- 1; i
>= 0; --i
)
146 if ((vis
[a
[i
]]) && (!v_ipv6_addr(a
[i
], quiet
|| !ok
))) ok
= 0;
148 if (vis
._f_ipv6_rtr_addr
== 2 && ok
) {
149 b
= E('_ipv6_prefix');
150 ip
= ZeroIPv6PrefixBits(b
.value
, E('_ipv6_prefix_length').value
);
152 E('_f_ipv6_rtr_addr').value
= ip
+ '1';
155 // optional IPv6 address
156 a
= ['_f_ipv6_rtr_addr', '_f_ipv6_dns_1', '_f_ipv6_dns_2', '_f_ipv6_dns_3'];
157 for (i
= a
.length
- 1; i
>= 0; --i
)
158 if ((vis
[a
[i
]]==1) && (E(a
[i
]).value
.length
> 0) && (!v_ipv6_addr(a
[i
], quiet
|| !ok
))) ok
= 0;
165 verifyFields(null, 1);
168 function joinIPv6Addr(a
) {
172 for (i
= 0; i
< a
.length
; ++i
) {
173 s
= CompressIPv6Address(a
[i
]);
174 if ((s
) && (s
!= '')) r
.push(s
);
184 if (!verifyFields(null, false)) return;
188 fom
.ipv6_dns
.value
= joinIPv6Addr([fom
.f_ipv6_dns_1
.value
, fom
.f_ipv6_dns_2
.value
, fom
.f_ipv6_dns_3
.value
]);
189 fom
.ipv6_radvd
.value
= fom
.f_ipv6_radvd
.checked
? 1 : 0;
191 fom
.ipv6_accept_ra
.value
= 0;
192 if (fom
.f_ipv6_accept_ra_wan
.checked
) fom
.ipv6_accept_ra
.value
|= 1;
193 if (fom
.f_ipv6_accept_ra_lan
.checked
) fom
.ipv6_accept_ra
.value
|= 2;
195 switch(E('_ipv6_service').value
) {
197 fom
.ipv6_prefix_length
.value
= 64;
198 fom
.ipv6_prefix
.value
= '';
199 fom
.ipv6_rtr_addr
.value
= fom
.f_ipv6_rtr_addr
.value
;
202 fom
.ipv6_prefix
.value
= '';
203 fom
.ipv6_rtr_addr
.value
= '';
206 fom
.ipv6_rtr_addr
.disabled
= fom
.f_ipv6_rtr_addr_auto
.disabled
;
207 if (fom
.f_ipv6_rtr_addr_auto
.value
== 1)
208 fom
.ipv6_rtr_addr
.value
= fom
.f_ipv6_rtr_addr
.value
;
210 fom
.ipv6_rtr_addr
.value
= '';
221 <form id='_fom' method='post' action='tomato.cgi'
>
222 <table id='container' cellspacing=
0>
223 <tr><td colspan=
2 id='header'
>
224 <div class='title'
>Tomato
</div>
225 <div class='version'
>Version <%
version(); %></div>
227 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
229 <div id='ident'
><%
ident(); %></div>
233 <input type='hidden' name='_nextpage' value='basic-ipv6.asp'
>
234 <input type='hidden' name='_nextwait' value='
10'
>
235 <input type='hidden' name='_service' value='*'
>
237 <input type='hidden' name='ipv6_radvd'
>
238 <input type='hidden' name='ipv6_dns'
>
239 <input type='hidden' name='ipv6_rtr_addr'
>
240 <input type='hidden' name='ipv6_accept_ra'
>
242 <div class='section-title'
>IPv6 Configuration
</div>
243 <div class='section'
>
244 <script type='text/javascript'
>
245 dns
= nvram
.ipv6_dns
.split(/\s+/);
247 createFieldTable('', [
248 { title
: 'IPv6 Service Type', name
: 'ipv6_service', type
: 'select',
249 options
: [['', 'Disabled'],['native','Native IPv6 from ISP'],['native-pd','DHCPv6 with Prefix Delegation'],['sit','6in4 Static Tunnel'],['other','Other (Manual Configuration)']],
250 value
: nvram
.ipv6_service
},
251 { title
: 'IPv6 WAN Interface', name
: 'ipv6_ifname', type
: 'text', maxlen
: 8, size
: 10, value
: nvram
.ipv6_ifname
},
253 { title
: 'Assigned IPv6 Prefix', name
: 'ipv6_prefix', type
: 'text', maxlen
: 46, size
: 48, value
: nvram
.ipv6_prefix
},
254 { title
: 'Prefix Length', name
: 'ipv6_prefix_length', type
: 'text', maxlen
: 3, size
: 5, value
: nvram
.ipv6_prefix_length
},
255 { title
: 'Router IPv6 Address', multi
: [
256 { name
: 'f_ipv6_rtr_addr_auto', type
: 'select', options
: [['0', 'Default'],['1','Manual']], value
: (nvram
.ipv6_rtr_addr
== '' ? '0' : '1') },
257 { name
: 'f_ipv6_rtr_addr', type
: 'text', maxlen
: 46, size
: 48, value
: nvram
.ipv6_rtr_addr
}
259 { title
: 'Static DNS', name
: 'f_ipv6_dns_1', type
: 'text', maxlen
: 46, size
: 48, value
: dns
[0] || '' },
260 { title
: '', name
: 'f_ipv6_dns_2', type
: 'text', maxlen
: 46, size
: 48, value
: dns
[1] || '' },
261 { title
: '', name
: 'f_ipv6_dns_3', type
: 'text', maxlen
: 46, size
: 48, value
: dns
[2] || '' },
262 { title
: 'Enable Router Advertisements', name
: 'f_ipv6_radvd', type
: 'checkbox', value
: nvram
.ipv6_radvd
!= '0' },
263 { title
: 'Accept RA from', multi
: [
264 { suffix
: ' WAN ', name
: 'f_ipv6_accept_ra_wan', type
: 'checkbox', value
: (nvram
.ipv6_accept_ra
& 1) },
265 { suffix
: ' LAN ', name
: 'f_ipv6_accept_ra_lan', type
: 'checkbox', value
: (nvram
.ipv6_accept_ra
& 2) }
268 { title
: 'Tunnel Remote Endpoint (IPv4 Address)', name
: 'ipv6_tun_v4end', type
: 'text', maxlen
: 15, size
: 17, value
: nvram
.ipv6_tun_v4end
},
269 { title
: 'Tunnel Client IPv6 Address', multi
: [
270 { name
: 'ipv6_tun_addr', type
: 'text', maxlen
: 46, size
: 48, value
: nvram
.ipv6_tun_addr
, suffix
: ' / ' },
271 { name
: 'ipv6_tun_addrlen', type
: 'text', maxlen
: 3, size
: 5, value
: nvram
.ipv6_tun_addrlen
}
273 { title
: 'Tunnel MTU', name
: 'ipv6_tun_mtu', type
: 'text', maxlen
: 4, size
: 8, value
: nvram
.ipv6_tun_mtu
, suffix
: ' <small>(0 for default)</small>' },
274 { title
: 'Tunnel TTL', name
: 'ipv6_tun_ttl', type
: 'text', maxlen
: 3, size
: 8, value
: nvram
.ipv6_tun_ttl
}
280 <script type='text/javascript'
>show_notice1('<% notice("ip6tables"); %>');</script>
285 <tr><td id='footer' colspan=
2>
286 <span id='footer-msg'
></span>
287 <input type='button' value='Save' id='save-button' onclick='save()'
>
288 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'
>
292 <script type='text/javascript'
>earlyInit()</script>
293 <div style='height:
100px'
></div>