summaryrefslogtreecommitdiffstats
path: root/tun.c
diff options
context:
space:
mode:
authorGert Doering <gert@greenie.muc.de>2011-01-16 18:24:37 +0100
committerGert Doering <gert@greenie.muc.de>2011-04-24 17:22:46 +0200
commit37aa6ac67bd969544ee1c077df915a3bafa484da (patch)
tree08eb62385313044ea1da95fe5b3ddf0b75b8d8c0 /tun.c
parenta64e083c77e3819259d50c44d44f032dd50134f5 (diff)
downloadopenvpn-37aa6ac67bd969544ee1c077df915a3bafa484da.tar.gz
openvpn-37aa6ac67bd969544ee1c077df915a3bafa484da.tar.xz
openvpn-37aa6ac67bd969544ee1c077df915a3bafa484da.zip
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>
Diffstat (limited to 'tun.c')
-rw-r--r--tun.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/tun.c b/tun.c
index 52c875e..45db2b5 100644
--- a/tun.c
+++ b/tun.c
@@ -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;