aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2017-12-19 02:03:02 +0100
committerToni Uhlig <matzeton@googlemail.com>2017-12-19 02:03:02 +0100
commit23bcd14d85b272e486ff90e1f761dadd4d9508e1 (patch)
treec173d5d785eebcd45aea8ba99c5b23fce2a0e217
parent3c491a8bec71606b7af5f1d8c34de8e9710bbe13 (diff)
ptunnel-ng:
* autotools set/use package version string * autotools renamed output binary to ptunnel-ng * more "intuitive" short options * removed ptunnel version info, copyright update
-rw-r--r--configure.ac2
-rw-r--r--src/Makefile.am11
-rw-r--r--src/options.c15
-rw-r--r--src/pconfig.h3
-rw-r--r--src/ptunnel-ng.8 (renamed from ptunnel.8)0
-rw-r--r--src/ptunnel.c9
6 files changed, 22 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac
index b9c437f..85d2539 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ(2.69)
-AC_INIT([ptunnel-ng], [1.0.0], [], [], [])
+AC_INIT([ptunnel-ng], [1.0], [], [], [])
AC_CONFIG_SRCDIR([src/config.h.in])
AC_CONFIG_FILES([Makefile src/Makefile])
diff --git a/src/Makefile.am b/src/Makefile.am
index b51bad2..4e802cc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,14 +1,15 @@
-bin_PROGRAMS = ptunnel
+bin_PROGRAMS = ptunnel-ng
+man8_MANS = ptunnel-ng.8
-ptunnel_CFLAGS = -Wall
+ptunnel_ng_CFLAGS = -Wall
if HAVE_PCAP
-ptunnel_CFLAGS += -DHAVE_PCAP=1
+ptunnel_ng_CFLAGS += -DHAVE_PCAP=1
endif
if HAVE_SELINUX
-ptunnel_CFLAGS += -DHAVE_SELINUX=1
+ptunnel_ng_CFLAGS += -DHAVE_SELINUX=1
endif
-ptunnel_SOURCES = \
+ptunnel_ng_SOURCES = \
md5.c \
challenge.c \
options.c \
diff --git a/src/options.c b/src/options.c
index 0c9bbe8..d8061bd 100644
--- a/src/options.c
+++ b/src/options.c
@@ -6,6 +6,9 @@
#include <ctype.h>
#include <assert.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include "options.h"
#include "utils.h"
#include "ptunnel.h"
@@ -138,10 +141,10 @@ static struct option long_options[] = {
{"remote-port", optional_argument, 0, 'R'},
{"connections", required_argument, 0, 'c'},
{"verbosity", required_argument, 0, 'v'},
- {"libpcap", required_argument, 0, 'a'},
+ {"libpcap", required_argument, 0, 'L'},
{"logfile", optional_argument, 0, 'o'},
{"statistics", no_argument, 0, 's'},
- {"passwd", required_argument, 0, 'x'},
+ {"passwd", required_argument, 0, 'P'},
{"udp", no_argument, &opts.udp, 1 },
{"unprivileged", no_argument, &opts.unprivileged, 1 },
{"base64", no_argument, &opts.base64, 1 },
@@ -292,7 +295,7 @@ static void print_short_help(unsigned index, int required_state) {
void print_usage(const char *arg0) {
unsigned i;
- printf("ptunnel-ng v%d.%.2d\n\nUsage: %s", kMajor_version, kMinor_version, arg0);
+ printf("%s\n\nUsage: %s", PACKAGE_STRING, arg0);
/* print (short)help argument line */
for (i = 0; i < ARRAY_SIZE(usage); ++i) {
print_short_help(i, 1);
@@ -328,7 +331,7 @@ int parse_options(int argc, char **argv) {
/* parse command line arguments */
while (1) {
- c = getopt_long(argc, argv, "m:p:l:r::R::c:v:a::o::sd::Sx:u::g::C::eh", &long_options[0], &optind);
+ c = getopt_long(argc, argv, "m:p:l:r::R::c:v:L::o::sP:d::Su::g::C::eh", &long_options[0], &optind);
if (c == -1) break;
switch (c) {
@@ -364,7 +367,7 @@ int parse_options(int argc, char **argv) {
case 'v':
opts.log_level = strtol(optarg, NULL, 10);
break;
- case 'a':
+ case 'L':
#ifdef HAVE_PCAP
opts.pcap = 1;
if (!optarg)
@@ -388,7 +391,7 @@ int parse_options(int argc, char **argv) {
case 's':
opts.print_stats = !opts.print_stats;
break;
- case 'x':
+ case 'P':
if (opts.password)
free(opts.password);
opts.password = strdup(optarg);
diff --git a/src/pconfig.h b/src/pconfig.h
index 4adabc9..0d79167 100644
--- a/src/pconfig.h
+++ b/src/pconfig.h
@@ -18,10 +18,7 @@ enum {
kLog_verbose,
kLog_debug,
kLog_sendrecv,
- /** Major (0.xx) and minor (x.70) version */
- kMajor_version = 0,
/** numbers */
- kMinor_version = 72,
kIP_packet_max_size = 576,
/** In bytes, mind you */
kIP_header_size = 20,
diff --git a/ptunnel.8 b/src/ptunnel-ng.8
index 2377b2f..2377b2f 100644
--- a/ptunnel.8
+++ b/src/ptunnel-ng.8
diff --git a/src/ptunnel.c b/src/ptunnel.c
index 0af75f8..95ebbac 100644
--- a/src/ptunnel.c
+++ b/src/ptunnel.c
@@ -42,7 +42,9 @@
*
* Note that the source code is best viewed with tabs set to 4 spaces.
*/
-
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include "ptunnel.h"
#include "options.h"
#include "utils.h"
@@ -150,8 +152,9 @@ int main(int argc, char *argv[]) {
opts.pcap = 0;
}
#endif
- pt_log(kLog_info, "Starting ptunnel v %d.%.2d.\n", kMajor_version, kMinor_version);
+ pt_log(kLog_info, "Starting %s.\n", PACKAGE_STRING);
pt_log(kLog_info, "(c) 2004-2011 Daniel Stoedle, <daniels@cs.uit.no>\n");
+ pt_log(kLog_info, "(c) 2017 Toni Uhlig, <matzeton@googlemail.com>\n");
#ifdef WIN32
pt_log(kLog_info, "Windows version by Mike Miller, <mike@mikeage.net>\n");
#else
@@ -635,7 +638,7 @@ void* pt_proxy(void *args) {
if (opts.pcap) {
if (pcap_dispatch(pc.pcap_desc, 32, pcap_packet_handler, (u_char*)&pc.pkt_q) > 0) {
pqueue_elem_t *cur;
- /* pt_log(kLog_verbose, "pcap captured %d packets - handling them..\n", pc.pkt_q.elems); */
+ pt_log(kLog_verbose, "pcap captured %d packets - handling them..\n", pc.pkt_q.elems);
while (pc.pkt_q.head) {
cur = pc.pkt_q.head;
memset(&addr, 0, sizeof(struct sockaddr));