Mailing List Archive

svn commit: vpnc r525 - /branches/vpnc-nortel/vpnc-script /trunk/vpnc-script
Author: Antonio Borneo
Date: Sun Mar 10 16:01:33 2013
New Revision: 525

Log:
Fix various issues on FreeBSD

- duplicate creation of tun devices
- cleanup of created tun device
- deadlock of vpnc holding an open file descriptor on /dev/tunN
- properly restoring /etc/resolv.conf

Signed-off-by: Emanuel Haupt <ehaupt@FreeBSD.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Modified:
branches/vpnc-nortel/vpnc-script
trunk/vpnc-script

Modified: branches/vpnc-nortel/vpnc-script
==============================================================================
--- branches/vpnc-nortel/vpnc-script (original)
+++ branches/vpnc-nortel/vpnc-script Sun Mar 10 16:01:33 2013
@@ -121,7 +121,7 @@
include /lib/network
MODIFYRESOLVCONF=modify_resolvconf_openwrt
RESTORERESOLVCONF=restore_resolvconf_openwrt
-elif [ -x /sbin/resolvconf ]; then # Optional tool on Debian, Ubuntu, Gentoo
+elif [ -x /sbin/resolvconf ] && [ "$OS" != "FreeBSD" ]; then # Optional tool on Debian, Ubuntu, Gentoo - but not FreeBSD, it seems to work different
MODIFYRESOLVCONF=modify_resolvconf_manager
RESTORERESOLVCONF=restore_resolvconf_manager
elif [ -x /sbin/netconfig ]; then # tool on Suse after 11.1
@@ -198,8 +198,11 @@

destroy_tun_device() {
case "$OS" in
- NetBSD|FreeBSD|OpenBSD) # and probably others...
+ NetBSD|OpenBSD) # and probably others...
ifconfig "$TUNDEV" destroy
+ ;;
+ FreeBSD)
+ ifconfig "$TUNDEV" destroy > /dev/null 2>&1 &
;;
esac
}
@@ -593,8 +596,12 @@
fi
fi
elif [ "$OS" = "FreeBSD" ]; then
- if [ ! -e /dev/tun ]; then
+ if ! kldstat -q -m if_tun > /dev/null; then
kldload if_tun
+ fi
+
+ if ! ifconfig $TUNDEV > /dev/null; then
+ ifconfig $TUNDEV create
fi
elif [ "$OS" = "GNU/kFreeBSD" ]; then
if [ ! -e /dev/tun ]; then

Modified: trunk/vpnc-script
==============================================================================
--- trunk/vpnc-script (original)
+++ trunk/vpnc-script Sun Mar 10 16:01:33 2013
@@ -121,7 +121,7 @@
include /lib/network
MODIFYRESOLVCONF=modify_resolvconf_openwrt
RESTORERESOLVCONF=restore_resolvconf_openwrt
-elif [ -x /sbin/resolvconf ]; then # Optional tool on Debian, Ubuntu, Gentoo
+elif [ -x /sbin/resolvconf ] && [ "$OS" != "FreeBSD" ]; then # Optional tool on Debian, Ubuntu, Gentoo - but not FreeBSD, it seems to work different
MODIFYRESOLVCONF=modify_resolvconf_manager
RESTORERESOLVCONF=restore_resolvconf_manager
elif [ -x /sbin/netconfig ]; then # tool on Suse after 11.1
@@ -198,8 +198,11 @@

destroy_tun_device() {
case "$OS" in
- NetBSD|FreeBSD|OpenBSD) # and probably others...
+ NetBSD|OpenBSD) # and probably others...
ifconfig "$TUNDEV" destroy
+ ;;
+ FreeBSD)
+ ifconfig "$TUNDEV" destroy > /dev/null 2>&1 &
;;
esac
}
@@ -593,8 +596,12 @@
fi
fi
elif [ "$OS" = "FreeBSD" ]; then
- if [ ! -e /dev/tun ]; then
+ if ! kldstat -q -m if_tun > /dev/null; then
kldload if_tun
+ fi
+
+ if ! ifconfig $TUNDEV > /dev/null; then
+ ifconfig $TUNDEV create
fi
elif [ "$OS" = "GNU/kFreeBSD" ]; then
if [ ! -e /dev/tun ]; then

_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/