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

Collapse All | Expand All

(-)hanstunnel/Makefile (-20 / +18 lines)
Lines 1-43 Link Here
1
# Created by: Alexander Panyushkin <vsityz@gmail.com>
1
# Created by: Alexander Panyushkin <vsityz@gmail.com>
2
# $FreeBSD: head/net/hanstunnel/Makefile 346721 2014-03-01 21:23:14Z gerald $
2
# $FreeBSD$
3
3
4
PORTNAME=	hans
4
PORTNAME=	hans
5
PORTVERSION=	0.4.1
5
PORTVERSION=	0.4.4
6
PORTREVISION=	1
6
PORTREVISION?=	2
7
CATEGORIES=	net security
7
CATEGORIES=	net security
8
MASTER_SITES=	SF/hanstunnel/source
8
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
9
MASTER_SITE_SUBDIR=	/hanstunnel/source/
9
10
10
MAINTAINER=	vsityz@gmail.com
11
MAINTAINER=	vsityz@gmail.com
11
COMMENT=	Hans makes it possible to tunnel IPv4 through ICMP
12
COMMENT=	Hans makes it possible to tunnel IPv4 through ICMP
12
13
13
LICENSE=	GPLv3
14
LICENSE=	GPLv3
14
15
15
OPTIONS_DEFINE=	CLANG
16
OPTIONS_DEFINE=		CLANG
16
17
CLANG_DESC=		Build with Clang instead of GCC
17
CLANG_DESC=	Build with Clang instead of GCC
18
19
OPTIONS_DEFAULT=	CLANG
18
OPTIONS_DEFAULT=	CLANG
20
19
21
PLIST_FILES=	bin/hans
20
PLIST_FILES=	${LOCALBASE}/bin/hans
22
23
SUB_FILES=	pkg-message
24
21
25
.include <bsd.port.options.mk>
22
.include <bsd.port.options.mk>
26
23
27
.if ${PORT_OPTIONS:MCLANG}
24
.if ${PORT_OPTIONS:MCLANG}
28
.if ${OSVERSION} >= 900033 && exists(/usr/bin/clang)
25
.if ${OSVERSION} >=	900014 && exists(/usr/bin/clang)
29
CC=		clang
26
CC=			clang
30
CXX=		clang++
27
CXX=			clang++
31
.else
28
.else
32
BUILD_DEPENDS+=	clang33:${PORTSDIR}/lang/clang33
29
USE_GCC?=		any
33
CC=		clang33
34
CXX=		clang++33
35
.endif
30
.endif
36
.else
37
USE_GCC=	any
38
.endif
31
.endif
39
32
40
do-install:
33
do-install:
41
	${INSTALL_PROGRAM} ${WRKSRC}/hans ${STAGEDIR}${LOCALBASE}/bin
34
	${INSTALL_PROGRAM} ${WRKSRC}/hans ${STAGEDIR}${PREFIX}/bin/hans
35
36
post-install:	.SILENT
37
	${ECHO_MSG}
38
	${CAT} ${PKGMESSAGE}
39
	${ECHO_MSG}
42
40
43
.include <bsd.port.mk>
41
.include <bsd.port.mk>
(-)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
(-)hanstunnel/files/patch-Makefile (-61 / +63 lines)
Lines 1-73 Link Here
1
--- Makefile.orig	2010-02-17 17:30:21.000000000 +0200
1
--- Makefile.orig	2014-11-22 17:46:35.000000000 +0200
2
+++ Makefile	2013-04-04 15:18:50.818219413 +0300
2
+++ Makefile	2014-11-22 17:49:13.000000000 +0200
3
@@ -1,53 +1,51 @@
3
@@ -1,8 +1,6 @@
4
-LDFLAGS = `sh osflags ld $(MODE)`
4
-LDFLAGS = `sh osflags ld $(MODE)`
5
-CFLAGS = -c -g `sh osflags c $(MODE)`
5
-CFLAGS = -c -g `sh osflags c $(MODE)`
6
-TUN_DEV_FILE = `sh osflags dev $(MODE)`
6
-TUN_DEV_FILE = `sh osflags dev $(MODE)`
7
-GCC = gcc
7
-GCC = gcc
8
-GPP = g++
8
-GPP = g++
9
+TUN_DEV_FILE = tun_dev_freebsd.c
9
+TUN_DEV_FILE = src/tun_dev_freebsd.c
10
+GCC = ${CC}
10
+GCC = ${CC}
11
+GPP = ${CXX}
11
+GPP = ${CXX}
12
 
12
 
13
 all: hans
13
 .PHONY: directories
14
 
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
15
@@ -16,46 +14,46 @@
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)
16
 tunemu.o: directories build/tunemu.o
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
 
17
 
67
 clean:
18
 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
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
19
-	$(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)
20
+	${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)
21
 
22
 build/utility.o: src/utility.cpp src/utility.h
23
-	$(GPP) -c src/utility.cpp -o $@ -o $@ $(CFLAGS)
24
+	${GPP} -c src/utility.cpp -o $@ -o $@ ${CFLAGS}
25
 
26
 build/exception.o: src/exception.cpp src/exception.h
27
-	$(GPP) -c src/exception.cpp -o $@ $(CFLAGS)
28
+	${GPP} -c src/exception.cpp -o $@ ${CFLAGS}
29
 
30
 build/echo.o: src/echo.cpp src/echo.h src/exception.h
31
-	$(GPP) -c src/echo.cpp -o $@ $(CFLAGS)
32
+	${GPP} -c src/echo.cpp -o $@ ${CFLAGS}
33
 
34
 build/tun.o: src/tun.cpp src/tun.h src/exception.h src/utility.h src/tun_dev.h
35
-	$(GPP) -c src/tun.cpp -o $@ $(CFLAGS)
36
+	${GPP} -c src/tun.cpp -o $@ ${CFLAGS}
37
 
38
 build/tun_dev.o:
39
-	$(GCC) -c $(TUN_DEV_FILE) -o build/tun_dev.o -o $@ $(CFLAGS)
40
+	${GCC} -c ${TUN_DEV_FILE} -o build/tun_dev.o -o $@ ${CFLAGS}
41
 
42
 build/sha1.o: src/sha1.cpp src/sha1.h
43
-	$(GPP) -c src/sha1.cpp -o $@ $(CFLAGS)
44
+	${GPP} -c src/sha1.cpp -o $@ ${CFLAGS}
45
 
46
 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
47
-	$(GPP) -c src/main.cpp -o $@ $(CFLAGS)
48
+	${GPP} -c src/main.cpp -o $@ ${CFLAGS}
49
 
50
 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
51
-	$(GPP) -c src/client.cpp -o $@ $(CFLAGS)
52
+	${GPP} -c src/client.cpp -o $@ ${CFLAGS}
53
 
54
 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
55
-	$(GPP) -c src/server.cpp -o $@ $(CFLAGS)
56
+	${GPP} -c src/server.cpp -o $@ ${CFLAGS}
57
 
58
 build/auth.o: src/auth.cpp src/auth.h src/sha1.h src/utility.h
59
-	$(GPP) -c src/auth.cpp -o $@ $(CFLAGS)
60
+	${GPP} -c src/auth.cpp -o $@ ${CFLAGS}
61
 
62
 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
63
-	$(GPP) -c src/worker.cpp -o $@ $(CFLAGS)
64
+	${GPP} -c src/worker.cpp -o $@ ${CFLAGS}
65
 
66
 build/time.o: src/time.cpp src/time.h
67
-	$(GPP) -c src/time.cpp -o $@ $(CFLAGS)
68
+	${GPP} -c src/time.cpp -o $@ ${CFLAGS}
69
 
69
 
70
 clean:
71
 	rm -rf build hans
70
 
72
 
71
 tunemu.o: tunemu.h tunemu.c
73
 build/tunemu.o: src/tunemu.h src/tunemu.c
72
-	$(GCC) -c tunemu.c -o tunemu.o
74
-	$(GCC) -c src/tunemu.c -o build/tunemu.o
73
+	${GCC} -c tunemu.c -o tunemu.o
75
+	${GCC} -c src/tunemu.c -o build/tunemu.o
(-)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");
(-)hanstunnel/files/patch-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-11-22 17:51:42.000000000 +0200
2
+++ echo.cpp	2014-08-06 10:11:56.000000000 -0400
2
+++ src/echo.cpp	2014-11-22 17:51:46.000000000 +0200
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>
(-)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
 {
(-)hanstunnel/files/patch-tun.cpp (-28 / +19 lines)
Lines 1-44 Link Here
1
--- tun.cpp.orig	2010-02-17 10:30:21.000000000 -0500
1
--- src/tun.cpp.orig	2014-02-07 05:36:31.000000000 +0200
2
+++ tun.cpp	2014-08-06 10:10:51.000000000 -0400
2
+++ src/tun.cpp	2014-11-22 17:31:16.000000000 +0200
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
@@ -69,23 +69,17 @@
12
 
13
     string ips = Utility::formatIp(ip);
13
 	if (device != NULL)
14
     string destIps = Utility::formatIp(destIp);
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
 
15
 
25
-#ifdef LINUX
16
-#ifdef LINUX
26
-	snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s netmask 255.255.255.0", device, ips.c_str());
17
-    snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s netmask 255.255.255.0", device, ips.c_str());
27
-#else
18
-#else
28
-	snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.255", device, ips.c_str(), destIps.c_str());
19
-    snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.255", device, ips.c_str(), destIps.c_str());
29
-#endif
20
-#endif
30
+	snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.0", device, ips.c_str(), destIps.c_str());
21
+    snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.0", device, ips.c_str(), destIps.c_str());
31
 
22
 
32
 	if (system(cmdline) != 0)
23
     if (system(cmdline) != 0)
33
 		syslog(LOG_ERR, "could not set tun device ip address");
24
         syslog(LOG_ERR, "could not set tun device ip address");
34
 
25
 
35
-#ifndef LINUX
26
-#ifndef LINUX
36
 	if (includeSubnet)
27
     if (includeSubnet)
37
 	{
28
     {
38
 		snprintf(cmdline, sizeof(cmdline), "/sbin/route add %s/24 %s", destIps.c_str(), destIps.c_str());
29
         snprintf(cmdline, sizeof(cmdline), "/sbin/route add %s/24 %s", destIps.c_str(), destIps.c_str());
39
 		if (system(cmdline) != 0)
30
         if (system(cmdline) != 0)
40
 			syslog(LOG_ERR, "could not add route");
31
             syslog(LOG_ERR, "could not add route");
41
 	}
32
     }
42
-#endif
33
-#endif
43
 }
34
 }
44
 
35
 
(-)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
 
(-)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
------------------------------------------------------------
(-)hanstunnel/pkg-descr (+4 lines)
Lines 3-6 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
9
6
WWW: http://code.gerade.org/hans/
10
WWW: http://code.gerade.org/hans/
(-)hanstunnel/pkg-message (+23 lines)
Line 0 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
------------------------------------------------------------

Return to bug 195313