From c55e9562d64f381ba46b83a02503f6239e23d3ef Mon Sep 17 00:00:00 2001 From: Gert Doering Date: Fri, 3 Feb 2012 17:11:03 +0100 Subject: Implement IPv6 interface config with non-/64 prefix lengths. Add "ifconfig_ipv6_netbits_parm" parameter to init_tun(), use that to initialize tt->netbits_ipv6 (previously: always /64). Actual interface setup code already used tt->netbits_ipv6, so no changes needed there. Remove restrictions on "/netbits" value for --server-ipv6 config option (can now be /64.../112, previously had to be exactly /64). Supporting even smaller networks could cause problems with ipv6-pool handling and are only allowed for explicit "ifconfig-ipv6", not for "server-ipv6". Add /netbits to pushed "ifconfig-ipv6" values on server side (client side always accepted this, but ignored it so far, so this does not break compatibility). Tested on Linux/ifconfig, Linux/iproute2 and FreeBSD 7.4 Signed-off-by: Gert Doering Acked-by: David Sommerseth Signed-off-by: David Sommerseth --- helper.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'helper.c') diff --git a/helper.c b/helper.c index c7333f6..22ea652 100644 --- a/helper.c +++ b/helper.c @@ -184,12 +184,14 @@ helper_client_server (struct options *o) 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; -- cgit