From 5f873b34f5c76bcff8776a3d8bb3fbd6e380ddb6 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 9 Dec 2011 13:05:33 +0000 Subject: [PATCH] Use I_LINK instead of I_PLINK on Solaris This should avoid leaving stale tunnel devices around, because they'll automatically go away when the fd gets closed. This is only for Legacy IP though; We are still plumbing for IPv6 in the vpnc-script, which is weird and inconsistent. If only I could work out how to do it in tun.c like we do for IPv4... Signed-off-by: David Woodhouse --- openconnect-internal.h | 1 - tun.c | 9 +-------- www/changelog.xml | 1 + 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/openconnect-internal.h b/openconnect-internal.h index 16db3ed..f879244 100644 --- a/openconnect-internal.h +++ b/openconnect-internal.h @@ -190,7 +190,6 @@ struct openconnect_info { #ifdef __sun__ int ip_fd; - int tun_muxid; #endif int tun_fd; int ssl_fd; diff --git a/tun.c b/tun.c index 6699143..ed61b72 100644 --- a/tun.c +++ b/tun.c @@ -500,7 +500,7 @@ int setup_tun(struct openconnect_info *vpninfo) close(ip_fd); return -EIO; } - mux_id = ioctl(ip_fd, I_PLINK, tun2_fd); + mux_id = ioctl(ip_fd, I_LINK, tun2_fd); if (mux_id < 0) { perror(_("Can't link tun to IP")); close(tun2_fd); @@ -520,13 +520,9 @@ int setup_tun(struct openconnect_info *vpninfo) if (ioctl(ip_fd, SIOCSIFMUXID, &ifr) < 0) { perror(_("Set mux id")); close(tun_fd); - ioctl(ip_fd, I_PUNLINK, mux_id); close(ip_fd); return -EIO; } - /* Solaris tunctl needs this in order to tear it down */ - vpn_progress(vpninfo, PRG_DEBUG, _("mux id is %d\n"), mux_id); - vpninfo->tun_muxid = mux_id; vpninfo->ip_fd = ip_fd; #else /* BSD et al have /dev/tun$x devices */ @@ -699,9 +695,6 @@ void shutdown_tun(struct openconnect_info *vpninfo) } } #ifdef __sun__ - if (ioctl(vpninfo->ip_fd, I_PUNLINK, vpninfo->tun_muxid) < 0) - perror(_("ioctl(I_PUNLINK)")); - close(vpninfo->ip_fd); vpninfo->ip_fd = -1; #endif diff --git a/www/changelog.xml b/www/changelog.xml index fbc9ce6..55194e5 100644 --- a/www/changelog.xml +++ b/www/changelog.xml @@ -17,6 +17,7 @@