ports/177649: [NEW PORT] net/hanstunnel: Hans makes it possible to tunnel IPv4 through ICMP
Alexander Panyushkin
vsityz at gmail.com
Fri Apr 5 08:30:01 UTC 2013
>Number: 177649
>Category: ports
>Synopsis: [NEW PORT] net/hanstunnel: Hans makes it possible to tunnel IPv4 through ICMP
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Apr 05 08:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Alexander Panyushkin
>Release: FreeBSD 9.1-STABLE #0 r248576
>Organization:
home
>Environment:
FreeBSD admin.local 9.1-STABLE FreeBSD 9.1-STABLE #0 r248576: Thu Mar 21 15:21:29 EET 2013 root at admin.local:/usr/obj/usr/src/sys/Kernel amd64
>Description:
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/
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# hanstunnel
# hanstunnel/pkg-message
# hanstunnel/pkg-descr
# hanstunnel/files
# hanstunnel/files/patch-client.cpp
# hanstunnel/files/patch-Makefile
# hanstunnel/files/patch-tun.cpp
# hanstunnel/distinfo
# hanstunnel/Makefile
#
echo c - hanstunnel
mkdir -p hanstunnel > /dev/null 2>&1
echo x - hanstunnel/pkg-message
sed 's/^X//' >hanstunnel/pkg-message << '35a6976a3b2d8f949619ff80f5876ac6'
X------------------------------------------------------------
X
XHans runs on Linux as a client and a server.
XIt runs on FreeBSD client only.
X
XNOTE: that Hans can not receive echo requests on BSD systems.
XTherefore the server only works on Linux.
X
X------------------------------------------------------------
X
X### Running as a server ###
X
X% hans -s 10.1.2.0 -r -p password -u nobody
X
X### Running as a client ###
X
X% hans -c server_address -p password -u nobody
X
X### Help ###
X
X% hans
X
X------------------------------------------------------------
35a6976a3b2d8f949619ff80f5876ac6
echo x - hanstunnel/pkg-descr
sed 's/^X//' >hanstunnel/pkg-descr << 'b3d8e535b1ab66b72469a8c0f03d82f8'
X Hans makes it possible to tunnel IPv4 through ICMP echo packets, so you
Xcould call it a ping tunnel. This can be useful when you find yourself
Xin the situation that your Internet access is firewalled, but pings are
Xallowed.
X
XWWW: http://code.gerade.org/hans/
b3d8e535b1ab66b72469a8c0f03d82f8
echo c - hanstunnel/files
mkdir -p hanstunnel/files > /dev/null 2>&1
echo x - hanstunnel/files/patch-client.cpp
sed 's/^X//' >hanstunnel/files/patch-client.cpp << '46ad173c5d66133a4980043dcd2a5077'
X--- client.cpp.orig 2010-02-17 17:30:21.000000000 +0200
X+++ client.cpp 2013-04-03 16:05:10.000000000 +0300
X@@ -27,6 +27,8 @@
X #include <arpa/inet.h>
X #include <syslog.h>
X
X+#include <netinet/in.h>
X+
X using namespace std;
X
X const Worker::TunnelHeader::Magic Client::magic("hanc");
46ad173c5d66133a4980043dcd2a5077
echo x - hanstunnel/files/patch-Makefile
sed 's/^X//' >hanstunnel/files/patch-Makefile << '00f1877f7d4533cd6adc2ee1c8be24c9'
X--- Makefile.orig 2010-02-17 17:30:21.000000000 +0200
X+++ Makefile 2013-04-04 15:18:50.818219413 +0300
X@@ -1,53 +1,51 @@
X-LDFLAGS = `sh osflags ld $(MODE)`
X-CFLAGS = -c -g `sh osflags c $(MODE)`
X-TUN_DEV_FILE = `sh osflags dev $(MODE)`
X-GCC = gcc
X-GPP = g++
X+TUN_DEV_FILE = tun_dev_freebsd.c
X+GCC = ${CC}
X+GPP = ${CXX}
X
X all: hans
X
X 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
X- $(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)
X+ ${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}
X
X utility.o: utility.cpp utility.h
X- $(GPP) -c utility.cpp $(CFLAGS)
X+ ${GPP} -c utility.cpp ${CFLAGS}
X
X exception.o: exception.cpp exception.h
X- $(GPP) -c exception.cpp $(CFLAGS)
X+ ${GPP} -c exception.cpp ${CFLAGS}
X
X echo.o: echo.cpp echo.h exception.h
X- $(GPP) -c echo.cpp $(CFLAGS)
X+ ${GPP} -c echo.cpp ${CFLAGS}
X
X tun.o: tun.cpp tun.h exception.h utility.h tun_dev.h
X- $(GPP) -c tun.cpp $(CFLAGS)
X+ ${GPP} -c tun.cpp ${CFLAGS}
X
X tun_dev.o:
X- $(GCC) -c $(TUN_DEV_FILE) -o tun_dev.o $(CFLAGS)
X+ ${GCC} -c ${TUN_DEV_FILE} -o tun_dev.o ${CFLAGS}
X
X sha1.o: sha1.cpp sha1.h
X- $(GPP) -c sha1.cpp $(CFLAGS)
X+ ${GPP} -c sha1.cpp ${CFLAGS}
X
X main.o: main.cpp client.h server.h exception.h worker.h auth.h time.h echo.h tun.h tun_dev.h
X- $(GPP) -c main.cpp $(CFLAGS)
X+ ${GPP} -c main.cpp ${CFLAGS}
X
X 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
X- $(GPP) -c client.cpp $(CFLAGS)
X+ ${GPP} -c client.cpp ${CFLAGS}
X
X 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
X- $(GPP) -c server.cpp $(CFLAGS)
X+ ${GPP} -c server.cpp ${CFLAGS}
X
X auth.o: auth.cpp auth.h sha1.h utility.h
X- $(GPP) -c auth.cpp $(CFLAGS)
X+ ${GPP} -c auth.cpp ${CFLAGS}
X
X worker.o: worker.cpp worker.h tun.h exception.h time.h echo.h tun_dev.h config.h
X- $(GPP) -c worker.cpp $(CFLAGS)
X+ ${GPP} -c worker.cpp ${CFLAGS}
X
X time.o: time.cpp time.h
X- $(GPP) -c time.cpp $(CFLAGS)
X+ ${GPP} -c time.cpp ${CFLAGS}
X
X clean:
X 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
X
X
X tunemu.o: tunemu.h tunemu.c
X- $(GCC) -c tunemu.c -o tunemu.o
X+ ${GCC} -c tunemu.c -o tunemu.o
00f1877f7d4533cd6adc2ee1c8be24c9
echo x - hanstunnel/files/patch-tun.cpp
sed 's/^X//' >hanstunnel/files/patch-tun.cpp << '0a4216e67650c84929001f6d046ecbda'
X--- tun.cpp.orig 2010-02-17 17:30:21.000000000 +0200
X+++ tun.cpp 2013-04-04 16:55:39.802818893 +0300
X@@ -68,23 +68,17 @@
X string ips = Utility::formatIp(ip);
X string destIps = Utility::formatIp(destIp);
X
X-#ifdef LINUX
X- snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s netmask 255.255.255.0", device, ips.c_str());
X-#else
X- snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.255", device, ips.c_str(), destIps.c_str());
X-#endif
X+ snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.0", device, ips.c_str(), destIps.c_str());
X
X if (system(cmdline) != 0)
X syslog(LOG_ERR, "could not set tun device ip address");
X
X-#ifndef LINUX
X if (includeSubnet)
X {
X snprintf(cmdline, sizeof(cmdline), "/sbin/route add %s/24 %s", destIps.c_str(), destIps.c_str());
X if (system(cmdline) != 0)
X syslog(LOG_ERR, "could not add route");
X }
X-#endif
X }
X
X void Tun::write(const char *buffer, int length)
0a4216e67650c84929001f6d046ecbda
echo x - hanstunnel/distinfo
sed 's/^X//' >hanstunnel/distinfo << '65400445990c1970b9f5ad17ab147fd4'
XSHA256 (hans-0.4.1.tar.gz) = 8e4df005bcf6a877ffd0810cc9b31aa3ae04f23d798bea6cc2893a3f26cac29c
XSIZE (hans-0.4.1.tar.gz) = 32860
65400445990c1970b9f5ad17ab147fd4
echo x - hanstunnel/Makefile
sed 's/^X//' >hanstunnel/Makefile << '87523a3042cf8f2ebc7a9370982f09ef'
X# Created by: Alexander Panyushkin <vsityz at gmail.com>
X# $FreeBSD$
X
XPORTNAME= hans
XPORTVERSION= 0.4.1
XCATEGORIES= net security
XMASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR= /hanstunnel/source/
X
XMAINTAINER= vsityz at gmail.com
XCOMMENT= Hans makes it possible to tunnel IPv4 through ICMP
X
XLICENSE_PERMS_GPL3= yes
X
XOPTIONS_DEFINE= CLANG
X
XCLANG_DESC= Build with Clang instead of GCC
X
XOPTIONS_DEFAULT= CLANG
X
XPLIST_FILES= ${LOCALBASE}/bin/hans
X
X.include <bsd.port.options.mk>
X
X.if ${PORT_OPTIONS:MCLANG}
X.if ${OSVERSION} < 1000000
XCC=clang
XCXX=clang++
X.if ${OSVERSION} < 900033
XBUILD_DEPENDS+= clang:${PORTSDIR}/lang/clang
X.endif
X.endif
X.else
XUSE_GCC=4.2+
XCC=gcc
XCXX=g++
XCPP=gcpp
X.endif
X
Xdo-install:
X @${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} ${WRKSRC}/hans ${LOCALBASE}/bin
X
Xpost-install: .SILENT
X ${ECHO_MSG}
X ${CAT} ${PKGMESSAGE}
X ${ECHO_MSG}
X
X.include <bsd.port.mk>
87523a3042cf8f2ebc7a9370982f09ef
exit
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list