# HG changeset patch # User Ivo Smits # Date 1318384038 -7200 # Node ID b876afa5a72aacdd808b97773ba9ab64d9912cc6 # Parent 422f3582bd38c8323a95551070eea4c6bb57b5c4 Fixed the build script and FreeBSD tun mode diff -r 422f3582bd38 -r b876afa5a72a build.sh --- a/build.sh Wed Oct 12 01:35:45 2011 +0200 +++ b/build.sh Wed Oct 12 03:47:18 2011 +0200 @@ -39,14 +39,15 @@ (wget -q -O- "${NACLURL}" || curl -q "${NACLURL}") | bunzip2 | $tar -xf - --strip-components 1 ./do cd ../../ - ABI=`tmp/nacl/build/*/bin/okabi | head -n 1` - cp "tmp/nacl/build/*/lib/${ABI}/libnacl.a" lib/ - cp "tmp/nacl/build/*/include/${ABI}/crypto_box_curve25519xsalsa20poly1305.h" include/ - cp "tmp/nacl/build/*/include/${ABI}/crypto_scalarmult_curve25519.h" include/ + NACLDIR="tmp/nacl/build/`hostname | sed 's/\..*//' | tr -cd '[a-z][A-Z][0-9]'`" + ABI=`"${NACLDIR}/bin/okabi" | head -n 1` + cp "${NACLDIR}/lib/${ABI}/libnacl.a" lib/ + cp "${NACLDIR}/include/${ABI}/crypto_box_curve25519xsalsa20poly1305.h" include/ + cp "${NACLDIR}/include/${ABI}/crypto_scalarmult_curve25519.h" include/ echo Done. fi export CPATH="./include/:${CPATH}" - export LIBRARY_PATH="/usr/local/lib/:./lib/:${LIBRARY_PATH}" + export LIBRARY_PATH="./lib/:${LIBRARY_PATH}" else echo Using shared NaCl library. export CPATH="/usr/include/nacl/:${CPATH}" @@ -78,4 +79,3 @@ fi fi -rm -rf obj tmp diff -r 422f3582bd38 -r b876afa5a72a src/common.c --- 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;