--- hanstunnel/Makefile 2015-02-10 12:03:45.477601412 +0000 +++ hanstunnel/Makefile 2015-02-10 12:03:00.000000000 +0000 @@ -1,43 +1,41 @@ # Created by: Alexander Panyushkin -# $FreeBSD: head/net/hanstunnel/Makefile 346721 2014-03-01 21:23:14Z gerald $ +# $FreeBSD$ PORTNAME= hans -PORTVERSION= 0.4.1 -PORTREVISION= 1 +PORTVERSION= 0.4.4 +PORTREVISION?= 2 CATEGORIES= net security -MASTER_SITES= SF/hanstunnel/source +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} +MASTER_SITE_SUBDIR= /hanstunnel/source/ MAINTAINER= vsityz@gmail.com COMMENT= Hans makes it possible to tunnel IPv4 through ICMP LICENSE= GPLv3 -OPTIONS_DEFINE= CLANG - -CLANG_DESC= Build with Clang instead of GCC - +OPTIONS_DEFINE= CLANG +CLANG_DESC= Build with Clang instead of GCC OPTIONS_DEFAULT= CLANG -PLIST_FILES= bin/hans - -SUB_FILES= pkg-message +PLIST_FILES= ${LOCALBASE}/bin/hans .include .if ${PORT_OPTIONS:MCLANG} -.if ${OSVERSION} >= 900033 && exists(/usr/bin/clang) -CC= clang -CXX= clang++ +.if ${OSVERSION} >= 900014 && exists(/usr/bin/clang) +CC= clang +CXX= clang++ .else -BUILD_DEPENDS+= clang33:${PORTSDIR}/lang/clang33 -CC= clang33 -CXX= clang++33 +USE_GCC?= any .endif -.else -USE_GCC= any .endif do-install: - ${INSTALL_PROGRAM} ${WRKSRC}/hans ${STAGEDIR}${LOCALBASE}/bin + ${INSTALL_PROGRAM} ${WRKSRC}/hans ${STAGEDIR}${PREFIX}/bin/hans + +post-install: .SILENT + ${ECHO_MSG} + ${CAT} ${PKGMESSAGE} + ${ECHO_MSG} .include --- hanstunnel/distinfo 2015-02-10 12:03:45.477601412 +0000 +++ hanstunnel/distinfo 2014-11-22 20:50:00.000000000 +0000 @@ -1,2 +1,2 @@ -SHA256 (hans-0.4.1.tar.gz) = 8e4df005bcf6a877ffd0810cc9b31aa3ae04f23d798bea6cc2893a3f26cac29c -SIZE (hans-0.4.1.tar.gz) = 32860 +SHA256 (hans-0.4.4.tar.gz) = 81378258b8c9510ac01ad4d69f191e2927b9304daae033ee097f6ba4d39f6bb3 +SIZE (hans-0.4.4.tar.gz) = 33992 --- hanstunnel/files/patch-Makefile 2015-02-10 12:03:45.477601412 +0000 +++ hanstunnel/files/patch-Makefile 2014-11-22 17:50:00.000000000 +0000 @@ -1,73 +1,75 @@ ---- Makefile.orig 2010-02-17 17:30:21.000000000 +0200 -+++ Makefile 2013-04-04 15:18:50.818219413 +0300 -@@ -1,53 +1,51 @@ +--- Makefile.orig 2014-11-22 17:46:35.000000000 +0200 ++++ Makefile 2014-11-22 17:49:13.000000000 +0200 +@@ -1,8 +1,6 @@ -LDFLAGS = `sh osflags ld $(MODE)` -CFLAGS = -c -g `sh osflags c $(MODE)` -TUN_DEV_FILE = `sh osflags dev $(MODE)` -GCC = gcc -GPP = g++ -+TUN_DEV_FILE = tun_dev_freebsd.c ++TUN_DEV_FILE = src/tun_dev_freebsd.c +GCC = ${CC} +GPP = ${CXX} - all: hans + .PHONY: directories - hans: tun.o sha1.o main.o client.o server.o auth.o worker.o time.o tun_dev.o echo.o exception.o utility.o -- $(GPP) -o hans tun.o sha1.o main.o client.o server.o auth.o worker.o time.o tun_dev.o echo.o exception.o utility.o $(LDFLAGS) -+ ${GPP} -o hans tun.o sha1.o main.o client.o server.o auth.o worker.o time.o tun_dev.o echo.o exception.o utility.o ${LDFLAGS} - - utility.o: utility.cpp utility.h -- $(GPP) -c utility.cpp $(CFLAGS) -+ ${GPP} -c utility.cpp ${CFLAGS} - - exception.o: exception.cpp exception.h -- $(GPP) -c exception.cpp $(CFLAGS) -+ ${GPP} -c exception.cpp ${CFLAGS} - - echo.o: echo.cpp echo.h exception.h -- $(GPP) -c echo.cpp $(CFLAGS) -+ ${GPP} -c echo.cpp ${CFLAGS} - - tun.o: tun.cpp tun.h exception.h utility.h tun_dev.h -- $(GPP) -c tun.cpp $(CFLAGS) -+ ${GPP} -c tun.cpp ${CFLAGS} - - tun_dev.o: -- $(GCC) -c $(TUN_DEV_FILE) -o tun_dev.o $(CFLAGS) -+ ${GCC} -c ${TUN_DEV_FILE} -o tun_dev.o ${CFLAGS} - - sha1.o: sha1.cpp sha1.h -- $(GPP) -c sha1.cpp $(CFLAGS) -+ ${GPP} -c sha1.cpp ${CFLAGS} - - main.o: main.cpp client.h server.h exception.h worker.h auth.h time.h echo.h tun.h tun_dev.h -- $(GPP) -c main.cpp $(CFLAGS) -+ ${GPP} -c main.cpp ${CFLAGS} - - client.o: client.cpp client.h server.h exception.h config.h worker.h auth.h time.h echo.h tun.h tun_dev.h -- $(GPP) -c client.cpp $(CFLAGS) -+ ${GPP} -c client.cpp ${CFLAGS} - - server.o: server.cpp server.h client.h utility.h config.h worker.h auth.h time.h echo.h tun.h tun_dev.h -- $(GPP) -c server.cpp $(CFLAGS) -+ ${GPP} -c server.cpp ${CFLAGS} - - auth.o: auth.cpp auth.h sha1.h utility.h -- $(GPP) -c auth.cpp $(CFLAGS) -+ ${GPP} -c auth.cpp ${CFLAGS} - - worker.o: worker.cpp worker.h tun.h exception.h time.h echo.h tun_dev.h config.h -- $(GPP) -c worker.cpp $(CFLAGS) -+ ${GPP} -c worker.cpp ${CFLAGS} - - time.o: time.cpp time.h -- $(GPP) -c time.cpp $(CFLAGS) -+ ${GPP} -c time.cpp ${CFLAGS} +@@ -16,46 +14,46 @@ + tunemu.o: directories build/tunemu.o - clean: - rm -f tun.o sha1.o main.o client.o server.o auth.o worker.o time.o tun_dev.o echo.o exception.o utility.o tunemu.o hans + hans: build/tun.o build/sha1.o build/main.o build/client.o build/server.o build/auth.o build/worker.o build/time.o build/tun_dev.o build/echo.o build/exception.o build/utility.o +- $(GPP) -o hans build/tun.o build/sha1.o build/main.o build/client.o build/server.o build/auth.o build/worker.o build/time.o build/tun_dev.o build/echo.o build/exception.o build/utility.o $(LDFLAGS) ++ ${GPP} -o hans build/tun.o build/sha1.o build/main.o build/client.o build/server.o build/auth.o build/worker.o build/time.o build/tun_dev.o build/echo.o build/exception.o build/utility.o $(LDFLAGS) + + build/utility.o: src/utility.cpp src/utility.h +- $(GPP) -c src/utility.cpp -o $@ -o $@ $(CFLAGS) ++ ${GPP} -c src/utility.cpp -o $@ -o $@ ${CFLAGS} + + build/exception.o: src/exception.cpp src/exception.h +- $(GPP) -c src/exception.cpp -o $@ $(CFLAGS) ++ ${GPP} -c src/exception.cpp -o $@ ${CFLAGS} + + build/echo.o: src/echo.cpp src/echo.h src/exception.h +- $(GPP) -c src/echo.cpp -o $@ $(CFLAGS) ++ ${GPP} -c src/echo.cpp -o $@ ${CFLAGS} + + build/tun.o: src/tun.cpp src/tun.h src/exception.h src/utility.h src/tun_dev.h +- $(GPP) -c src/tun.cpp -o $@ $(CFLAGS) ++ ${GPP} -c src/tun.cpp -o $@ ${CFLAGS} + + build/tun_dev.o: +- $(GCC) -c $(TUN_DEV_FILE) -o build/tun_dev.o -o $@ $(CFLAGS) ++ ${GCC} -c ${TUN_DEV_FILE} -o build/tun_dev.o -o $@ ${CFLAGS} + + build/sha1.o: src/sha1.cpp src/sha1.h +- $(GPP) -c src/sha1.cpp -o $@ $(CFLAGS) ++ ${GPP} -c src/sha1.cpp -o $@ ${CFLAGS} + + build/main.o: src/main.cpp src/client.h src/server.h src/exception.h src/worker.h src/auth.h src/time.h src/echo.h src/tun.h src/tun_dev.h +- $(GPP) -c src/main.cpp -o $@ $(CFLAGS) ++ ${GPP} -c src/main.cpp -o $@ ${CFLAGS} + + build/client.o: src/client.cpp src/client.h src/server.h src/exception.h src/config.h src/worker.h src/auth.h src/time.h src/echo.h src/tun.h src/tun_dev.h +- $(GPP) -c src/client.cpp -o $@ $(CFLAGS) ++ ${GPP} -c src/client.cpp -o $@ ${CFLAGS} + + build/server.o: src/server.cpp src/server.h src/client.h src/utility.h src/config.h src/worker.h src/auth.h src/time.h src/echo.h src/tun.h src/tun_dev.h +- $(GPP) -c src/server.cpp -o $@ $(CFLAGS) ++ ${GPP} -c src/server.cpp -o $@ ${CFLAGS} + + build/auth.o: src/auth.cpp src/auth.h src/sha1.h src/utility.h +- $(GPP) -c src/auth.cpp -o $@ $(CFLAGS) ++ ${GPP} -c src/auth.cpp -o $@ ${CFLAGS} + + build/worker.o: src/worker.cpp src/worker.h src/tun.h src/exception.h src/time.h src/echo.h src/tun_dev.h src/config.h +- $(GPP) -c src/worker.cpp -o $@ $(CFLAGS) ++ ${GPP} -c src/worker.cpp -o $@ ${CFLAGS} + + build/time.o: src/time.cpp src/time.h +- $(GPP) -c src/time.cpp -o $@ $(CFLAGS) ++ ${GPP} -c src/time.cpp -o $@ ${CFLAGS} + clean: + rm -rf build hans - tunemu.o: tunemu.h tunemu.c -- $(GCC) -c tunemu.c -o tunemu.o -+ ${GCC} -c tunemu.c -o tunemu.o + build/tunemu.o: src/tunemu.h src/tunemu.c +- $(GCC) -c src/tunemu.c -o build/tunemu.o ++ ${GCC} -c src/tunemu.c -o build/tunemu.o --- hanstunnel/files/patch-client.cpp 2015-02-10 12:03:45.477601412 +0000 +++ hanstunnel/files/patch-client.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---- client.cpp.orig 2010-02-17 17:30:21.000000000 +0200 -+++ client.cpp 2013-04-03 16:05:10.000000000 +0300 -@@ -27,6 +27,8 @@ - #include - #include - -+#include -+ - using namespace std; - - const Worker::TunnelHeader::Magic Client::magic("hanc"); --- hanstunnel/files/patch-echo.cpp 2015-02-10 12:03:45.477601412 +0000 +++ hanstunnel/files/patch-echo.cpp 2014-11-22 17:53:00.000000000 +0000 @@ -1,9 +1,10 @@ ---- echo.cpp.orig 2014-08-06 10:11:40.000000000 -0400 -+++ echo.cpp 2014-08-06 10:11:56.000000000 -0400 -@@ -20,6 +20,7 @@ +--- src/echo.cpp.orig 2014-11-22 17:51:42.000000000 +0200 ++++ src/echo.cpp 2014-11-22 17:51:46.000000000 +0200 +@@ -19,7 +19,7 @@ + #include "echo.h" #include "exception.h" - +- +#include #include #include --- hanstunnel/files/patch-main.cpp 2015-02-10 12:03:45.477601412 +0000 +++ hanstunnel/files/patch-main.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ ---- main.cpp.orig 2014-08-06 10:11:00.000000000 -0400 -+++ main.cpp 2014-08-06 10:11:12.000000000 -0400 -@@ -30,6 +30,7 @@ - #include - #include - #include -+#include - - void usage() - { --- hanstunnel/files/patch-tun.cpp 2015-02-10 12:03:45.477601412 +0000 +++ hanstunnel/files/patch-tun.cpp 2014-11-22 17:32:00.000000000 +0000 @@ -1,44 +1,35 @@ ---- tun.cpp.orig 2010-02-17 10:30:21.000000000 -0500 -+++ tun.cpp 2014-08-06 10:10:51.000000000 -0400 -@@ -21,6 +21,7 @@ +--- src/tun.cpp.orig 2014-02-07 05:36:31.000000000 +0200 ++++ src/tun.cpp 2014-11-22 17:31:16.000000000 +0200 +@@ -20,7 +20,7 @@ + #include "tun.h" #include "exception.h" #include "utility.h" - +- +#include #include #include #include -@@ -41,8 +42,7 @@ - - if (device != NULL) - { -- strncpy(this->device, device, VTUN_DEV_LEN); -- this->device[VTUN_DEV_LEN] = 0; -+ strlcpy(this->device, device, VTUN_DEV_LEN); - } - else - this->device[0] = 0; -@@ -68,23 +68,17 @@ - string ips = Utility::formatIp(ip); - string destIps = Utility::formatIp(destIp); +@@ -69,23 +69,17 @@ + string ips = Utility::formatIp(ip); + string destIps = Utility::formatIp(destIp); -#ifdef LINUX -- snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s netmask 255.255.255.0", device, ips.c_str()); +- snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s netmask 255.255.255.0", device, ips.c_str()); -#else -- snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.255", device, ips.c_str(), destIps.c_str()); +- snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.255", device, ips.c_str(), destIps.c_str()); -#endif -+ snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.0", device, ips.c_str(), destIps.c_str()); ++ snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.0", device, ips.c_str(), destIps.c_str()); - if (system(cmdline) != 0) - syslog(LOG_ERR, "could not set tun device ip address"); + if (system(cmdline) != 0) + syslog(LOG_ERR, "could not set tun device ip address"); -#ifndef LINUX - if (includeSubnet) - { - snprintf(cmdline, sizeof(cmdline), "/sbin/route add %s/24 %s", destIps.c_str(), destIps.c_str()); - if (system(cmdline) != 0) - syslog(LOG_ERR, "could not add route"); - } + if (includeSubnet) + { + snprintf(cmdline, sizeof(cmdline), "/sbin/route add %s/24 %s", destIps.c_str(), destIps.c_str()); + if (system(cmdline) != 0) + syslog(LOG_ERR, "could not add route"); + } -#endif } --- hanstunnel/files/patch-utility.cpp 2015-02-10 12:03:45.477601412 +0000 +++ hanstunnel/files/patch-utility.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ ---- utility.cpp.orig 2014-08-06 10:12:15.000000000 -0400 -+++ utility.cpp 2014-08-06 10:12:30.000000000 -0400 -@@ -21,6 +21,7 @@ - - #include - #include -+#include - - using namespace std; - --- hanstunnel/files/pkg-message.in 2015-02-10 12:03:45.477601412 +0000 +++ hanstunnel/files/pkg-message.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ ------------------------------------------------------------- - -Hans runs on Linux as a client and a server. -It runs on FreeBSD client only. - -NOTE: that Hans can not receive echo requests on BSD systems. -Therefore the server only works on Linux. - ------------------------------------------------------------- - -### Running as a server ### - -% hans -s 10.1.2.0 -r -p password -u nobody - -### Running as a client ### - -% hans -c server_address -p password -u nobody - -### Help ### - -% hans - ------------------------------------------------------------- --- hanstunnel/pkg-descr 2015-02-10 12:03:45.477601412 +0000 +++ hanstunnel/pkg-descr 2014-11-23 22:38:00.000000000 +0000 @@ -3,4 +3,8 @@ in the situation that your Internet access is firewalled, but pings are allowed. +Hans runs on Linux as a client and a server. It runs on Mac OS X, +iPhone/iPod touch, FreeBSD and OpenBSD as a client only. + + WWW: http://code.gerade.org/hans/ --- hanstunnel/pkg-message 1970-01-01 00:00:00.000000000 +0000 +++ hanstunnel/pkg-message 2014-11-22 15:51:00.000000000 +0000 @@ -0,0 +1,23 @@ +------------------------------------------------------------ + +Hans runs on Linux as a client and a server. +It runs on FreeBSD client only. + +NOTE: that Hans can not receive echo requests on BSD systems. +Therefore the server only works on Linux. + +------------------------------------------------------------ + +### Running as a server ### + +% hans -s 10.1.2.0 -r -p password -u nobody + +### Running as a client ### + +% hans -c server_address -p password -u nobody + +### Help ### + +% hans + +------------------------------------------------------------