comparison src/common.c @ 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
comparison
equal deleted inserted replaced
32:51c6d2fc712f 33:422f3582bd38
174 if (ioctl(if_fd, IF_UNITSEL, (char *)&ppa) < 0) return errorexitp("Could not set PPA"); 174 if (ioctl(if_fd, IF_UNITSEL, (char *)&ppa) < 0) return errorexitp("Could not set PPA");
175 if (ioctl(ip_fd, I_LINK, if_fd) < 0) return errorexitp("Could not link TUN device to IP"); 175 if (ioctl(ip_fd, I_LINK, if_fd) < 0) return errorexitp("Could not link TUN device to IP");
176 #else 176 #else
177 if (!(envval = getconf("INTERFACE"))) envval = "/dev/tun0"; 177 if (!(envval = getconf("INTERFACE"))) envval = "/dev/tun0";
178 if ((ttfd = open(envval, O_RDWR)) < 0) return errorexitp("Could not open tun device file"); 178 if ((ttfd = open(envval, O_RDWR)) < 0) return errorexitp("Could not open tun device file");
179 if ((envval = getconf("TUN_MODE")) && atoi(envval)) {
180 int i = IFF_POINTOPOINT | IFF_MULTICAST;
181 ioctl(tt->fd, TUNSIFMODE, &i);
182 i = 1;
183 ioctl(tt->fd, TUNSIFHEAD, &i);
184 }
179 #endif 185 #endif
180 return ttfd; 186 return ttfd;
181 } 187 }
182 188
183 void hex2bin(unsigned char* dest, unsigned char* src, int count) { 189 void hex2bin(unsigned char* dest, unsigned char* src, int count) {