aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/Makefile1
-rw-r--r--net/hanstunnel/Makefile48
-rw-r--r--net/hanstunnel/distinfo2
-rw-r--r--net/hanstunnel/files/patch-Makefile73
-rw-r--r--net/hanstunnel/files/patch-client.cpp11
-rw-r--r--net/hanstunnel/files/patch-tun.cpp27
-rw-r--r--net/hanstunnel/pkg-descr6
-rw-r--r--net/hanstunnel/pkg-message23
8 files changed, 191 insertions, 0 deletions
diff --git a/net/Makefile b/net/Makefile
index 4e39f8b4a3e2..d57e26dab5bc 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -206,6 +206,7 @@
SUBDIR += gupnp-ui
SUBDIR += gutenfetch
SUBDIR += gwhois
+ SUBDIR += hanstunnel
SUBDIR += haproxy
SUBDIR += haproxy-devel
SUBDIR += hawknl
diff --git a/net/hanstunnel/Makefile b/net/hanstunnel/Makefile
new file mode 100644
index 000000000000..1f3b74cece3c
--- /dev/null
+++ b/net/hanstunnel/Makefile
@@ -0,0 +1,48 @@
+# Created by: Alexander Panyushkin <vsityz@gmail.com>
+# $FreeBSD$
+
+PORTNAME= hans
+PORTVERSION= 0.4.1
+CATEGORIES= net security
+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_PERMS_GPL3= yes
+
+OPTIONS_DEFINE= CLANG
+
+CLANG_DESC= Build with Clang instead of GCC
+
+OPTIONS_DEFAULT= CLANG
+
+PLIST_FILES= bin/hans
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MCLANG}
+.if ${OSVERSION} < 1000000
+CC=clang
+CXX=clang++
+.if ${OSVERSION} < 900033
+BUILD_DEPENDS+= clang:${PORTSDIR}/lang/clang
+.endif
+.endif
+.else
+USE_GCC=4.2+
+CC=gcc
+CXX=g++
+CPP=gcpp
+.endif
+
+do-install:
+ @${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} ${WRKSRC}/hans ${LOCALBASE}/bin
+
+post-install: .SILENT
+ ${ECHO_MSG}
+ ${CAT} ${PKGMESSAGE}
+ ${ECHO_MSG}
+
+.include <bsd.port.mk>
diff --git a/net/hanstunnel/distinfo b/net/hanstunnel/distinfo
new file mode 100644
index 000000000000..639a5ccbbbd4
--- /dev/null
+++ b/net/hanstunnel/distinfo
@@ -0,0 +1,2 @@
+SHA256 (hans-0.4.1.tar.gz) = 8e4df005bcf6a877ffd0810cc9b31aa3ae04f23d798bea6cc2893a3f26cac29c
+SIZE (hans-0.4.1.tar.gz) = 32860
diff --git a/net/hanstunnel/files/patch-Makefile b/net/hanstunnel/files/patch-Makefile
new file mode 100644
index 000000000000..747d9e5d4b7f
--- /dev/null
+++ b/net/hanstunnel/files/patch-Makefile
@@ -0,0 +1,73 @@
+--- Makefile.orig 2010-02-17 17:30:21.000000000 +0200
++++ Makefile 2013-04-04 15:18:50.818219413 +0300
+@@ -1,53 +1,51 @@
+-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
++GCC = ${CC}
++GPP = ${CXX}
+
+ all: hans
+
+ 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}
+
+ 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
+
+
+ tunemu.o: tunemu.h tunemu.c
+- $(GCC) -c tunemu.c -o tunemu.o
++ ${GCC} -c tunemu.c -o tunemu.o
diff --git a/net/hanstunnel/files/patch-client.cpp b/net/hanstunnel/files/patch-client.cpp
new file mode 100644
index 000000000000..16a57a6261ae
--- /dev/null
+++ b/net/hanstunnel/files/patch-client.cpp
@@ -0,0 +1,11 @@
+--- 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 <arpa/inet.h>
+ #include <syslog.h>
+
++#include <netinet/in.h>
++
+ using namespace std;
+
+ const Worker::TunnelHeader::Magic Client::magic("hanc");
diff --git a/net/hanstunnel/files/patch-tun.cpp b/net/hanstunnel/files/patch-tun.cpp
new file mode 100644
index 000000000000..b97e93709373
--- /dev/null
+++ b/net/hanstunnel/files/patch-tun.cpp
@@ -0,0 +1,27 @@
+--- tun.cpp.orig 2010-02-17 17:30:21.000000000 +0200
++++ tun.cpp 2013-04-04 16:55:39.802818893 +0300
+@@ -68,23 +68,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());
+-#else
+- 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());
+
+ 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");
+ }
+-#endif
+ }
+
+ void Tun::write(const char *buffer, int length)
diff --git a/net/hanstunnel/pkg-descr b/net/hanstunnel/pkg-descr
new file mode 100644
index 000000000000..74316b5f115f
--- /dev/null
+++ b/net/hanstunnel/pkg-descr
@@ -0,0 +1,6 @@
+Hans makes it possible to tunnel IPv4 through ICMP echo packets, so you
+could call it a ping tunnel. This can be useful when you find yourself
+in the situation that your Internet access is firewalled, but pings are
+allowed.
+
+WWW: http://code.gerade.org/hans/
diff --git a/net/hanstunnel/pkg-message b/net/hanstunnel/pkg-message
new file mode 100644
index 000000000000..023661b7b432
--- /dev/null
+++ b/net/hanstunnel/pkg-message
@@ -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
+
+------------------------------------------------------------