of /netbits, and correctly ifconfig'ing this
(default, if not specified: /64)
+ * done * 2012-02-03
+
11.) do not add ipv6-routes if tun-ipv6 is not set - complain instead
* done * 12.1.10
print_in6_addr( add_in6_addr( o->server_network_ipv6, 1), 0, &o->gc );
o->ifconfig_ipv6_remote =
print_in6_addr( add_in6_addr( o->server_network_ipv6, 2), 0, &o->gc );
+ o->ifconfig_ipv6_netbits = o->server_netbits_ipv6;
+
+ /* pool starts at "base address + 0x1000" - leave enough room */
+ ASSERT( o->server_netbits_ipv6 <= 112 ); /* want 16 bits */
- /* pool starts at "base address + 0x10000" */
- ASSERT( o->server_netbits_ipv6 < 96 ); /* want 32 bits */
o->ifconfig_ipv6_pool_defined = true;
o->ifconfig_ipv6_pool_base =
- add_in6_addr( o->server_network_ipv6, 0x10000 );
+ add_in6_addr( o->server_network_ipv6, 0x1000 );
o->ifconfig_ipv6_pool_netbits = o->server_netbits_ipv6;
o->tun_ipv6 = true;
c->options.ifconfig_local,
c->options.ifconfig_remote_netmask,
c->options.ifconfig_ipv6_local,
+ c->options.ifconfig_ipv6_netbits,
c->options.ifconfig_ipv6_remote,
addr_host (&c->c1.link_socket_addr.local),
addr_host (&c->c1.link_socket_addr.remote),
o->ifconfig_local,
o->ifconfig_remote_netmask,
o->ifconfig_ipv6_local,
+ o->ifconfig_ipv6_netbits,
o->ifconfig_ipv6_remote,
(in_addr_t)0,
(in_addr_t)0,
msg (msglevel, "error parsing --server-ipv6 parameter");
goto err;
}
- if ( netbits != 64 )
+ if ( netbits < 64 || netbits > 112 )
{
- msg( msglevel, "--server-ipv6 settings: only /64 supported right now (not /%d)", netbits );
+ msg( msglevel, "--server-ipv6 settings: only /64../112 supported right now (not /%d)", netbits );
goto err;
}
options->server_ipv6_defined = true;
if ( c->c2.push_ifconfig_ipv6_defined )
{
/* IPv6 is put into buffer first, could be lengthy */
- /* TODO: push "/netbits" as well, to allow non-/64 subnet sizes
- * (needs changes in options.c, options.h, and other places)
- */
- buf_printf( &buf, ",ifconfig-ipv6 %s %s",
+ buf_printf( &buf, ",ifconfig-ipv6 %s/%d %s",
print_in6_addr( c->c2.push_ifconfig_ipv6_local, 0, &gc),
+ c->c2.push_ifconfig_ipv6_netbits,
print_in6_addr( c->c2.push_ifconfig_ipv6_remote, 0, &gc) );
if (BLEN (&buf) >= safe_cap)
{
const char *ifconfig_local_parm, /* --ifconfig parm 1 */
const char *ifconfig_remote_netmask_parm, /* --ifconfig parm 2 */
const char *ifconfig_ipv6_local_parm, /* --ifconfig parm 1 IPv6 */
+ int ifconfig_ipv6_netbits_parm,
const char *ifconfig_ipv6_remote_parm, /* --ifconfig parm 2 IPv6 */
in_addr_t local_public,
in_addr_t remote_public,
{
msg( M_FATAL, "init_tun: problem converting IPv6 ifconfig addresses %s and %s to binary", ifconfig_ipv6_local_parm, ifconfig_ipv6_remote_parm );
}
- tt->netbits_ipv6 = 64;
+ tt->netbits_ipv6 = ifconfig_ipv6_netbits_parm;
/*
* Set ifconfig parameters
if (es)
{
setenv_str (es, "ifconfig_ipv6_local", ifconfig_ipv6_local);
+ setenv_int (es, "ifconfig_ipv6_netbits", tt->netbits_ipv6);
setenv_str (es, "ifconfig_ipv6_remote", ifconfig_ipv6_remote);
}
tt->did_ifconfig_ipv6_setup = true;
const char *ifconfig_local_parm, /* --ifconfig parm 1 */
const char *ifconfig_remote_netmask_parm, /* --ifconfig parm 2 */
const char *ifconfig_ipv6_local_parm, /* --ifconfig parm 1 / IPv6 */
+ int ifconfig_ipv6_netbits_parm, /* --ifconfig parm 1 / bits */
const char *ifconfig_ipv6_remote_parm, /* --ifconfig parm 2 / IPv6 */
in_addr_t local_public,
in_addr_t remote_public,