diff options
author | Gert Doering <gert@greenie.muc.de> | 2011-01-16 18:24:37 +0100 |
---|---|---|
committer | Gert Doering <gert@greenie.muc.de> | 2011-04-24 17:22:46 +0200 |
commit | 37aa6ac67bd969544ee1c077df915a3bafa484da (patch) | |
tree | 08eb62385313044ea1da95fe5b3ddf0b75b8d8c0 | |
parent | bump IPv6 version number (openvpn --version) to 20100922-1 (diff) | |
download | openvpn-37aa6ac67bd969544ee1c077df915a3bafa484da.tar.xz |
Implement "ipv6 ifconfig" for TAP interfaces on Solaris
Solaris close_tun(): add explicit "unplumb'ing" of IPv6 tun/tap
interfaces, otherwise they would linger around after OpenVPN exits.
Signed-off-by: Gert Doering <gert@greenie.muc.de>
-rw-r--r-- | tun.c | 42 |
1 files changed, 40 insertions, 2 deletions
@@ -799,14 +799,16 @@ do_ifconfig (struct tuntap *tt, if (!openvpn_execve_check (&argv, es, 0, "Solaris ifconfig phase-2 failed")) solaris_error_close (tt, es, actual, false); - if ( do_ipv6 ) /* GERT-TODO: UNTESTED */ + if ( do_ipv6 ) { argv_printf (&argv, "%s %s inet6 unplumb", IFCONFIG_PATH, actual ); argv_msg (M_INFO, &argv); openvpn_execve_check (&argv, es, 0, NULL); - argv_printf (&argv, + if ( tt->type == DEV_TYPE_TUN ) + { + argv_printf (&argv, "%s %s inet6 plumb %s/%d %s up", IFCONFIG_PATH, actual, @@ -814,6 +816,30 @@ do_ifconfig (struct tuntap *tt, tt->netbits_ipv6, ifconfig_ipv6_remote ); + } + else /* tap mode */ + { + /* base IPv6 tap interface needs to be brought up first + */ + argv_printf (&argv, "%s %s inet6 plumb up", + IFCONFIG_PATH, actual ); + argv_msg (M_INFO, &argv); + if (!openvpn_execve_check (&argv, es, 0, "Solaris ifconfig IPv6 (prepare) failed")) + solaris_error_close (tt, es, actual, true); + + /* we might need to do "ifconfig %s inet6 auto-dhcp drop" + * after the system has noticed the interface and fired up + * the DHCPv6 client - but this takes quite a while, and the + * server will ignore the DHCPv6 packets anyway. So we don't. + */ + + /* static IPv6 addresses need to go to a subinterface (tap0:1) + */ + argv_printf (&argv, + "%s %s inet6 addif %s/%d up", + IFCONFIG_PATH, actual, + ifconfig_ipv6_local, tt->netbits_ipv6 ); + } argv_msg (M_INFO, &argv); if (!openvpn_execve_check (&argv, es, 0, "Solaris ifconfig IPv6 failed")) solaris_error_close (tt, es, actual, true); @@ -1777,6 +1803,18 @@ solaris_close_tun (struct tuntap *tt) { if (tt) { + /* IPv6 interfaces need to be 'manually' de-configured */ + if ( tt->ipv6 && tt->did_ifconfig_ipv6_setup ) + { + struct argv argv; + argv_init (&argv); + argv_printf( &argv, "%s %s inet6 unplumb", + IFCONFIG_PATH, tt->actual_name ); + argv_msg (M_INFO, &argv); + openvpn_execve_check (&argv, NULL, 0, "Solaris ifconfig inet6 unplumb failed"); + argv_reset (&argv); + } + if (tt->ip_fd >= 0) { struct lifreq ifr; |