View | Details | Raw Unified | Return to bug 195313 | Differences between
and this patch

Collapse All | Expand All

(-)net/hanstunnel/Makefile (-26 / +14 lines)
Lines 2-9 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	hans
4
PORTNAME=	hans
5
PORTVERSION=	0.4.1
5
PORTVERSION=	0.4.4
6
PORTREVISION=	1
7
CATEGORIES=	net security
6
CATEGORIES=	net security
8
MASTER_SITES=	SF/hanstunnel/source
7
MASTER_SITES=	SF/hanstunnel/source
9
8
Lines 10-43 MASTER_SITES= SF/hanstunnel/source Link Here
10
MAINTAINER=	vsityz@gmail.com
9
MAINTAINER=	vsityz@gmail.com
11
COMMENT=	Hans makes it possible to tunnel IPv4 through ICMP
10
COMMENT=	Hans makes it possible to tunnel IPv4 through ICMP
12
11
13
LICENSE=	GPLv3
12
LICENSE=	FPL GPLv3 # or any later version
13
LICENSE_COMB=	multi
14
LICENSE_NAME_FPL=Freeware Public License
15
LICENSE_FILE_FPL=${WRKSRC}/src/sha1_license.txt
16
LICENSE_PERMS_FPL=dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
14
17
15
OPTIONS_DEFINE=	CLANG
18
USES=		dos2unix
16
19
DOS2UNIX_FILES=	${LICENSE_FILE_FPL}
17
CLANG_DESC=	Build with Clang instead of GCC
20
MAKE_ARGS=	GCC="${CC}" GPP="${CXX}" \
18
21
		CFLAGS="${CFLAGS} -c" LDFLAGS="${LDFLAGS}" \
19
OPTIONS_DEFAULT=	CLANG
22
		TUN_DEV_FILE="src/tun_dev_freebsd.c"
20
21
PLIST_FILES=	bin/hans
23
PLIST_FILES=	bin/hans
22
24
23
SUB_FILES=	pkg-message
25
# Remove CRs before ask-license to fix formatting in dialog(1)
26
post-extract:	dos2unix
24
27
25
.include <bsd.port.options.mk>
26
27
.if ${PORT_OPTIONS:MCLANG}
28
.if ${OSVERSION} >= 900033 && exists(/usr/bin/clang)
29
CC=		clang
30
CXX=		clang++
31
.else
32
BUILD_DEPENDS+=	clang33:${PORTSDIR}/lang/clang33
33
CC=		clang33
34
CXX=		clang++33
35
.endif
36
.else
37
USE_GCC=	any
38
.endif
39
40
do-install:
28
do-install:
41
	${INSTALL_PROGRAM} ${WRKSRC}/hans ${STAGEDIR}${LOCALBASE}/bin
29
	${INSTALL_PROGRAM} ${WRKSRC}/hans ${STAGEDIR}${PREFIX}/bin
42
30
43
.include <bsd.port.mk>
31
.include <bsd.port.mk>
(-)net/hanstunnel/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (hans-0.4.1.tar.gz) = 8e4df005bcf6a877ffd0810cc9b31aa3ae04f23d798bea6cc2893a3f26cac29c
1
SHA256 (hans-0.4.4.tar.gz) = 81378258b8c9510ac01ad4d69f191e2927b9304daae033ee097f6ba4d39f6bb3
2
SIZE (hans-0.4.1.tar.gz) = 32860
2
SIZE (hans-0.4.4.tar.gz) = 33992
(-)net/hanstunnel/files/patch-Makefile (-73 lines)
Lines 1-73 Link Here
1
--- Makefile.orig	2010-02-17 17:30:21.000000000 +0200
2
+++ Makefile	2013-04-04 15:18:50.818219413 +0300
3
@@ -1,53 +1,51 @@
4
-LDFLAGS = `sh osflags ld $(MODE)`
5
-CFLAGS = -c -g `sh osflags c $(MODE)`
6
-TUN_DEV_FILE = `sh osflags dev $(MODE)`
7
-GCC = gcc
8
-GPP = g++
9
+TUN_DEV_FILE = tun_dev_freebsd.c
10
+GCC = ${CC}
11
+GPP = ${CXX}
12
 
13
 all: hans
14
 
15
 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
16
-	$(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)
17
+	${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}
18
 
19
 utility.o: utility.cpp utility.h
20
-	$(GPP) -c utility.cpp $(CFLAGS)
21
+	${GPP} -c utility.cpp ${CFLAGS}
22
 
23
 exception.o: exception.cpp exception.h
24
-	$(GPP) -c exception.cpp $(CFLAGS)
25
+	${GPP} -c exception.cpp ${CFLAGS}
26
 
27
 echo.o: echo.cpp echo.h exception.h
28
-	$(GPP) -c echo.cpp $(CFLAGS)
29
+	${GPP} -c echo.cpp ${CFLAGS}
30
 
31
 tun.o: tun.cpp tun.h exception.h utility.h tun_dev.h
32
-	$(GPP) -c tun.cpp $(CFLAGS)
33
+	${GPP} -c tun.cpp ${CFLAGS}
34
 
35
 tun_dev.o:
36
-	$(GCC) -c $(TUN_DEV_FILE) -o tun_dev.o $(CFLAGS)
37
+	${GCC} -c ${TUN_DEV_FILE} -o tun_dev.o ${CFLAGS}
38
 
39
 sha1.o: sha1.cpp sha1.h
40
-	$(GPP) -c sha1.cpp $(CFLAGS)
41
+	${GPP} -c sha1.cpp ${CFLAGS}
42
 
43
 main.o: main.cpp client.h server.h exception.h worker.h auth.h time.h echo.h tun.h tun_dev.h
44
-	$(GPP) -c main.cpp $(CFLAGS)
45
+	${GPP} -c main.cpp ${CFLAGS}
46
 
47
 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
48
-	$(GPP) -c client.cpp $(CFLAGS)
49
+	${GPP} -c client.cpp ${CFLAGS}
50
 
51
 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
52
-	$(GPP) -c server.cpp $(CFLAGS)
53
+	${GPP} -c server.cpp ${CFLAGS}
54
 
55
 auth.o: auth.cpp auth.h sha1.h utility.h
56
-	$(GPP) -c auth.cpp $(CFLAGS)
57
+	${GPP} -c auth.cpp ${CFLAGS}
58
 
59
 worker.o: worker.cpp worker.h tun.h exception.h time.h echo.h tun_dev.h config.h
60
-	$(GPP) -c worker.cpp $(CFLAGS)
61
+	${GPP} -c worker.cpp ${CFLAGS}
62
 
63
 time.o: time.cpp time.h
64
-	$(GPP) -c time.cpp $(CFLAGS)
65
+	${GPP} -c time.cpp ${CFLAGS}
66
 
67
 clean:
68
 	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
69
 
70
 
71
 tunemu.o: tunemu.h tunemu.c
72
-	$(GCC) -c tunemu.c -o tunemu.o
73
+	${GCC} -c tunemu.c -o tunemu.o
(-)net/hanstunnel/files/patch-client.cpp (-11 lines)
Lines 1-11 Link Here
1
--- client.cpp.orig	2010-02-17 17:30:21.000000000 +0200
2
+++ client.cpp	2013-04-03 16:05:10.000000000 +0300
3
@@ -27,6 +27,8 @@
4
 #include <arpa/inet.h>
5
 #include <syslog.h>
6
 
7
+#include <netinet/in.h>
8
+
9
 using namespace std;
10
 
11
 const Worker::TunnelHeader::Magic Client::magic("hanc");
(-)net/hanstunnel/files/patch-echo.cpp (-10 lines)
Lines 1-10 Link Here
1
--- echo.cpp.orig	2014-08-06 10:11:40.000000000 -0400
2
+++ echo.cpp	2014-08-06 10:11:56.000000000 -0400
3
@@ -20,6 +20,7 @@
4
 #include "echo.h"
5
 #include "exception.h"
6
 
7
+#include <sys/types.h>
8
 #include <sys/socket.h>
9
 #include <netinet/in_systm.h>
10
 #include <netinet/in.h>
(-)net/hanstunnel/files/patch-main.cpp (-10 lines)
Lines 1-10 Link Here
1
--- main.cpp.orig	2014-08-06 10:11:00.000000000 -0400
2
+++ main.cpp	2014-08-06 10:11:12.000000000 -0400
3
@@ -30,6 +30,7 @@
4
 #include <stdlib.h>
5
 #include <errno.h>
6
 #include <syslog.h>
7
+#include <unistd.h>
8
 
9
 void usage()
10
 {
(-)net/hanstunnel/files/patch-src_echo.cpp (-4 / +5 lines)
Lines 1-9 Link Here
1
--- echo.cpp.orig	2014-08-06 10:11:40.000000000 -0400
1
--- src/echo.cpp.orig	2014-02-07 03:36:31 UTC
2
+++ echo.cpp	2014-08-06 10:11:56.000000000 -0400
2
+++ src/echo.cpp
3
@@ -20,6 +20,7 @@
3
@@ -19,7 +19,7 @@
4
 
4
 #include "echo.h"
5
 #include "echo.h"
5
 #include "exception.h"
6
 #include "exception.h"
6
 
7
-
7
+#include <sys/types.h>
8
+#include <sys/types.h>
8
 #include <sys/socket.h>
9
 #include <sys/socket.h>
9
 #include <netinet/in_systm.h>
10
 #include <netinet/in_systm.h>
(-)net/hanstunnel/files/patch-src_tun.cpp (-39 / +5 lines)
Lines 1-45 Link Here
1
--- tun.cpp.orig	2010-02-17 10:30:21.000000000 -0500
1
--- src/tun.cpp.orig	2014-02-07 03:36:31 UTC
2
+++ tun.cpp	2014-08-06 10:10:51.000000000 -0400
2
+++ src/tun.cpp
3
@@ -21,6 +21,7 @@
3
@@ -20,7 +20,7 @@
4
 #include "tun.h"
4
 #include "exception.h"
5
 #include "exception.h"
5
 #include "utility.h"
6
 #include "utility.h"
6
 
7
-
7
+#include <sys/types.h>
8
+#include <sys/types.h>
8
 #include <arpa/inet.h>
9
 #include <arpa/inet.h>
9
 #include <netinet/in_systm.h>
10
 #include <netinet/in_systm.h>
10
 #include <netinet/in.h>
11
 #include <netinet/in.h>
11
@@ -41,8 +42,7 @@
12
 
13
 	if (device != NULL)
14
 	{
15
-		strncpy(this->device, device, VTUN_DEV_LEN);
16
-		this->device[VTUN_DEV_LEN] = 0;
17
+		strlcpy(this->device, device, VTUN_DEV_LEN);
18
 	}
19
 	else
20
 		this->device[0] = 0;
21
@@ -68,23 +68,17 @@
22
 	string ips = Utility::formatIp(ip);
23
 	string destIps = Utility::formatIp(destIp);
24
 
25
-#ifdef LINUX
26
-	snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s netmask 255.255.255.0", device, ips.c_str());
27
-#else
28
-	snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.255", device, ips.c_str(), destIps.c_str());
29
-#endif
30
+	snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.0", device, ips.c_str(), destIps.c_str());
31
 
32
 	if (system(cmdline) != 0)
33
 		syslog(LOG_ERR, "could not set tun device ip address");
34
 
35
-#ifndef LINUX
36
 	if (includeSubnet)
37
 	{
38
 		snprintf(cmdline, sizeof(cmdline), "/sbin/route add %s/24 %s", destIps.c_str(), destIps.c_str());
39
 		if (system(cmdline) != 0)
40
 			syslog(LOG_ERR, "could not add route");
41
 	}
42
-#endif
43
 }
44
 
45
 void Tun::write(const char *buffer, int length)
(-)net/hanstunnel/files/patch-src_tun__dev__freebsd.c (+14 lines)
Line 0 Link Here
1
--- src/tun_dev_freebsd.c.orig	2014-02-07 03:36:31 UTC
2
+++ src/tun_dev_freebsd.c
3
@@ -31,7 +31,11 @@
4
 #include <errno.h>
5
 
6
 #include <sys/ioctl.h>
7
+#ifdef __DragonFly__
8
+#include <net/tun/if_tun.h>
9
+#else
10
 #include <net/if_tun.h>
11
+#endif
12
 
13
 /* #include "vtun.h"
14
 #include "lib.h" */
(-)net/hanstunnel/files/patch-tun.cpp (-45 lines)
Lines 1-45 Link Here
1
--- tun.cpp.orig	2010-02-17 10:30:21.000000000 -0500
2
+++ tun.cpp	2014-08-06 10:10:51.000000000 -0400
3
@@ -21,6 +21,7 @@
4
 #include "exception.h"
5
 #include "utility.h"
6
 
7
+#include <sys/types.h>
8
 #include <arpa/inet.h>
9
 #include <netinet/in_systm.h>
10
 #include <netinet/in.h>
11
@@ -41,8 +42,7 @@
12
 
13
 	if (device != NULL)
14
 	{
15
-		strncpy(this->device, device, VTUN_DEV_LEN);
16
-		this->device[VTUN_DEV_LEN] = 0;
17
+		strlcpy(this->device, device, VTUN_DEV_LEN);
18
 	}
19
 	else
20
 		this->device[0] = 0;
21
@@ -68,23 +68,17 @@
22
 	string ips = Utility::formatIp(ip);
23
 	string destIps = Utility::formatIp(destIp);
24
 
25
-#ifdef LINUX
26
-	snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s netmask 255.255.255.0", device, ips.c_str());
27
-#else
28
-	snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.255", device, ips.c_str(), destIps.c_str());
29
-#endif
30
+	snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.0", device, ips.c_str(), destIps.c_str());
31
 
32
 	if (system(cmdline) != 0)
33
 		syslog(LOG_ERR, "could not set tun device ip address");
34
 
35
-#ifndef LINUX
36
 	if (includeSubnet)
37
 	{
38
 		snprintf(cmdline, sizeof(cmdline), "/sbin/route add %s/24 %s", destIps.c_str(), destIps.c_str());
39
 		if (system(cmdline) != 0)
40
 			syslog(LOG_ERR, "could not add route");
41
 	}
42
-#endif
43
 }
44
 
45
 void Tun::write(const char *buffer, int length)
(-)net/hanstunnel/files/patch-utility.cpp (-10 lines)
Lines 1-10 Link Here
1
--- utility.cpp.orig	2014-08-06 10:12:15.000000000 -0400
2
+++ utility.cpp	2014-08-06 10:12:30.000000000 -0400
3
@@ -21,6 +21,7 @@
4
 
5
 #include <stdlib.h>
6
 #include <stdio.h>
7
+#include <time.h>
8
 
9
 using namespace std;
10
 
(-)net/hanstunnel/files/pkg-message.in (-23 lines)
Lines 1-23 Link Here
1
------------------------------------------------------------
2
3
Hans runs on Linux as a client and a server.
4
It runs on FreeBSD client only.
5
6
NOTE: that Hans can not receive echo requests on BSD systems.
7
Therefore the server only works on Linux.
8
9
------------------------------------------------------------
10
11
### Running as a server ###
12
13
% hans -s 10.1.2.0 -r -p password -u nobody
14
15
### Running as a client ###
16
17
% hans -c server_address -p password -u nobody
18
19
### Help ###
20
21
% hans
22
23
------------------------------------------------------------
(-)net/hanstunnel/pkg-descr (+3 lines)
Lines 3-6 could call it a ping tunnel. This can be useful wh Link Here
3
in the situation that your Internet access is firewalled, but pings are
3
in the situation that your Internet access is firewalled, but pings are
4
allowed.
4
allowed.
5
5
6
Hans runs on Linux as a client and a server. It runs on Mac OS X,
7
iPhone/iPod touch, FreeBSD and OpenBSD as a client only.
8
6
WWW: http://code.gerade.org/hans/
9
WWW: http://code.gerade.org/hans/

Return to bug 195313