Browse Source

ptunnel-ng:
* this is now an autotools project (added/renamed required files e.g. AUTHORS, COPYING)
* removed user defined ip header (buggy; not useful anymore)

Toni Uhlig 5 years ago
parent
commit
3c491a8bec
25 changed files with 195 additions and 126 deletions
  1. 3 0
      AUTHORS
  2. 0 0
      COPYING
  3. 0 0
      ChangeLog
  4. 0 55
      Makefile
  5. 1 0
      Makefile.am
  6. 0 0
      NEWS
  7. 13 0
      autogen.sh
  8. 133 0
      configure.ac
  9. 18 0
      src/Makefile.am
  10. 0 0
      src/challenge.c
  11. 0 0
      src/challenge.h
  12. 0 0
      src/md5.c
  13. 0 0
      src/md5.h
  14. 9 6
      src/options.c
  15. 2 0
      src/options.h
  16. 0 0
      src/pconfig.h
  17. 0 46
      src/pdesc.c
  18. 0 0
      src/pdesc.h
  19. 0 0
      src/pkt.c
  20. 0 0
      src/pkt.h
  21. 10 16
      src/ptunnel.c
  22. 2 1
      src/ptunnel.h
  23. 2 0
      src/utils.c
  24. 0 0
      src/utils.h
  25. 2 2
      web/index.html

+ 3 - 0
AUTHORS

@@ -0,0 +1,3 @@
+Daniel Stoedle <daniels@cs.uit.no>
+Mike Miller <mike@mikeage.net>
+Toni Uhlig <matzeton@googlemail.com>

+ 0 - 0
LICENSE → COPYING


+ 0 - 0
CHANGELOG → ChangeLog


+ 0 - 55
Makefile

@@ -1,55 +0,0 @@
-# Makefile for the pingtunnel utility
-# (c) 2004-2009 Daniel Stoedle, daniels@cs.uit.no
-# ptunnel.exe target added by Mike Miller, mike@mikeage.net
-
-CC			= gcc
-CFLAGS		= -Wall -g -fstrict-aliasing -Os
-LDOPTS		= -lpthread -lpcap
-PT_OBJS		= utils.o options.o pkt.o challenge.o pdesc.o ptunnel.o md5.o
-
-WIN32_CC      = mingw32-gcc
-WIN32_CFLAGS  = -g -Wall -DWIN32 -I"c:\Program Files\WpdPack\Include"
-WIN32_LDOPTS  = -lwpcap -lwsock32 -L"c:\Program Files\WpdPack\Lib"
-WIN32_PT_OBJS = utils.obj options.obj pkt.obj challenge.obj pdesc.obj ptunnel.obj md5.obj
-
-prefix		= $(DESTDIR)/usr
-bindir		= $(prefix)/sbin
-mandir		= $(prefix)/share/man/man8
-
-all: ptunnel
-
-dist:
-	rm -rf PingTunnel/
-	mkdir PingTunnel
-	cp ptunnel.c ptunnel.h Makefile.dist PingTunnel/
-	mv PingTunnel/Makefile.dist PingTunnel/Makefile
-	
-
-install: ptunnel
-	install -d $(bindir)/
-	install -d $(mandir)/
-	install ./ptunnel $(bindir)/ptunnel
-	install ./ptunnel.8 $(mandir)/ptunnel.8
-
-ptunnel: $(PT_OBJS)
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LDOPTS) `[ -e /usr/include/selinux/selinux.h ] && echo -lselinux`
-
-ptunnel.exe: $(WIN32_PT_OBJS)
-	$(CC) -o $@ $^ $(WIN32_LDOPTS)
-
-clean:
-	-rm -f *.o ptunnel
-	-rm -f *.obj ptunnel.exe
-	-rm -f .depend
-
-depend: .depend
-.depend:
-	$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > $@
-
-%.o:%.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) `[ -e /usr/include/selinux/selinux.h ] && echo -DHAVE_SELINUX` -c -o $@ $<
-
-%.obj:%.c
-	$(WIN32_CC) $(WIN32_CFLAGS) -c -o $@ $<
-
--include .depend

+ 1 - 0
Makefile.am

@@ -0,0 +1 @@
+SUBDIRS = src

+ 0 - 0
NEWS


+ 13 - 0
autogen.sh

@@ -0,0 +1,13 @@
+#!/bin/bash
+
+set -e
+set -x
+
+test -f ./Makefile && make distclean
+
+aclocal
+autoheader
+automake --force-missing --add-missing
+autoconf
+
+./configure $@ && make -j${BUILDJOBS:-4} all

+ 133 - 0
configure.ac

@@ -0,0 +1,133 @@
+AC_PREREQ(2.69)
+AC_INIT([ptunnel-ng], [1.0.0], [], [], [])
+AC_CONFIG_SRCDIR([src/config.h.in])
+AC_CONFIG_FILES([Makefile src/Makefile])
+
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+if test x"$cross_compiling" != x"no"; then
+	HOST_PREFIX="${host_alias}-"
+	HOST_SUFFIX="-$host_alias"
+	if test x"${build_alias}" = x; then
+		AC_MSG_ERROR([Cross compile enabled but no --build *explicitly* specified. For example: --build=$(gcc -dumpmachine)])
+	fi
+else
+	HOST_PREFIX=
+	HOST_SUFFIX=
+fi
+case x"${host}" in
+	x*-*-cygwin* | x*-*-mingw32*)
+		dnl Some Windows includes required by third-party modules.
+		use_msw=yes
+		PROGRAM_EXT=".exe"
+	;;
+esac
+
+AM_SILENT_RULES([yes])
+AM_INIT_AUTOMAKE
+AC_PROG_INSTALL
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_SIZE_T
+AC_CHECK_HEADER_STDBOOL
+AC_FUNC_VPRINTF
+AC_FUNC_MEMCMP
+
+dnl Check for std includes.
+AC_CHECK_HEADERS([stdarg.h stdio.h unistd.h stdlib.h string.h stdint.h time.h signal.h assert.h],,
+    [AC_MSG_ERROR([Missing essential std headers.])])
+if test x"${use_msw}" != x"yes"; then
+	AC_CHECK_HEADERS([sys/unistd.h sys/types.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pthread.h errno.h net/ethernet.h syslog.h pwd.h grp.h],,
+	    [AC_MSG_ERROR([Missing essential non-Windows std headers.])])
+	AC_SEARCH_LIBS([pthread_create], [pthread],,
+	    [AC_MSG_ERROR([Missing pthread library.])],)
+	AC_CHECK_FUNCS([pthread_mutex_init pthread_mutex_lock pthread_mutex_unlock],,
+	    [AC_MSG_ERROR([Missing essential pthread functions.])])
+else
+	AC_CHECK_HEADERS([winsock2.h windows.h ws2tcpip.h],,
+	    [AC_MSG_ERROR([Missing essential Windows std headers.])])
+fi
+
+dnl Check timeval struct members.
+AC_CHECK_MEMBER([struct timeval.tv_sec], [],
+    [AC_MSG_ERROR([Invalid \`struct timeval\` structure.])],
+    [[#include <sys/time.h>]])
+AC_CHECK_MEMBER([struct timeval.tv_usec], [],
+    [AC_MSG_ERROR([Invalid \`struct timeval\` structure.])],
+	[[#include <sys/time.h>]])
+
+dnl Check size
+AC_CHECK_SIZEOF(char)
+AC_CHECK_SIZEOF(uint8_t)
+AC_CHECK_SIZEOF(uint16_t)
+AC_CHECK_SIZEOF(uint32_t)
+AC_CHECK_SIZEOF(int)
+if test $ac_cv_sizeof_char != "1" -o \
+  $ac_cv_sizeof_uint8_t != "1" -o \
+  $ac_cv_sizeof_uint16_t != "2" -o \
+  $ac_cv_sizeof_uint32_t != "4" -o \
+  $ac_cv_sizeof_int != "4"; then
+	AC_MSG_ERROR([Invalid type size.])
+fi
+
+AC_MSG_CHECKING([for __attribute__ ((packed))])
+AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([[
+#include <stdlib.h>
+struct foo {
+    int num;
+    char *str;
+    void *ptr;
+} __attribute__ ((packed));
+]], [])]
+,[AC_MSG_RESULT([yes])]
+,[AC_MSG_ERROR([Your compiler does not support \`__attribute__ ((packed))\`.])])
+
+dnl Check for std functions.
+AC_CHECK_FUNCS([malloc calloc free memcpy memset signal printf sprintf vsnprintf strerror strlen strncmp strstr strtol strtoul fopen fprintf gettimeofday close fclose exit],,
+    [AC_MSG_ERROR([Missing essential std functions.])])
+
+dnl `--disable-pcap`: Enabled if found.
+AC_ARG_ENABLE([pcap],
+    [AS_HELP_STRING([--disable-pcap], [Disable pcap support. (default: enabled if found)])],,[pcap_enabled=yes])
+pcap_enabled=$(echo ${pcap_enabled})
+case ${pcap_enabled} in
+	1|y|yes) pcap_enabled=yes ;;
+	''|0|n|no) pcap_enabled= ;;
+	*) AC_MSG_ERROR([Unknown option \`${pcap_enabled}\` for --disable-pcap]) ;;
+esac
+
+dnl `--disable-selinux`: Enabled if found.
+AC_ARG_ENABLE([selinux],
+    [AS_HELP_STRING([--disable-selinux], [Disable SELINUX support. (default: enabled if found)])],,[selinux_enabled=yes])
+selinux_enabled=$(echo ${selinux_enabled})
+case ${selinux_enabled} in
+	1|y|yes) selinux_enabled=yes ;;
+	''|0|n|no) selinux_enabled= ;;
+	*) AC_MSG_ERROR([Unknown option \`${selinux_enabled}\` for --disable-selinux]) ;;
+esac
+
+dnl Check libcap headers/functions.
+if test x"${pcap_enabled}" != x; then
+	AC_CHECK_HEADERS([pcap.h],,
+	    [pcap_enabled=])
+	AC_SEARCH_LIBS([pcap_lookupnet], [pcap],,
+	    [pcap_enabled=],)
+	AC_CHECK_FUNCS([pcap_compile pcap_close pcap_setfilter pcap_dispatch],,
+	    [pcap_enabled=])
+fi
+
+dnl Check for SELINUX
+if test x"${selinux_enabled}" != x; then
+	AC_CHECK_HEADERS([selinux/selinux.h],,
+	    [selinux_enabled=])
+	AC_SEARCH_LIBS([setcon], [selinux],,[selinux_enabled=],)
+fi
+
+dnl Set automake conf vars
+AM_CONDITIONAL([HAVE_PCAP], [test x"${pcap_enabled}" = xyes])
+AM_CONDITIONAL([HAVE_SELINUX], [test x"${selinux_enabled}" = xyes])
+
+dnl output config headers
+AC_CONFIG_HEADERS([src/config.h:src/config.h.in])
+AC_OUTPUT

+ 18 - 0
src/Makefile.am

@@ -0,0 +1,18 @@
+bin_PROGRAMS = ptunnel
+
+ptunnel_CFLAGS = -Wall
+if HAVE_PCAP
+ptunnel_CFLAGS += -DHAVE_PCAP=1
+endif
+if HAVE_SELINUX
+ptunnel_CFLAGS += -DHAVE_SELINUX=1
+endif
+
+ptunnel_SOURCES = \
+	md5.c \
+	challenge.c \
+	options.c \
+	utils.c \
+	pkt.c \
+	pdesc.c \
+	ptunnel.c

+ 0 - 0
challenge.c → src/challenge.c


+ 0 - 0
challenge.h → src/challenge.h


+ 0 - 0
md5.c → src/md5.c


+ 0 - 0
md5.h → src/md5.h


+ 9 - 6
options.c → src/options.c

@@ -120,13 +120,11 @@ static const struct option_usage usage[] = {
 		"When started in privileged mode, restrict file access to the specified directory\n"
 	},
 #endif
-#ifdef HAVE_SELINUX
 	/** --setcon */
 	{NULL,           0, OPT_STR,    {.num = 0},
 		"Set SELinux context when all there is left to do are network I/O operations\n"
 		"To combine with -chroot you will have to `mount --bind /proc /chrootdir/proc`\n"
 	},
-#endif
 	/** --help */
 	{"help",         0, OPT_STR,    {.str = NULL}, "this\n"},
 	{NULL,0,OPT_BOOL,{.unum=0},NULL}
@@ -154,9 +152,7 @@ static struct option long_options[] = {
 	{"group",       optional_argument, 0, 'g'},
 	{"chroot",      optional_argument, 0, 'C'},
 #endif
-#ifdef HAVE_SELINUX
 	{"setcon",            no_argument, 0, 'e'},
-#endif
 	{"help",              no_argument, 0, 'h'},
 	{NULL,0,0,0}
 };
@@ -188,7 +184,9 @@ static void set_options_defaults(void) {
 	opts.given_dst_port  = *(uint32_t *)  get_default_optval(OPT_DEC32, "remote-port");
 	opts.max_tunnels     = *(uint32_t *)  get_default_optval(OPT_DEC32, "connections");
 	opts.log_level       = *(int *)       get_default_optval(OPT_DEC32, "verbosity");
+#ifdef HAVE_PCAP
 	opts.pcap_device     = strdup(*(char **)get_default_optval(OPT_STR, "libpcap"));
+#endif
 	opts.log_path        = strdup(*(char **)get_default_optval(OPT_STR, "logfile"));
 	opts.log_file        = stdout;
 	opts.print_stats     = *(int *)       get_default_optval(OPT_BOOL,  "statistics");
@@ -367,6 +365,7 @@ int parse_options(int argc, char **argv) {
 				opts.log_level = strtol(optarg, NULL, 10);
 				break;
 			case 'a':
+#ifdef HAVE_PCAP
 				opts.pcap = 1;
 				if (!optarg)
 					break;
@@ -374,6 +373,10 @@ int parse_options(int argc, char **argv) {
 					free(opts.pcap_device);
 				opts.pcap_device = strdup(optarg);
 				break;
+#else
+				pt_log(kLog_error, "-%c: feature not supported\n", c);
+				exit(1);
+#endif
 			case 'o':
 				has_logfile = 1;
 				if (!optarg)
@@ -445,7 +448,7 @@ int parse_options(int argc, char **argv) {
 			case 'u':
 			case 'g':
 			case 't':
-				pt_log(kLog_error, "%s: feature not supported\n", argv[optind - 1]);
+				pt_log(kLog_error, "-%c: feature not supported\n", c);
 				exit(1);
 #endif
 			case 'e':
@@ -455,7 +458,7 @@ int parse_options(int argc, char **argv) {
 				opts.selinux_context = strdup(optarg);
 				break;
 #else
-				pt_log(kLog_error, "%s: feature not supported\n", argv[optind - 1]);
+				pt_log(kLog_error, "-%c: feature not supported\n", c);
 				exit(1);
 #endif
 			case 'h':

+ 2 - 0
options.h → src/options.h

@@ -32,10 +32,12 @@ struct options {
 	uint32_t max_tunnels;
 	/** Default log level */
 	int log_level;
+#ifdef HAVE_PCAP
 	/** Non zero value if user wants packet capturing */
 	int pcap;
 	/** Device to capture packets from */
 	char *pcap_device;
+#endif
 	/** Usually stdout, but can be altered by the user */
 	char *log_path;
 	FILE *log_file;

+ 0 - 0
pconfig.h → src/pconfig.h


+ 0 - 46
pdesc.c → src/pdesc.c

@@ -125,14 +125,8 @@ int queue_packet(int icmp_sock, uint8_t type, char *buf, int num_bytes,
                  uint32_t state, struct sockaddr_in *dest_addr, uint16_t next_expected_seq,
                  int *first_ack, uint16_t *ping_seq)
 {
-#if kPT_add_iphdr
-	ip_packet_t *ip_pkt = 0;
-	int pkt_len         = sizeof(ip_packet_t) + sizeof(icmp_echo_packet_t) +
-	                      sizeof(ping_tunnel_pkt_t) + num_bytes;
-#else
 	int pkt_len         = sizeof(icmp_echo_packet_t) +
 	                      sizeof(ping_tunnel_pkt_t) + num_bytes;
-#endif
 	int err             = 0;
 	icmp_echo_packet_t *pkt   = 0;
 	ping_tunnel_pkt_t *pt_pkt = 0;
@@ -141,32 +135,7 @@ int queue_packet(int icmp_sock, uint8_t type, char *buf, int num_bytes,
 	if (pkt_len % 2)
 		pkt_len++;
 
-#if kPT_add_iphdr
-	printf("add header\n");
-	ip_pkt            = (ip_packet_t *) malloc(pkt_len);
-	pkt               = (icmp_echo_packet_t *) ip_pkt->data;
-	memset(ip_pkt, 0, sizeof(ip_packet_t));
-	/* |(pkt_len>>2);//5;//(IPVERSION << 4) | (sizeof(ip_packet_t) >> 2); */
-	ip_pkt->vers_ihl  = 0x45;
-	ip_pkt->tos       = IPTOS_LOWDELAY;
-	ip_pkt->pkt_len   = pkt_len;
-	/* kernel sets proper value htons(ip_id_counter); */
-	ip_pkt->id        = 0;
-	ip_pkt->flags_frag_offset	= 0;
-	/* default time to live (64) */
-	ip_pkt->ttl       = IPDEFTTL;
-	/* ICMP */
-	ip_pkt->proto     = 1;
-	/* maybe the kernel helps us out..? */
-	ip_pkt->checksum  = 0;
-	/* insert source IP address here */
-	ip_pkt->src_ip    = htonl(0x0);
-	/* htonl(0x7f000001); -> localhost.. */
-	ip_pkt->dst_ip    = dest_addr->sin_addr.s_addr;
-#else
 	pkt	              = (icmp_echo_packet_t *) calloc(1, pkt_len);
-#endif
-
 	/* ICMP Echo request or reply */
 	pkt->type         = type;
 	/* Must be zero (non-zero requires root) */
@@ -188,25 +157,15 @@ int queue_packet(int icmp_sock, uint8_t type, char *buf, int num_bytes,
 	/* Copy user data */
 	if (buf && num_bytes > 0)
 		memcpy(pt_pkt->data, buf, num_bytes);
-#if kPT_add_iphdr
-	pkt->checksum     = htons(calc_icmp_checksum((uint16_t*)pkt, pkt_len-sizeof(ip_packet_t)));
-	ip_pkt->checksum  = htons(calc_icmp_checksum((uint16_t*)ip_pkt, sizeof(ip_packet_t)));
-#else
 	pkt->checksum     = htons(calc_icmp_checksum((uint16_t*)pkt, pkt_len));
-#endif
 
 	/* Send it! */
 	pt_log(kLog_sendrecv, "Send: %d [%d] bytes [seq = %d] "
 	                      "[type = %s] [ack = %d] [icmp = %d] [user = %s]\n",
 	                      pkt_len, num_bytes, *seq, state_name[state & (~kFlag_mask)],
 	                      ack_val, type, ((state & kUser_flag) == kUser_flag ? "yes" : "no"));
-#if kPT_add_iphdr
-	err               = sendto(icmp_sock, (const void*)ip_pkt, pkt_len, 0,
-	                           (struct sockaddr*)dest_addr, sizeof(struct sockaddr));
-#else
 	err               = sendto(icmp_sock, (const void*)pkt, pkt_len, 0,
 	                           (struct sockaddr*)dest_addr, sizeof(struct sockaddr));
-#endif
 	if (err < 0) {
 		pt_log(kLog_error, "Failed to send ICMP packet: %s\n", strerror(errno));
 		return -1;
@@ -215,12 +174,7 @@ int queue_packet(int icmp_sock, uint8_t type, char *buf, int num_bytes,
 		pt_log(kLog_error, "WARNING WARNING, didn't send entire packet\n");
 
 	/* Update sequence no's and so on */
-#if kPT_add_iphdr
-	/* NOTE: Retry mechanism needs update for PT_add_ip_hdr */
-	ring[*insert_idx].pkt      = ip_pkt;
-#else
 	ring[*insert_idx].pkt      = pkt;
-#endif
 	ring[*insert_idx].pkt_len  = pkt_len;
 	ring[*insert_idx].last_resend = time_as_double();
 	ring[*insert_idx].seq_no   = *seq;

+ 0 - 0
pdesc.h → src/pdesc.h


+ 0 - 0
pkt.c → src/pkt.c


+ 0 - 0
pkt.h → src/pkt.h


+ 10 - 16
ptunnel.c → src/ptunnel.c

@@ -144,10 +144,12 @@ int main(int argc, char *argv[]) {
 	if (parse_options(argc, argv))
 		return -1;
 
+#ifdef HAVE_PCAP
 	if (opts.pcap && opts.udp) {
 		pt_log(kLog_error, "Packet capture is not supported (or needed) when using UDP for transport.\n");
 		opts.pcap = 0;
 	}
+#endif
 	pt_log(kLog_info, "Starting ptunnel v %d.%.2d.\n", kMajor_version, kMinor_version);
 	pt_log(kLog_info, "(c) 2004-2011 Daniel Stoedle, <daniels@cs.uit.no>\n");
 #ifdef WIN32
@@ -369,8 +371,6 @@ int pt_create_udp_socket(int port) {
 	return sock;
 }
 
-#define	kPT_add_iphdr	0
-
 /* pt_proxy: This function does all the client and proxy stuff.
  */
 void* pt_proxy(void *args) {
@@ -385,11 +385,15 @@ void* pt_proxy(void *args) {
 	char               *buf;
 	double             now, last_status_update = 0.0;
 	proxy_desc_t       *cur, *prev, *tmp;
+#ifdef HAVE_PCAP
 	pcap_info_t        pc;
+#endif
 	xfer_stats_t       xfer;
+#ifdef HAVE_PCAP
 	ip_packet_t        *pkt;
 	uint32_t           ip;
 	in_addr_t          *adr;
+#endif
 
 	/* Start the thread, initialize protocol and ring states. */
 	pt_log(kLog_debug, "Starting ping proxy..\n");
@@ -410,18 +414,8 @@ void* pt_proxy(void *args) {
 			fwd_sock		= socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
 		}
 		else {
-#if kPT_add_iphdr
-			int		opt = 1;
-#endif
 			pt_log(kLog_debug, "Attempting to create privileged ICMP raw socket..\n");
-#if kPT_add_iphdr
-			/* experimental */
-			fwd_sock		= socket(AF_INET, SOCK_RAW, IPPROTO_IP);
-			printf("Set ip-hdr-inc; result = %d\n",
-			       setsockopt(fwd_sock, IPPROTO_IP, IP_HDRINCL, &opt, sizeof(opt)));
-#else
 			fwd_sock		= socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
-#endif
 		}
 		if (fwd_sock < 0) {
 			pt_log(kLog_error, "Couldn't create %s socket: %s\n",
@@ -431,6 +425,7 @@ void* pt_proxy(void *args) {
 		}
 	}
 	max_sock			= fwd_sock+1;
+#ifdef HAVE_PCAP
 	if (opts.pcap) {
 		if (opts.udp) {
 			pt_log(kLog_error, "Packet capture is not useful with UDP [should not get here!]!\n");
@@ -483,6 +478,7 @@ void* pt_proxy(void *args) {
 		else
 			pt_log(kLog_info, "pcap disabled since we're running in unprivileged mode.\n");
 	}
+#endif
 
 	pthread_mutex_lock(&num_threads_lock);
 	num_threads++;
@@ -635,6 +631,7 @@ void* pt_proxy(void *args) {
 			}
 		}
 		pthread_mutex_unlock(&chain_lock);
+#ifdef HAVE_PCAP
 		if (opts.pcap) {
 			if (pcap_dispatch(pc.pcap_desc, 32, pcap_packet_handler, (u_char*)&pc.pkt_q) > 0) {
 				pqueue_elem_t	*cur;
@@ -656,6 +653,7 @@ void* pt_proxy(void *args) {
 				pc.pkt_q.head            = 0;
 			}
 		}
+#endif
 		/* Update running statistics, if requested (only once every second) */
 		if (opts.print_stats && opts.mode == kMode_forward && now > last_status_update+1) {
 			pthread_mutex_lock(&chain_lock);
@@ -750,10 +748,6 @@ void pcap_packet_handler(u_char *refcon, const struct pcap_pkthdr *hdr, const u_
 	q->elems++;
 }
 
-#if kPT_add_iphdr
-static int ip_id_counter = 1;
-#endif
-
 uint16_t calc_icmp_checksum(uint16_t *data, int bytes) {
 	uint32_t sum;
 	int      i;

+ 2 - 1
ptunnel.h → src/ptunnel.h

@@ -43,7 +43,6 @@
 #ifndef PING_TUNNEL_H
 #define PING_TUNNEL_H 1
 
-//	Includes
 #ifndef WIN32
 #include <sys/unistd.h>
 #include <sys/types.h>
@@ -108,6 +107,7 @@ typedef struct {
 	int elems;
 } pqueue_t;
 
+#ifdef HAVE_PCAP
 /* pcap_info_t: Structure to hold information related to packet capturing.
  */
 typedef struct {
@@ -123,6 +123,7 @@ typedef struct {
 	/** queue of packets to process */
 	pqueue_t pkt_q;
 } pcap_info_t;
+#endif
 
 /* function Prototypes */
 void*    pt_proxy(void *args);

+ 2 - 0
utils.c → src/utils.c

@@ -1,3 +1,5 @@
+#include <stdarg.h>
+
 #ifndef WIN32
 #include <syslog.h>
 #endif

+ 0 - 0
utils.h → src/utils.h


+ 2 - 2
web/index.html

@@ -1,12 +1,12 @@
 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
 <html>
 <head>
-<title>Ping Tunnel - Send TCP traffic over ICMP</title>
+<title>Ping Tunnel [N]ew[G]eneration - Send TCP traffic over ICMP</title>
 </head>
 <body>
 <TABLE BORDER=0 BGCOLOR="#999999" CELLSPACING=0 CELLPADDING=5 WIDTH="100%">
 <TR><TD BGCOLOR="#EEEEEE" VALIGN=TOP WIDTH="100%" COLSPAN=2>
-<h1>Ping Tunnel</h1>
+<h1>Ping Tunnel [N]ew[G]eneration</h1>
 <h4>For those times when everything else is blocked.</h4>
 <h5>By Daniel St&oslash;dle, daniels@cs.uit.no</h5>
 <h5><i>Last updated: 5. September 2011</i></h5>