Skip to content

Commit

Permalink
Use I_LINK instead of I_PLINK on Solaris
Browse files Browse the repository at this point in the history
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 <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Dec 9, 2011
1 parent 2355574 commit 5f873b3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion openconnect-internal.h
Expand Up @@ -190,7 +190,6 @@ struct openconnect_info {

#ifdef __sun__
int ip_fd;
int tun_muxid;
#endif
int tun_fd;
int ssl_fd;
Expand Down
9 changes: 1 addition & 8 deletions tun.c
Expand Up @@ -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);
Expand All @@ -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 */
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions www/changelog.xml
Expand Up @@ -17,6 +17,7 @@
<ul>
<li><b>OpenConnect HEAD</b>
<ul>
<li>Use <tt>I_LINK</tt> instead of <tt>I_PLINK</tt> on Solaris to plumb interface.</li>
<li>Refer to <a href="vpnc-script.html">vpnc-script</a> and <a href="mail.html">help</a> web pages in openconnect output.</li>
<li>Fix potential crash when processing libproxy results.</li>
<li>Be more conservative in detecting libproxy without pkg-config.</li>
Expand Down

0 comments on commit 5f873b3

Please sign in to comment.