diff src/common.c @ 34:b876afa5a72a

Fixed the build script and FreeBSD tun mode
author Ivo Smits <Ivo@UCIS.nl>
date Wed, 12 Oct 2011 03:47:18 +0200
parents 422f3582bd38
children a1ec0d6b6f13
line wrap: on
line diff
--- a/src/common.c	Wed Oct 12 01:35:45 2011 +0200
+++ b/src/common.c	Wed Oct 12 03:47:18 2011 +0200
@@ -178,9 +178,13 @@
 	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);
+		ioctl(ttfd, TUNSIFMODE, &i);
+		if ((envval = getconf("USE_PI")) && atoi(envval)) {
+			i = 1;
+		} else {
+			i = 0;
+		}
+		ioctl(ttfd, TUNSIFHEAD, &i);
 	}
 #endif
 	return ttfd;