Mercurial > hg > quicktun
changeset 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 |
files | build.sh src/common.c |
diffstat | 2 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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;