stun

simple point to point tunnel
git clone git://git.2f30.org/stun
Log | Files | Refs | README

commit 9b2fff32d015a1e0dd370ecc51c7f40d35b5772b
parent 7c94056263faf3a17ef80ea333143b09fc2178b3
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu, 17 Mar 2016 19:55:49 +0100

initial Makefile, README and LICENSE

Diffstat:
ALICENSE | 13+++++++++++++
AMakefile | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AREADME | 25+++++++++++++++++++++++++
Aconfig.mk | 24++++++++++++++++++++++++
4 files changed, 118 insertions(+), 0 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2016 Dimitris Papastamos <sin@2f30.org> + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Makefile b/Makefile @@ -0,0 +1,56 @@ +include config.mk + +NAME = stun +VERSION = 0.1 +BIN = stun +SRC = ${BIN:=.c} +MAN1 = ${BIN:=.1} +DOC = LICENSE README +HDR = arg.h + +all: $(BIN) + +${BIN}: ${LIB} ${@:=.o} + +OBJ = ${SRC:.c=.o} + +${OBJ}: config.mk ${HDR} + +.o: + ${CC} ${LDFLAGS} -o $@ $< ${LIB} + +.c.o: + ${CC} -c ${CFLAGS} ${CPPFLAGS} -o $@ -c $< + +dist: $(BIN) + rm -rf release/${VERSION} + mkdir -p release/${VERSION} + cp -f ${MAN1} ${DOC} ${HDR} \ + ${SRC} Makefile config.mk \ + release/${VERSION}/ + # make tarball + rm -f stun-${VERSION}.tar.gz + (cd release/${VERSION}; \ + tar -czf ../../stun-${VERSION}.tar.gz .) + +clean: + rm -f ${BIN} ${OBJ} ${LIB} + +install: all + # installing executable files. + mkdir -p ${DESTDIR}${PREFIX}/bin + cp -f ${BIN} ${DESTDIR}${PREFIX}/bin + for f in $(BIN); do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done + # installing manual pages for tools. + mkdir -p ${DESTDIR}${MANPREFIX}/man1 + cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1 + for m in $(MAN1); do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$m; done + +uninstall: + # removing executable files. + for f in $(BIN); do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done + -rmdir ${DESTDIR}${PREFIX}/share/${NAME} + # removing manual pages. + for m in $(MAN1); do rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done + +.PHONY: all clean dist install uninstall diff --git a/README b/README @@ -0,0 +1,25 @@ +stun +==== + + +Installation +------------ + +$ make +$ doas make install + + +Usage +----- + +On the server: + + ifconfig tun0 create + ifconfig tun0 10.0.0.1 10.0.0.2 + STUNPW="password" stun -s /dev/tun0 + +On the client: + + ifconfig tun0 create + ifconfig tun0 10.0.0.2 10.0.0.1 + STUNPW="password" stun -h ip-of-server /dev/tun0 diff --git a/config.mk b/config.mk @@ -0,0 +1,24 @@ +# customize below to fit your system + +# paths +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/man + +# compiler and linker +CC = cc +AR = ar +RANLIB = ranlib + +# debug +#CFLAGS = -fstack-protector-all -O0 -g -std=c99 -Wall -Wextra -pedantic +#LDFLAGS = -lcrypto + +# optimized +CFLAGS = -O2 -std=c99 +LDFLAGS = -lcrypto -s + +# optimized static +#CFLAGS = -static -O2 -std=c99 +#LDFLAGS = -lcrypto -static -s + +CPPFLAGS = -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_BSD_SOURCE