changeset 33:422f3582bd38

Possible fix for tun mode on FreeBSD
author Ivo Smits <Ivo@UCIS.nl>
date Wed, 12 Oct 2011 01:35:45 +0200
parents 51c6d2fc712f
children b876afa5a72a
files src/common.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/common.c	Wed Oct 12 01:34:46 2011 +0200
+++ b/src/common.c	Wed Oct 12 01:35:45 2011 +0200
@@ -176,6 +176,12 @@
 #else
 	if (!(envval = getconf("INTERFACE"))) envval = "/dev/tun0";
 	if ((ttfd = open(envval, O_RDWR)) < 0) return errorexitp("Could not open tun device file");
+	if ((envval = getconf("TUN_MODE")) && atoi(envval)) {
+		int i = IFF_POINTOPOINT | IFF_MULTICAST;
+		ioctl(tt->fd, TUNSIFMODE, &i);
+		i = 1;
+		ioctl(tt->fd, TUNSIFHEAD, &i);
+	}
 #endif
 	return ttfd;
 }