Bug 195313 - [maintainer] net/hanstunnel
Summary: [maintainer] net/hanstunnel
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords: needs-patch, needs-qa
: 195424 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-11-23 21:05 UTC by vsityz
Modified: 2015-05-13 16:16 UTC (History)
4 users (show)

See Also:


Attachments
[maintainer update] new version hanstunnel (14.22 KB, patch)
2015-02-10 12:12 UTC, vsityz
no flags Details | Diff
update and refactor (12.73 KB, patch)
2015-04-23 13:26 UTC, Jan Beich
jbeich: maintainer-approval? (vsityz)
marino: maintainer-approval+
Details | Diff
8.4R amd64 build log (12.50 KB, text/plain)
2015-04-23 13:29 UTC, Jan Beich
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description vsityz 2014-11-23 21:05:50 UTC
# 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/distinfo
#	hanstunnel/Makefile
#	hanstunnel/files
#	hanstunnel/files/patch-Makefile
#	hanstunnel/files/patch-tun.cpp
#	hanstunnel/files/patch-echo.cpp
#	hanstunnel/pkg-message
#	hanstunnel/pkg-descr
#
echo c - hanstunnel
mkdir -p hanstunnel > /dev/null 2>&1
echo x - hanstunnel/distinfo
sed 's/^X//' >hanstunnel/distinfo << '65400445990c1970b9f5ad17ab147fd4'
XSHA256 (hans-0.4.4.tar.gz) = 81378258b8c9510ac01ad4d69f191e2927b9304daae033ee097f6ba4d39f6bb3
XSIZE (hans-0.4.4.tar.gz) = 33992
65400445990c1970b9f5ad17ab147fd4
echo x - hanstunnel/Makefile
sed 's/^X//' >hanstunnel/Makefile << '87523a3042cf8f2ebc7a9370982f09ef'
X# Created by: Alexander Panyushkin <vsityz@gmail.com>
X# $FreeBSD$
X
XPORTNAME=	hans
XPORTVERSION=	0.4.4
XCATEGORIES=	net security
XMASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	/hanstunnel/source/
X
XMAINTAINER=	vsityz@gmail.com
XCOMMENT=	Hans makes it possible to tunnel IPv4 through ICMP
X
XLICENSE=	GPLv3
X
XOPTIONS_DEFINE=		CLANG
XCLANG_DESC=		Build with Clang instead of GCC
XOPTIONS_DEFAULT=	CLANG
XPLIST_FILES=		${LOCALBASE}/bin/hans
X
X.include <bsd.port.options.mk>
X
X.if ${PORT_OPTIONS:MCLANG}
X.if ${OSVERSION} >=	900033 && exists(/usr/bin/clang)
XCC=			clang
XCXX=			clang++
X.else
XBUILD_DEPENDS+=		clang33:${PORTSDIR}/lang/clang33
XCC=			clang33
XCXX=			clang++33
X.endif
X.else
XUSE_GCC?=		yes
X.endif
X
Xdo-install:
X	${INSTALL_PROGRAM} ${WRKSRC}/hans ${STAGEDIR}${PREFIX}/bin/hans
X
Xpost-install:	.SILENT
X	${ECHO_MSG}
X	${CAT} ${PKGMESSAGE}
X	${ECHO_MSG}
X
X.include <bsd.port.mk>
87523a3042cf8f2ebc7a9370982f09ef
echo c - hanstunnel/files
mkdir -p hanstunnel/files > /dev/null 2>&1
echo x - hanstunnel/files/patch-Makefile
sed 's/^X//' >hanstunnel/files/patch-Makefile << '00f1877f7d4533cd6adc2ee1c8be24c9'
X--- Makefile.orig	2014-11-22 17:46:35.000000000 +0200
X+++ Makefile	2014-11-22 17:49:13.000000000 +0200
X@@ -1,8 +1,6 @@
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 = src/tun_dev_freebsd.c
X+GCC = ${CC}
X+GPP = ${CXX}
X 
X .PHONY: directories
X 
X@@ -16,46 +14,46 @@
X tunemu.o: directories build/tunemu.o
X 
X 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
X-	$(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)
X+	${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)
X 
X build/utility.o: src/utility.cpp src/utility.h
X-	$(GPP) -c src/utility.cpp -o $@ -o $@ $(CFLAGS)
X+	${GPP} -c src/utility.cpp -o $@ -o $@ ${CFLAGS}
X 
X build/exception.o: src/exception.cpp src/exception.h
X-	$(GPP) -c src/exception.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/exception.cpp -o $@ ${CFLAGS}
X 
X build/echo.o: src/echo.cpp src/echo.h src/exception.h
X-	$(GPP) -c src/echo.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/echo.cpp -o $@ ${CFLAGS}
X 
X build/tun.o: src/tun.cpp src/tun.h src/exception.h src/utility.h src/tun_dev.h
X-	$(GPP) -c src/tun.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/tun.cpp -o $@ ${CFLAGS}
X 
X build/tun_dev.o:
X-	$(GCC) -c $(TUN_DEV_FILE) -o build/tun_dev.o -o $@ $(CFLAGS)
X+	${GCC} -c ${TUN_DEV_FILE} -o build/tun_dev.o -o $@ ${CFLAGS}
X 
X build/sha1.o: src/sha1.cpp src/sha1.h
X-	$(GPP) -c src/sha1.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/sha1.cpp -o $@ ${CFLAGS}
X 
X 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
X-	$(GPP) -c src/main.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/main.cpp -o $@ ${CFLAGS}
X 
X 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
X-	$(GPP) -c src/client.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/client.cpp -o $@ ${CFLAGS}
X 
X 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
X-	$(GPP) -c src/server.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/server.cpp -o $@ ${CFLAGS}
X 
X build/auth.o: src/auth.cpp src/auth.h src/sha1.h src/utility.h
X-	$(GPP) -c src/auth.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/auth.cpp -o $@ ${CFLAGS}
X 
X 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
X-	$(GPP) -c src/worker.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/worker.cpp -o $@ ${CFLAGS}
X 
X build/time.o: src/time.cpp src/time.h
X-	$(GPP) -c src/time.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/time.cpp -o $@ ${CFLAGS}
X 
X clean:
X 	rm -rf build hans
X 
X build/tunemu.o: src/tunemu.h src/tunemu.c
X-	$(GCC) -c src/tunemu.c -o build/tunemu.o
X+	${GCC} -c src/tunemu.c -o build/tunemu.o
00f1877f7d4533cd6adc2ee1c8be24c9
echo x - hanstunnel/files/patch-tun.cpp
sed 's/^X//' >hanstunnel/files/patch-tun.cpp << '0a4216e67650c84929001f6d046ecbda'
X--- src/tun.cpp.orig	2014-02-07 05:36:31.000000000 +0200
X+++ src/tun.cpp	2014-11-22 17:31:16.000000000 +0200
X@@ -20,7 +20,7 @@
X #include "tun.h"
X #include "exception.h"
X #include "utility.h"
X-
X+#include <sys/types.h>
X #include <arpa/inet.h>
X #include <netinet/in_systm.h>
X #include <netinet/in.h>
X@@ -69,23 +69,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/files/patch-echo.cpp
sed 's/^X//' >hanstunnel/files/patch-echo.cpp << 'c9aaa09cd5c270680d478f955bb4582b'
X--- src/echo.cpp.orig	2014-11-22 17:51:42.000000000 +0200
X+++ src/echo.cpp	2014-11-22 17:51:46.000000000 +0200
X@@ -19,7 +19,7 @@
X 
X #include "echo.h"
X #include "exception.h"
X-
X+#include <sys/types.h>
X #include <sys/socket.h>
X #include <netinet/in_systm.h>
X #include <netinet/in.h>
c9aaa09cd5c270680d478f955bb4582b
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'
XHans 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
XHans runs on Linux as a client and a server. It runs on Mac OS X,
XiPhone/iPod touch, FreeBSD and OpenBSD as a client only.
X
X
XWWW: http://code.gerade.org/hans/
b3d8e535b1ab66b72469a8c0f03d82f8
exit
Comment 1 John Marino freebsd_committer 2015-01-25 18:07:40 UTC
If you are wondering why nobody touched this PR, here are three things hurting it.


1) This is a maintainer patch, but you didn't put "[maintainer]" in the title.  This cost you "extra credit" as PRs from maintainers tend to be viewed first.  I fixed this.

2) you submitted a shar for a port update.  This is against what the handbook says to do (you are supposed to submit a patch set (1 file) against the port).  Only a masochist is going to update an existing port with a shar (shar is great for new ports, not so much for reviewing changes to existing ports)

3) You didn't provide proof of testing, e.g. poudriere logs with stage-qa test.  While not yet mandatory, committers cherry-pick tested PRs and poudriere bulk -t is the best testing you can do.
Comment 2 vsityz 2015-02-10 12:12:22 UTC
Created attachment 152837 [details]
[maintainer update] new version hanstunnel

Upgrade version to 0.4.4_2

<root> portlint -C
looks fine.
Comment 3 John Marino freebsd_committer 2015-02-10 15:27:04 UTC
I see several issues:

1) PORTREVISION should be removed when PORTVERSION is increased.
2) Why is there a "clang" option
3) Why is clang being decided based on OSVERSION instead of the proper "USES=compiler:<feature>" method?
4) The post-install target is completely obsolete and should be removed, entirely


Also, portlint is nice but it's not equivalent to actually testing.
Comment 4 Thomas Zander freebsd_committer 2015-03-22 14:37:26 UTC
What is the relevance of the CLANG option? The messing around with setting CC and CXX should not be necessary. The port should just work with whatever CC it finds. If it does not, there are USES=compiler:ARGS that can help getting the port to build. I would not feel comfortable committing it in its current state. Could you look into this?
Comment 5 Jan Beich freebsd_committer 2015-04-23 13:26:19 UTC
Created attachment 155912 [details]
update and refactor

(requesting marino@ review if only for DragonFly bits)

How about throwing out all that legacy cruft?

- No need to revert MASTER_SITES to old format with _SUBDIR variable
- No need to hardcode LOCALBASE in PLIST_FILES while installing under PREFIX
- No need to remove #ifdef/#ifndef LINUX because no BSD system defines it
- No need to replace $(FOO) with ${FOO} as fmake and bmake accept both
- No need for CLANG option for the port builds fine with gcc42[1]
- No need to patch Makefile if you only need to override a few variables
- No need to ${CAT} ${PKGMESSAGE} as this is deprecated by staging

While here maybe also
- Add FPL to LICENSEs
- Fix build on DragonFly [2]
- Respect CFLAGS/LDFLAGS again after update
- Rename patches according to |make makepatch|

Tested on 8.4R amd64, 9.3R i386, 10.1R amd64, 10.1R i386, 11.0C i386.

[1] The ports framework allows interested users to change compiler by
    setting CC, CXX, CPP variables in make.conf. Trying to set CC=clang
    is going to make DragonFly unhappy if the port works fine otherwise.

[2] http://muscles.dragonflybsd.org/bulk/latest-per-pkg/hans/0.4.1_1/bleeding-edge-potential.log
Comment 6 Jan Beich freebsd_committer 2015-04-23 13:29:52 UTC
Created attachment 155913 [details]
8.4R amd64 build log

Mainly to show Q/A tests result.

  $ portlint -C
  looks fine.
Comment 7 Jan Beich freebsd_committer 2015-04-23 13:51:26 UTC
*** Bug 195424 has been marked as a duplicate of this bug. ***
Comment 8 Jan Beich freebsd_committer 2015-04-23 14:02:54 UTC
To clarify it's not bug hijacking. My changes are based on attachment 152837 [details]. However, due to almost nonexistent feedback from the maintainer I'm trying to make some progress.

Also, using maintainer-approval as a review flag because if in phabricator the comments wouldn't be fed back to bugzilla. Better visibility, at least for the maintainer.
Comment 9 John Marino freebsd_committer 2015-04-25 07:03:46 UTC
Comment on attachment 155912 [details]
update and refactor

All I say for DragonFly was the tun macro switch, which looks fine.
Comment 10 commit-hook freebsd_committer 2015-05-13 16:15:47 UTC
A commit references this bug:

Author: jbeich
Date: Wed May 13 16:14:48 UTC 2015
New revision: 386226
URL: https://svnweb.freebsd.org/changeset/ports/386226

Log:
  net/hanstunnel: update to 0.4.4 [1] and improve

  - Revert r326014 as nothing to substitute in pkg-message [1]
  - Clarify server works only on Linux [1]
  - Unbreak build on DragonFly [2]
  - Drop poorly maintained CLANG option [3]
  - Simplify patching via MAKE_ARGS
  - Respect LOCALBASE != PREFIX
  - Pet portlint (makepatch)
  - Clarify LICENSE

  PR:		195313
  Reported by:	DPorts [2]
  Requested by:	many [3]
  Submitted by:	vsityz@gmail.com (maintainer [1], based on)
  Reviewed by:	marino [2]
  Approved by:	maintainer timeout (~3 weeks)

Changes:
  head/net/hanstunnel/Makefile
  head/net/hanstunnel/distinfo
  head/net/hanstunnel/files/patch-Makefile
  head/net/hanstunnel/files/patch-client.cpp
  head/net/hanstunnel/files/patch-echo.cpp
  head/net/hanstunnel/files/patch-main.cpp
  head/net/hanstunnel/files/patch-src_echo.cpp
  head/net/hanstunnel/files/patch-src_tun.cpp
  head/net/hanstunnel/files/patch-src_tun__dev__freebsd.c
  head/net/hanstunnel/files/patch-tun.cpp
  head/net/hanstunnel/files/patch-utility.cpp
  head/net/hanstunnel/files/pkg-message.in
  head/net/hanstunnel/pkg-descr
  head/net/hanstunnel/pkg-message