From da9464d3e240a4d26adc08b840fa5be45d61b2a6 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 9 Nov 2015 01:18:08 +0100 Subject: [PATCH 1/8] Test under Linux and OSX, with gcc and clang Possibly link the rt library for clock_gettime() --- .travis.yml | 17 +++++++++++++++-- configure.ac | 7 +++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 66707a7..306758c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,20 @@ +sudo: false + language: c +os: + - linux + - osx + +compiler: + - clang + - gcc + before_script: - - ./autogen.sh + - export PKG_CONFIG_PATH=/tmp/lib/pkgconfig + - git clone https://github.com/jedisct1/libsodium.git --branch=stable + - cd libsodium && ./autogen.sh && ./configure --enable-minimal --disable-dependency-tracking --prefix=/tmp && make install && cd - + - ./autogen.sh script: - - ./configure && make + - ./configure --disable-dependency-tracking && make distcheck diff --git a/configure.ac b/configure.ac index 5b7c5d4..d6819f1 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,10 @@ AC_TYPE_SSIZE_T AC_TYPE_UINT8_T AC_TYPE_INT64_T AC_FUNC_MALLOC -AC_CHECK_FUNCS([clock_gettime socket strtol]) -PKG_CHECK_MODULES([libsodium], [libsodium >= 1.0.4]) +AC_CHECK_FUNCS([socket strtol]) +AC_SEARCH_LIBS(clock_gettime, [rt], + [AC_DEFINE(HAVE_CLOCK_GETTIME,[1],[define if you have clock_gettime()])]) +PKG_CHECK_MODULES([libsodium], [libsodium >= 1.0.4], + [CFLAGS="$CFLAGS $libsodium_CFLAGS"], [echo "not found"]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT From c1c5a5b09934cf96fb0e8a933192656380b96ac9 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 9 Nov 2015 01:44:55 +0100 Subject: [PATCH 2/8] Stop checking for things that any platform from the past 15 years has Add AC_USE_SYSTEM_EXTENSIONS --- configure.ac | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index d6819f1..0cd0487 100644 --- a/configure.ac +++ b/configure.ac @@ -7,15 +7,7 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AM_SILENT_RULES([yes]) AC_CONFIG_SRCDIR([common.h]) AC_PROG_CC_C99 -AC_CHECK_HEADERS([arpa/inet.h netdb.h stdint.h stdlib.h sys/ioctl.h sys/socket.h unistd.h]) -AC_C_INLINE -AC_C_RESTRICT -AC_TYPE_SIZE_T -AC_TYPE_SSIZE_T -AC_TYPE_UINT8_T -AC_TYPE_INT64_T -AC_FUNC_MALLOC -AC_CHECK_FUNCS([socket strtol]) +AC_USE_SYSTEM_EXTENSIONS AC_SEARCH_LIBS(clock_gettime, [rt], [AC_DEFINE(HAVE_CLOCK_GETTIME,[1],[define if you have clock_gettime()])]) PKG_CHECK_MODULES([libsodium], [libsodium >= 1.0.4], From aa917988deb431b6589ccb28fcc602e281f01f04 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 9 Nov 2015 01:49:45 +0100 Subject: [PATCH 3/8] Require automake 1.9, add automatic dependency tracking --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0cd0487..0341519 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,8 @@ AC_INIT([glorytun], [0.0.1], [https://github.com/angt/glorytun/issues], [glorytun], [https://github.com/angt/glorytun]) -AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AM_INIT_AUTOMAKE([1.9 -Wall -Werror foreign tar-ustar]) +AM_DEP_TRACK AM_SILENT_RULES([yes]) AC_CONFIG_SRCDIR([common.h]) AC_PROG_CC_C99 From 1fdf62a57a328d0b112d1c85db6cb949d6e1b9b4 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 9 Nov 2015 01:50:00 +0100 Subject: [PATCH 4/8] automake 2.65 is enough, and required for CentOS compatibility --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0341519..e8332e7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_PREREQ([2.68]) +AC_PREREQ([2.65]) AC_INIT([glorytun], [0.0.1], [https://github.com/angt/glorytun/issues], [glorytun], From baef8233dcbaefef14eee6fb528f1c03c20ffc27 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 9 Nov 2015 01:55:35 +0100 Subject: [PATCH 5/8] is required for uint8_t and friends --- glorytun.c | 1 + 1 file changed, 1 insertion(+) diff --git a/glorytun.c b/glorytun.c index 72d6194..95a00dd 100644 --- a/glorytun.c +++ b/glorytun.c @@ -1,6 +1,7 @@ #include "common-static.h" #include +#include #include #include #include From cc58c423961e3bb02763a93f3ffa18aa31fb89f3 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 9 Nov 2015 01:58:30 +0100 Subject: [PATCH 6/8] tcpinfo properties are uint32_t --- glorytun.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/glorytun.c b/glorytun.c index 95a00dd..8a5717e 100644 --- a/glorytun.c +++ b/glorytun.c @@ -1,5 +1,6 @@ #include "common-static.h" +#include #include #include #include @@ -216,12 +217,12 @@ static socklen_t sk_get_info (int fd, struct tcp_info *ti) static void print_tcp_info (struct tcp_info *ti) { fprintf(stderr, "tcpinfo" - " rto:%llu" " ato:%llu" " snd_mss:%llu" - " rcv_mss:%llu" " unacked:%llu" " sacked:%llu" - " lost:%llu" " retrans:%llu" " fackets:%llu" - " pmtu:%llu" " rcv_ssthresh:%llu" " rtt:%llu" - " rttvar:%llu" " snd_ssthresh:%llu" " snd_cwnd:%llu" - " advmss:%llu" " reordering:%llu" "\n", + " rto:%" PRIu32 " ato:%" PRIu32 " snd_mss:%" PRIu32 + " rcv_mss:%" PRIu32 " unacked:%" PRIu32 " sacked:%" PRIu32 + " lost:%" PRIu32 " retrans:%" PRIu32 " fackets:%" PRIu32 + " pmtu:%" PRIu32 " rcv_ssthresh:%" PRIu32 " rtt:%" PRIu32 + " rttvar:%" PRIu32 " snd_ssthresh:%" PRIu32 " snd_cwnd:%" PRIu32 + " advmss:%" PRIu32 " reordering:%" PRIu32 "\n", ti->tcpi_rto, ti->tcpi_ato, ti->tcpi_snd_mss, ti->tcpi_rcv_mss, ti->tcpi_unacked, ti->tcpi_sacked, ti->tcpi_lost, ti->tcpi_retrans, ti->tcpi_fackets, From 468b9df67ce631453ac40faf2a47739df3263d74 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 9 Nov 2015 02:03:21 +0100 Subject: [PATCH 7/8] The size in a %* formatter should be an int, not a size_t value --- glorytun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glorytun.c b/glorytun.c index 8a5717e..91f1180 100644 --- a/glorytun.c +++ b/glorytun.c @@ -567,7 +567,7 @@ static void option_usage (struct option *opts, char *name) size_t inc = str_len(opts[k].name)+(isflag?0:4)+4; if (len+inc>60) { - printf("\n%*s", slen, ""); + printf("\n%*s", (int) slen, ""); len = 0; } printf(" [%s%s]", opts[k].name, isflag?"":" ARG"); From fd35fae472acbccb6f1967c75c0545763bf818b0 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 9 Nov 2015 02:30:55 +0100 Subject: [PATCH 8/8] IllumOS requires resolv, nsl and socket --- configure.ac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e8332e7..5c8f874 100644 --- a/configure.ac +++ b/configure.ac @@ -9,8 +9,10 @@ AM_SILENT_RULES([yes]) AC_CONFIG_SRCDIR([common.h]) AC_PROG_CC_C99 AC_USE_SYSTEM_EXTENSIONS -AC_SEARCH_LIBS(clock_gettime, [rt], +AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE(HAVE_CLOCK_GETTIME,[1],[define if you have clock_gettime()])]) +AC_SEARCH_LIBS([getaddrinfo], [resolv nsl]) +AC_SEARCH_LIBS([socket], [socket]) PKG_CHECK_MODULES([libsodium], [libsodium >= 1.0.4], [CFLAGS="$CFLAGS $libsodium_CFLAGS"], [echo "not found"]) AC_CONFIG_FILES([Makefile])