# Author: Emanuel Haupt # Signed-off-by: Emanuel Haupt # License: GPLv2 # --- /usr/local/sbin/vpnc-script.orig 2013-01-22 16:13:59.000000000 +0100 +++ /usr/local/sbin/vpnc-script 2013-01-22 16:14:02.000000000 +0100 @@ -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,9 +198,12 @@ 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,9 +596,13 @@ 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 kldload if_tun