From f68f7cfc252e1ed8b73591776757a1a594c91f16 Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 2 Apr 2014 12:10:48 +0100 Subject: [PATCH 01/17] document compilation requirements for systemd support on Debian --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index e3f6a38..e46a14c 100644 --- a/README +++ b/README @@ -263,6 +263,7 @@ quence, assuming at most one client will be connected at any time. A small DNSCACHE_LEN is still advised, preferably 2 or higher, however you can also undefine it to save a few more kilobytes. +For systemd support on Debian, compile with libsystemd-daemon-dev installed. PERFORMANCE: From 5cb67a4ab4f81fbd2f4b4e9a115673e0210499ad Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Thu, 24 Apr 2014 15:03:47 +0100 Subject: [PATCH 02/17] prep for autotools: autoconf defines VERSION so s/VERSION/PROTOCOL_VERSION/ --- src/client.c | 7 ++++--- src/iodined.c | 4 ++-- src/version.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/client.c b/src/client.c index efb0f51..0e1674f 100644 --- a/src/client.c +++ b/src/client.c @@ -1387,7 +1387,7 @@ handshake_version(int dns_fd, int *seed) for (i = 0; running && i < 5; i++) { - send_version(dns_fd, VERSION); + send_version(dns_fd, PROTOCOL_VERSION); read = handshake_waitdns(dns_fd, in, sizeof(in), 'v', 'V', i+1); @@ -1403,11 +1403,12 @@ handshake_version(int dns_fd, int *seed) userid_char = hex[userid & 15]; userid_char2 = hex2[userid & 15]; - fprintf(stderr, "Version ok, both using protocol v 0x%08x. You are user #%d\n", VERSION, userid); + fprintf(stderr, "Version ok, both using protocol v 0x%08x. You are user #%d\n", + PROTOCOL_VERSION, userid); return 0; } else if (strncmp("VNAK", in, 4) == 0) { warnx("You use protocol v 0x%08x, server uses v 0x%08x. Giving up", - VERSION, payload); + PROTOCOL_VERSION, payload); return 1; } else if (strncmp("VFUL", in, 4) == 0) { warnx("Server full, all %d slots are taken. Try again later", payload); diff --git a/src/iodined.c b/src/iodined.c index 75979d9..8e579bf 100644 --- a/src/iodined.c +++ b/src/iodined.c @@ -748,7 +748,7 @@ handle_null_request(int tun_fd, int dns_fd, struct query *q, int domain_len) ((unpacked[3] & 0xff))); } - if (version == VERSION) { + if (version == PROTOCOL_VERSION) { userid = find_available_user(); if (userid >= 0) { int i; @@ -809,7 +809,7 @@ handle_null_request(int tun_fd, int dns_fd, struct query *q, int domain_len) format_addr(&q->from, q->fromlen)); } } else { - send_version_response(dns_fd, VERSION_NACK, VERSION, 0, q); + send_version_response(dns_fd, VERSION_NACK, PROTOCOL_VERSION, 0, q); syslog(LOG_INFO, "dropped user from %s, sent bad version %08X", format_addr(&q->from, q->fromlen), version); } diff --git a/src/version.h b/src/version.h index 1561b9e..69f1143 100644 --- a/src/version.h +++ b/src/version.h @@ -19,7 +19,7 @@ /* This is the version of the network protocol It is usually equal to the latest iodine version number */ -#define VERSION 0x00000502 +#define PROTOCOL_VERSION 0x00000502 #endif /* _VERSION_H_ */ From 1619dd186399dcbf95fa6ee34509785fde60ee63 Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Thu, 24 Apr 2014 23:09:24 +0100 Subject: [PATCH 03/17] prep for autotools: conditionally #include "config.h" in *.c --- src/base128.c | 4 ++++ src/base32.c | 4 ++++ src/base64.c | 4 ++++ src/client.c | 4 ++++ src/common.c | 4 ++++ src/dns.c | 4 ++++ src/encoding.c | 4 ++++ src/fw_query.c | 4 ++++ src/iodine.c | 4 ++++ src/iodined.c | 4 ++++ src/login.c | 4 ++++ src/read.c | 4 ++++ src/tun.c | 4 ++++ src/user.c | 4 ++++ src/util.c | 4 ++++ tests/base32.c | 4 ++++ tests/base64.c | 4 ++++ tests/common.c | 4 ++++ tests/dns.c | 4 ++++ tests/encoding.c | 4 ++++ tests/fw_query.c | 4 ++++ tests/login.c | 4 ++++ tests/read.c | 4 ++++ tests/test.c | 4 ++++ tests/user.c | 4 ++++ 25 files changed, 100 insertions(+) diff --git a/src/base128.c b/src/base128.c index 32a29f8..7ce6642 100644 --- a/src/base128.c +++ b/src/base128.c @@ -28,6 +28,10 @@ * 1000 8 */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/base32.c b/src/base32.c index 8731a92..c25e0a4 100644 --- a/src/base32.c +++ b/src/base32.c @@ -15,6 +15,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/base64.c b/src/base64.c index 5218c09..a8e9e1c 100644 --- a/src/base64.c +++ b/src/base64.c @@ -15,6 +15,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/client.c b/src/client.c index 0e1674f..f94f5e7 100644 --- a/src/client.c +++ b/src/client.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/common.c b/src/common.c index 5f202da..909d1f1 100644 --- a/src/common.c +++ b/src/common.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/dns.c b/src/dns.c index bd1257f..dccea3a 100644 --- a/src/dns.c +++ b/src/dns.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/encoding.c b/src/encoding.c index 4b5fb08..5be4089 100644 --- a/src/encoding.c +++ b/src/encoding.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "common.h" #include "encoding.h" diff --git a/src/fw_query.c b/src/fw_query.c index 3727f08..3aa12b4 100644 --- a/src/fw_query.c +++ b/src/fw_query.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "fw_query.h" diff --git a/src/iodine.c b/src/iodine.c index 519eac3..5f0fd63 100644 --- a/src/iodine.c +++ b/src/iodine.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/iodined.c b/src/iodined.c index 8e579bf..62ab7b9 100644 --- a/src/iodined.c +++ b/src/iodined.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/login.c b/src/login.c index c562050..8641918 100644 --- a/src/login.c +++ b/src/login.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include diff --git a/src/read.c b/src/read.c index f4ad4a8..9fdd656 100644 --- a/src/read.c +++ b/src/read.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/tun.c b/src/tun.c index bc5c153..dd24b2d 100644 --- a/src/tun.c +++ b/src/tun.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/user.c b/src/user.c index f5ad924..2f711eb 100644 --- a/src/user.c +++ b/src/user.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/src/util.c b/src/util.c index 7a365ac..6f2a0bc 100644 --- a/src/util.c +++ b/src/util.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "common.h" diff --git a/tests/base32.c b/tests/base32.c index f007798..7b29fe9 100644 --- a/tests/base32.c +++ b/tests/base32.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/tests/base64.c b/tests/base64.c index a259b23..c32c464 100644 --- a/tests/base64.c +++ b/tests/base64.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/tests/common.c b/tests/common.c index 92f2d4c..2d8122a 100644 --- a/tests/common.c +++ b/tests/common.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/tests/dns.c b/tests/dns.c index 9e89027..04ff190 100644 --- a/tests/dns.c +++ b/tests/dns.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/tests/encoding.c b/tests/encoding.c index ac22452..5804e77 100644 --- a/tests/encoding.c +++ b/tests/encoding.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/tests/fw_query.c b/tests/fw_query.c index 6d23924..0892b88 100644 --- a/tests/fw_query.c +++ b/tests/fw_query.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "fw_query.h" diff --git a/tests/login.c b/tests/login.c index 1ef23f4..15bd55d 100644 --- a/tests/login.c +++ b/tests/login.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include diff --git a/tests/read.c b/tests/read.c index f51d0aa..387a223 100644 --- a/tests/read.c +++ b/tests/read.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/tests/test.c b/tests/test.c index e897cc2..04549bf 100644 --- a/tests/test.c +++ b/tests/test.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include diff --git a/tests/user.c b/tests/user.c index 00a3a8e..2095429 100644 --- a/tests/user.c +++ b/tests/user.c @@ -14,6 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include From 469edfa1b654d1ee43577179acb0e29d5d8c94bd Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Thu, 24 Apr 2014 12:08:26 +0100 Subject: [PATCH 04/17] autotoolize --- Makefile | 80 ----------------------- Makefile.am | 151 +++++++++++++++++++++++++++++++++++++++++++ configure.ac | 171 +++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile | 48 -------------- src/osflags | 45 ------------- tests/Makefile | 26 -------- 6 files changed, 322 insertions(+), 199 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100644 configure.ac delete mode 100644 src/Makefile delete mode 100755 src/osflags delete mode 100644 tests/Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index c378892..0000000 --- a/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -prefix?=/usr/local -sbindir=$(prefix)/sbin -datadir=$(prefix)/share -mandir=$(datadir)/man - -DESTDIR= - -INSTALL=install -INSTALL_FLAGS= - -MKDIR=mkdir -MKDIR_FLAGS=-p - -RM=rm -RM_FLAGS=-f - -TARGETOS = `uname` - -all: - @(cd src; $(MAKE) TARGETOS=$(TARGETOS) all) - -cross-android: - @(cd src; $(MAKE) base64u.c base64u.h) - @(cd src; ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk) - -cross-android-dist: - @rm -rf iodine-latest-android* - @mkdir -p iodine-latest-android/armeabi iodine-latest-android/x86 - @$(MAKE) cross-android TARGET_ARCH_ABI=armeabi - @cp src/libs/armeabi/* iodine-latest-android/armeabi - @$(MAKE) cross-android TARGET_ARCH_ABI=x86 - @cp src/libs/x86/* iodine-latest-android/x86 - @cp README README-android.txt CH* TO* iodine-latest-android - @echo "Create date: " > iodine-latest-android/VERSION - @date >> iodine-latest-android/VERSION - @echo "Git version: " >> iodine-latest-android/VERSION - @git rev-parse HEAD >> iodine-latest-android/VERSION - @zip -r iodine-latest-android.zip iodine-latest-android - -cross-mingw: - @(cd src; $(MAKE) TARGETOS=windows32 CC=i686-mingw32-gcc all) - -cross-mingw-dist: cross-mingw - @rm -rf iodine-latest-win32* - @mkdir -p iodine-latest-win32/bin - @for i in `ls bin`; do cp bin/$$i iodine-latest-win32/bin/$$i.exe; done - @cp /usr/i686-mingw32/usr/bin/zlib1.dll iodine-latest-win32/bin - @cp README README-win32.txt CH* TO* iodine-latest-win32 - @echo "Create date: " > iodine-latest-win32/VERSION - @date >> iodine-latest-win32/VERSION - @echo "Git version: " >> iodine-latest-win32/VERSION - @git rev-parse HEAD >> iodine-latest-win32/VERSION - @zip -r iodine-latest-win32.zip iodine-latest-win32 - -install: all - $(MKDIR) $(MKDIR_FLAGS) $(DESTDIR)$(sbindir) - $(INSTALL) $(INSTALL_FLAGS) bin/iodine $(DESTDIR)$(sbindir)/iodine - chmod 755 $(DESTDIR)$(sbindir)/iodine - $(INSTALL) $(INSTALL_FLAGS) bin/iodined $(DESTDIR)$(sbindir)/iodined - chmod 755 $(DESTDIR)$(sbindir)/iodined - $(MKDIR) $(MKDIR_FLAGS) $(DESTDIR)$(mandir)/man8 - $(INSTALL) $(INSTALL_FLAGS) man/iodine.8 $(DESTDIR)$(mandir)/man8/iodine.8 - chmod 644 $(DESTDIR)$(mandir)/man8/iodine.8 - -uninstall: - $(RM) $(RM_FLAGS) $(DESTDIR)$(sbindir)/iodine - $(RM) $(RM_FLAGS) $(DESTDIR)$(sbindir)/iodined - $(RM) $(RM_FLAGS) $(DESTDIR)$(mandir)/man8/iodine.8 - -test: all - @echo "!! The check library is required for compiling and running the tests" - @echo "!! Get it at http://check.sf.net" - @(cd tests; $(MAKE) TARGETOS=$(TARGETOS) all) - -clean: - @echo "Cleaning..." - @(cd src; $(MAKE) clean) - @(cd tests; $(MAKE) clean) - @rm -rf bin iodine-latest-win32* iodine-latest-android* - diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..e498503 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,151 @@ +## Process this file with automake to produce Makefile.in + +################################################################ +## shared ## +################################################################ + +AM_CPPFLAGS = -D$(OS) +AM_CFLAGS = -g -Wall -pedantic + + +################################################################ +## docs ## +################################################################ + +dist_man_MANS = man/iodine.8 +dist_doc_DATA = CHANGELOG README README-android.txt README-win32.txt \ + TODO doc/proto_00000402.txt doc/proto_00000500.txt \ + doc/proto_00000502.txt + + +################################################################ +## misc ## +################################################################ + +EXTRA_DIST = .travis.yml doc/iodine-server.service \ + doc/iodine-server.socket doc/iodine.te src/Android.mk + + +################################################################ +## src/ ## +################################################################ + +sbin_PROGRAMS = iodine iodined + +COMMONSRC0 = src/base32.c src/base64.c src/common.c src/dns.c \ + src/encoding.c src/login.c src/md5.c src/read.c + +COMMONSRC = $(COMMONSRC0) src/base128.c src/tun.c src/base64u.c \ + src/base64u.h src/android_dns.h src/base128.h src/base32.h \ + src/base64.h src/common.h src/dns.h src/encoding.h src/login.h \ + src/md5.h src/read.h src/tun.h src/version.h src/windows.h + +iodine_SOURCES = $(COMMONSRC) src/iodine.c src/client.c src/util.c \ + src/client.h src/util.h + +iodined_SOURCES = $(COMMONSRC) src/iodined.c src/user.c \ + src/fw_query.c src/fw_query.h src/user.h + +EXTRA_DIST += src/android_dns.h src/base128.h src/base32.h \ + src/base64.h src/client.h src/common.h src/dns.h src/encoding.h \ + src/fw_query.h src/login.h src/md5.h src/read.h src/tun.h src/user.h \ + src/util.h src/version.h src/windows.h + +src/base64u.c: src/base64.c + @echo Making $@ + @echo '/* No use in editing, produced by Makefile! */' > $@ + sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < $< >> $@ + +src/base64u.h: src/base64.h + @echo Making $@ + @echo '/* No use in editing, produced by Makefile! */' > $@ + sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < $< >> $@ + +BUILT_SOURCES = src/base64u.c src/base64u.h + +MOSTLYCLEANFILES = src/base64u.c src/base64u.h + +clean-local: + @echo Clean Android Stuff + -rm -rf src/obj src/libs + + +################################################################ +## tests/ ## +################################################################ + +if HAVE_CHECK +TESTS = test-iodine +noinst_PROGRAMS = test-iodine + +test_iodine_SOURCES = tests/test.c tests/base32.c tests/base64.c \ + tests/common.c tests/read.c tests/dns.c tests/encoding.c \ + tests/login.c tests/user.c tests/fw_query.c $(COMMONSRC0) src/user.c \ + src/fw_query.c + +EXTRA_DIST += tests/test.h + +test_iodine_LDADD = $(CHECK_LIBS) +test_iodine_CFLAGS = $(AM_CFLAGS) $(CHECK_CFLAGS) +test_iodine_CPPFLAGS = $(AM_CPPFLAGS) -I src +endif + + +################################################################ +## Ancient History ## +################################################################ + +# retain compatibility with former target "test" + +.PHONY: test +test: check + +# Compile for Android. + +# It is likely possible to tweak autotools into supporting this +# configuration, once that is tested the below should be removed. + +.PHONY: cross-android +cross-android: src/base64u.c src/base64u.h + (cd src; ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk) + +.PHONY: cross-android-dist +cross-android-dist: + rm -rf iodine-latest-android* + mkdir -p iodine-latest-android/armeabi iodine-latest-android/x86 + $(MAKE) cross-android TARGET_ARCH_ABI=armeabi + cp src/libs/armeabi/* iodine-latest-android/armeabi + $(MAKE) cross-android TARGET_ARCH_ABI=x86 + cp src/libs/x86/* iodine-latest-android/x86 + cp README README-android.txt CH* TO* iodine-latest-android/ + echo "Create date: " > iodine-latest-android/VERSION + date >> iodine-latest-android/VERSION + echo "Git version: " >> iodine-latest-android/VERSION + echo $(GITREVISION) >> iodine-latest-android/VERSION + zip -r iodine-latest-android.zip iodine-latest-android + +# Compile for MS Windows. + +# This platform is supported by autotools, so the below should be removed once +# autotools is tested in that configuration. + +.PHONY: cross-mingw +cross-mingw: + echo "WARNING:" + echo "This make target is unlikely to work properly." + echo "Cross compilation is supported by autotools." + echo " ./configure --build=turingmachine-unknown-linux-gnu --host=mingw32" + $(MAKE) OS=WINDOWS32 CC=i686-mingw32-gcc all + +.PHONY: cross-mingw-dist +cross-mingw-dist: cross-mingw + rm -rf iodine-latest-win32* + mkdir -p iodine-latest-win32/bin + for i in `ls bin`; do cp bin/$$i iodine-latest-win32/bin/$$i.exe; done + cp /usr/i686-mingw32/usr/bin/zlib1.dll iodine-latest-win32/bin/ + cp README README-win32.txt CH* TO* iodine-latest-win32/ + echo "Create date: " > iodine-latest-win32/VERSION + date >> iodine-latest-win32/VERSION + echo "Git version: " >> iodine-latest-win32/VERSION + echo $(GITREVISION) >> iodine-latest-win32/VERSION + zip -r iodine-latest-win32.zip iodine-latest-win32 diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..4a6fc9f --- /dev/null +++ b/configure.ac @@ -0,0 +1,171 @@ +# Process this file with autoconf to produce a configure script. + +# Prologue + +AC_PREREQ([2.69]) +AC_INIT([iodine],[0.6.0rc1],[erik@kryo.se],[],[http://dev.kryo.se/iodine/]) +AC_CONFIG_SRCDIR([src/iodine.c]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([autotools]) +AC_CONFIG_AUX_DIR([autotools]) +AM_INIT_AUTOMAKE([subdir-objects foreign -Wall]) + +# Misc + +# Define OS to upcased "uname --kernel-name", i.e., LINUX, DARWIN, etc. +# Used by Makefile.am as cpp symbol to define. +# We use autotools canonical designation to allow cross compilation. +# It would be reasonable to, at some point, update the C sources to +# use these more canonical designations. +# But for now, we must adjust some of them. + +AC_MSG_CHECKING([environment to compile for]) +AC_CANONICAL_HOST + +# No need to adjust these: FREEBSD, NETBSD, OPENBSD, BEOS +AS_CASE([${host_os}], + [linux-gnu], [OS=LINUX], + [mingw32], [OS=WINDOWS32], + [macos], [OS=DARWIN], + [linux-android], [OS=ANDROID], + [OS="$(echo ${host_os}|tr "a-z" "A-Z_")"]) + +uname_os="$(uname | tr "a-z" "A-Z")" + +AC_MSG_NOTICE([host_os: ${host_os}]) +AC_MSG_NOTICE([uname_os: ${uname_os}]) +AC_MSG_NOTICE([adjusted OS: ${OS}]) + +AC_SUBST([OS]) + +AS_CASE([${OS}], + [WINDOWS32], + AC_DEFINE([WINVER],[0x0501], + [Define appropriately on MS Windows 32])) + +# The AC_SUBST for GITREVISION is used only in legacy stanza; remove +# when unused in Makefile.am, leaving only the config.h #define. + +AC_SUBST([GITREVISION],[$(git describe --always || echo not-in-git)]) +AC_DEFINE_UNQUOTED([GITREVISION],["${GITREVISION}"], + [Precise git commit checked out when building]) + +# Checks for programs + +AC_PROG_CC +AC_PROG_INSTALL + +# Process options + +AC_ARG_ENABLE([systemd], + [AS_HELP_STRING([--enable-systemd], + [enable systemd support @<:@default=check@:>@])],, + [enable_systemd=check]) + +AC_ARG_ENABLE([selinux], + [AS_HELP_STRING([--enable-selinux], + [enable selinux support @<:@default=check@:>@])],, + [enable_selinux=check]) + +# Checks for libraries + +# Unclear why pthread is needed. +# Uncomment and replace ? by called procedure requiring -lpthread. +#AC_SEARCH_LIBS([?], [pthread]) + +AC_SEARCH_LIBS([uncompress], [z]) + +# Enable systemd per option by setting HAVE_SYSTEMD + +AS_CASE([${enable_systemd}], + [yes|check], + [AC_MSG_CHECKING([systemd]) + AC_SEARCH_LIBS([sd_listen_fds], [systemd-daemon]) + AC_CHECK_FUNC([sd_listen_fds], + [AC_MSG_RESULT([enabled: systemd]) + AC_DEFINE([HAVE_SYSTEMD],[1], + [Define to 1 to enable systemd support])], + AS_CASE([${enable_systemd}], + [yes], + AC_MSG_ERROR([systemd support not available]), + AC_MSG_RESULT([disabled: systemd])))], + [no],, + [AC_MSG_ERROR([invalid argument, --enable-systemd=${enable_systemd}])]) + +# Enable selinux per option by setting HAVE_SETCON + +AS_CASE([${enable_selinux}], + [yes|check], + [AC_SEARCH_LIBS([setcon], [selinux]) + AC_CHECK_FUNCS([setcon], + AC_MSG_RESULT([enabled: selinux]), + AS_CASE([${enable_selinux}], + [yes], + AC_MSG_ERROR([selinux support not available]), + [check], + AC_MSG_RESULT([disabled: selinux])))], + [no], + AC_MSG_RESULT([disabled: selinux]), + [AC_MSG_ERROR([invalid argument, --enable-selinux=${enable_selinux}])]) + +# The check library is used for the unit testing. Not bothering to +# implement an --enable-tests option, as they are only run by "make +# check" so there is no user-level difference. If the unit tests +# won't even *compile* there is probably a better solution than just +# turning them off, and build time is minimal. + +PKG_CHECK_MODULES(CHECK,[check], + AC_MSG_RESULT([enabled: unit testing]), + AC_MSG_RESULT([disabled: unit testing])) + +AM_CONDITIONAL([HAVE_CHECK],[test -z "${CHECK_PKG_ERRORS}"]) + +# For each commented AC_SEARCH_LIBS below, uncomment and replace ? by +# called procedure provided only by that library on the platform(s) in +# question. + +# for SunOS / solaris: +#AC_SEARCH_LIBS([?], [nsl]) + +# for BeOS: +#AC_SEARCH_LIBS([?], [bind]) +#AC_SEARCH_LIBS([?], [bsd]) + +# for SunOS / solaris / BeOS: +#AC_SEARCH_LIBS([?], [socket]) + +# for Haiku: +#AC_SEARCH_LIBS([?], [network]) + +# for MS windows32: +#AC_SEARCH_LIBS([?], [ws2_32]) +#AC_SEARCH_LIBS([?], [iphlpapi]) + +# Checks for headers + +AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h systemd/sd-daemon.h selinux/selinux.h]) + +# Checks for typedefs, structures, and compiler characteristics + +AC_CHECK_TYPES([socklen_t],, + AC_DEFINE([socklen_t],[int], + [define to int if type socklen_t not found])) + +AC_TYPE_UID_T +AC_C_INLINE +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT8_T + +# Checks for library functions + +AC_FUNC_FORK +AC_FUNC_MALLOC +AC_CHECK_FUNCS([alarm dup2 inet_ntoa memset select socket strcasecmp strchr strdup strerror strrchr strstr]) + +# Epilogue + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 5fbfbbd..0000000 --- a/src/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -COMMONOBJS = tun.o dns.o read.o encoding.o login.o base32.o base64.o base64u.o base128.o md5.o common.o -CLIENTOBJS = iodine.o client.o util.o -CLIENT = ../bin/iodine -SERVEROBJS = iodined.o user.o fw_query.o -SERVER = ../bin/iodined - -OS = `echo $(TARGETOS) | tr "a-z" "A-Z"` -ARCH = `uname -m` -HEAD_COMMIT = `git rev-parse --short HEAD` - -LIBPATH = -L. -LDFLAGS += -lz `sh osflags $(TARGETOS) link` $(LIBPATH) -CFLAGS += -c -g -Wall -D$(OS) -pedantic `sh osflags $(TARGETOS) cflags` -DGITREVISION=\"$(HEAD_COMMIT)\" - -all: stateos $(CLIENT) $(SERVER) - -stateos: - @echo OS is $(OS), arch is $(ARCH) - -$(CLIENT): $(COMMONOBJS) $(CLIENTOBJS) - @echo LD $@ - @mkdir -p ../bin - @$(CC) $(COMMONOBJS) $(CLIENTOBJS) -o $(CLIENT) $(LDFLAGS) - -$(SERVER): $(COMMONOBJS) $(SERVEROBJS) - @echo LD $@ - @mkdir -p ../bin - @$(CC) $(COMMONOBJS) $(SERVEROBJS) -o $(SERVER) $(LDFLAGS) - -.c.o: - @echo CC $< - @$(CC) $(CFLAGS) $< -o $@ - -base64u.o client.o iodined.o: base64u.h -base64u.c: base64.c - @echo Making $@ - @echo '/* No use in editing, produced by Makefile! */' > $@ - @sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < base64.c >> $@ -base64u.h: base64.h - @echo Making $@ - @echo '/* No use in editing, produced by Makefile! */' > $@ - @sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < base64.h >> $@ - -clean: - @echo "Cleaning src/" - @rm -f $(CLIENT){,.exe} $(SERVER){,.exe} *~ *.o *.core base64u.* - @rm -rf obj libs #android stuff - diff --git a/src/osflags b/src/osflags deleted file mode 100755 index 2d8a03b..0000000 --- a/src/osflags +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -case $2 in -link) - - case $1 in - SunOS | solaris) - echo '-lsocket -lnsl'; - ;; - BeOS) - echo '-lsocket -lbind -lbsd'; - ;; - Haiku) - echo '-lnetwork'; - ;; - windows32) - echo '-lws2_32 -liphlpapi'; - ;; - Linux) - FLAGS=""; - [ -e /usr/include/selinux/selinux.h ] && FLAGS="$FLAGS -lselinux"; - [ -e /usr/include/systemd/sd-daemon.h ] && FLAGS="$FLAGS -lsystemd-daemon"; - echo $FLAGS; - ;; - esac - ;; -cflags) - case $1 in - windows32) - echo '-DWINVER=0x0501'; - ;; - BeOS) - echo '-Dsocklen_t=int'; - ;; - Linux) - FLAGS=""; - [ -e /usr/include/selinux/selinux.h ] && FLAGS="$FLAGS -DHAVE_SETCON"; - [ -e /usr/include/systemd/sd-daemon.h ] && FLAGS="$FLAGS -DHAVE_SYSTEMD"; - echo $FLAGS; - ;; - esac -;; -*) -;; -esac diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index d40f4c7..0000000 --- a/tests/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -CC = gcc -TEST = test -OBJS = test.o base32.o base64.o common.o read.o dns.o encoding.o login.o user.o fw_query.o -SRCOBJS = ../src/base32.o ../src/base64.o ../src/common.o ../src/read.o ../src/dns.o ../src/encoding.o ../src/login.o ../src/md5.o ../src/user.o ../src/fw_query.o - -OS = `uname | tr "a-z" "A-Z"` - -CHECK_PATH = /usr/local -LDFLAGS = -L$(CHECK_PATH)/lib `pkg-config check --libs` -lpthread `sh ../src/osflags $(TARGETOS) link` -CFLAGS = -g -Wall -D$(OS) `pkg-config check --cflags` -I../src -I$(CHECK_PATH)/include -pedantic `sh ../src/osflags $(TARGETOS) cflags` - -all: $(TEST) - @LD_LIBRARY_PATH=${CHECK_PATH}/lib ./$(TEST) - -$(TEST): $(OBJS) $(SRCOBJS) - @echo LD $(TEST) - @$(CC) -o $@ $(SRCOBJS) $(OBJS) $(LDFLAGS) - -.c.o: - @echo CC $< - @$(CC) $(CFLAGS) -c $< - -clean: - @echo "Cleaning tests/" - @rm -f *~ *.core $(TEST) $(OBJS) - From 96ac283dbfe68a94b949e079528cd680bc7a369e Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Thu, 24 Apr 2014 15:46:10 +0100 Subject: [PATCH 05/17] git ignore, autotools version --- .gitignore | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f264a83..f2c5bee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,27 @@ -/bin/ *.o +.deps/ +.dirstamp +/aclocal.m4 +/autom4te.cache/ +/autotools/ +/compile +/config.h +/config.h.in +/config.log +/config.status +/configure +/depcomp +/install-sh +/iodine +/iodined +/missing /src/base64u.c /src/base64u.h -/tests/test +/stamp-h1 +/test-driver +/test-iodine +/test-iodine.log +/test-iodine.trs +/test-suite.log +Makefile +Makefile.in From 988d130637addfc869a35d81c8f5fadc8f783ee8 Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 28 Dec 2016 11:29:01 +0100 Subject: [PATCH 06/17] README is now README.md --- Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index e498503..14ce287 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ AM_CFLAGS = -g -Wall -pedantic ################################################################ dist_man_MANS = man/iodine.8 -dist_doc_DATA = CHANGELOG README README-android.txt README-win32.txt \ +dist_doc_DATA = CHANGELOG README.md README-android.txt README-win32.txt \ TODO doc/proto_00000402.txt doc/proto_00000500.txt \ doc/proto_00000502.txt @@ -117,7 +117,7 @@ cross-android-dist: cp src/libs/armeabi/* iodine-latest-android/armeabi $(MAKE) cross-android TARGET_ARCH_ABI=x86 cp src/libs/x86/* iodine-latest-android/x86 - cp README README-android.txt CH* TO* iodine-latest-android/ + cp README.md README-android.txt CH* TO* iodine-latest-android/ echo "Create date: " > iodine-latest-android/VERSION date >> iodine-latest-android/VERSION echo "Git version: " >> iodine-latest-android/VERSION @@ -143,7 +143,7 @@ cross-mingw-dist: cross-mingw mkdir -p iodine-latest-win32/bin for i in `ls bin`; do cp bin/$$i iodine-latest-win32/bin/$$i.exe; done cp /usr/i686-mingw32/usr/bin/zlib1.dll iodine-latest-win32/bin/ - cp README README-win32.txt CH* TO* iodine-latest-win32/ + cp README.md README-win32.txt CH* TO* iodine-latest-win32/ echo "Create date: " > iodine-latest-win32/VERSION date >> iodine-latest-win32/VERSION echo "Git version: " >> iodine-latest-win32/VERSION From 9e5e197376bda999a13b48c8fa90df0a533d4327 Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 28 Dec 2016 11:29:42 +0100 Subject: [PATCH 07/17] update version number in autotools --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 4a6fc9f..5c49040 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ # Prologue AC_PREREQ([2.69]) -AC_INIT([iodine],[0.6.0rc1],[erik@kryo.se],[],[http://dev.kryo.se/iodine/]) +AC_INIT([iodine],[0.7.0],[erik@kryo.se],[],[http://dev.kryo.se/iodine/]) AC_CONFIG_SRCDIR([src/iodine.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([autotools]) @@ -46,7 +46,7 @@ AS_CASE([${OS}], # The AC_SUBST for GITREVISION is used only in legacy stanza; remove # when unused in Makefile.am, leaving only the config.h #define. -AC_SUBST([GITREVISION],[$(git describe --always || echo not-in-git)]) +AC_SUBST([GITREVISION],[$(git describe --tags --always --dirty || echo not-in-git)]) AC_DEFINE_UNQUOTED([GITREVISION],["${GITREVISION}"], [Precise git commit checked out when building]) From d96c2ea4319e5e64d821cf6d494f811855514b24 Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 28 Dec 2016 11:31:09 +0100 Subject: [PATCH 08/17] do gcc -std=c99 the autotools way --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 5c49040..2d4e90d 100644 --- a/configure.ac +++ b/configure.ac @@ -53,6 +53,9 @@ AC_DEFINE_UNQUOTED([GITREVISION],["${GITREVISION}"], # Checks for programs AC_PROG_CC +AC_PROG_CC_STDC +AS_IF([test "x${ac_cv_prog_cc_stdc}" = xno], + [AC_MSG_WARN([Unable to engage Standard C (C99) option])],) AC_PROG_INSTALL # Process options From 0f6285d45cbdd080de8a37a624e43a12a7173db9 Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 28 Dec 2016 11:31:44 +0100 Subject: [PATCH 09/17] do gcc -Wall the autotools way --- Makefile.am | 2 +- configure.ac | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 14ce287..f5d57c6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ ################################################################ AM_CPPFLAGS = -D$(OS) -AM_CFLAGS = -g -Wall -pedantic +AM_CFLAGS = -g -pedantic ################################################################ diff --git a/configure.ac b/configure.ac index 2d4e90d..3d241b0 100644 --- a/configure.ac +++ b/configure.ac @@ -56,6 +56,7 @@ AC_PROG_CC AC_PROG_CC_STDC AS_IF([test "x${ac_cv_prog_cc_stdc}" = xno], [AC_MSG_WARN([Unable to engage Standard C (C99) option])],) +AX_CFLAGS_WARN_ALL AC_PROG_INSTALL # Process options From 518356145770aaa2f684691d4ee3fe82230ec54b Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 28 Dec 2016 11:40:55 +0100 Subject: [PATCH 10/17] autotools enables debugging (gcc -g) by default --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index f5d57c6..62bea80 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ ################################################################ AM_CPPFLAGS = -D$(OS) -AM_CFLAGS = -g -pedantic +AM_CFLAGS = -pedantic ################################################################ From 29b7110bc62fc7360ccaa010ba91f479b05264de Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 28 Dec 2016 12:01:30 +0100 Subject: [PATCH 11/17] avoid incomplete type issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/iodined.c: In function ‘read_dns’: src/iodined.c:2062:34: error: invalid application of ‘sizeof’ to incomplete type ‘struct in6_pktinfo’ char control[CMSG_SPACE(sizeof (struct in6_pktinfo))]; ^ --- configure.ac | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index 3d241b0..ef194d9 100644 --- a/configure.ac +++ b/configure.ac @@ -56,6 +56,10 @@ AC_PROG_CC AC_PROG_CC_STDC AS_IF([test "x${ac_cv_prog_cc_stdc}" = xno], [AC_MSG_WARN([Unable to engage Standard C (C99) option])],) +# This is to avoid +# error: invalid application of ‘sizeof’ to incomplete type ‘struct in6_pktinfo’ +# whose definition is guarded by _GNU_SOURCE +AC_USE_SYSTEM_EXTENSIONS AX_CFLAGS_WARN_ALL AC_PROG_INSTALL From 504ef5c2679ebad192f91309651f501d00f07410 Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 28 Dec 2016 11:45:36 +0100 Subject: [PATCH 12/17] document use of autotools --- README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/README.md b/README.md index 1c76829..3c5c457 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,7 @@ firewalled, but DNS queries are allowed. COMPILING --------- -Iodine has no configure script. There are two optional features for Linux -(SELinux and systemd support) that will be enabled automatically if the -relevant header files are found in `/usr/include`. -(See script at `./src/osflags`) - -Run `make` to compile the server and client binaries. -Run `make install` to copy binaries and manpage to the destination directory. -Run `make test` to compile and run the unit tests. (Requires the `check` library) +Standard `autotools` build scripts, so a simple `autoreconf --install && ./configure && make`, followed by an optional `make check`, and a `make install`, should do it. All the usual build options for cross-compilation etc should be available, such as `./configure --help=short` to find package-specific configuration options. QUICKSTART From a602f3c1e219d3e8822d71d3d011f4fb20ef7639 Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 28 Dec 2016 12:40:06 +0100 Subject: [PATCH 13/17] tell travis to use autotools --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57f7a67..adde16a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,5 +7,4 @@ os: osx before_install: brew update install: brew install check -script: make && make test - +script: autoreconf --install && ./configure && make && make test From 6529fd89f1ff989d348d6d1297ebe7f438228607 Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 28 Dec 2016 13:12:45 +0100 Subject: [PATCH 14/17] need appropriate #include for socklen_t on Darwin --- configure.ac | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ef194d9..c639c33 100644 --- a/configure.ac +++ b/configure.ac @@ -157,7 +157,15 @@ AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h str AC_CHECK_TYPES([socklen_t],, AC_DEFINE([socklen_t],[int], - [define to int if type socklen_t not found])) + [define to int if type socklen_t not found]), + [ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +]) AC_TYPE_UID_T AC_C_INLINE From af51bd4d466e38438a0092781525c7b7e33a09cf Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 28 Dec 2016 13:33:47 +0100 Subject: [PATCH 15/17] tell travis build requires autoconf AX_* macros --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index adde16a..19ef5df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,6 @@ language: objective-c os: osx before_install: brew update -install: brew install check +install: brew install check autoconf-archive script: autoreconf --install && ./configure && make && make test From 8e58aeb2ff4fd2dbe6df5453bcbc669d6cebdc65 Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Wed, 28 Dec 2016 23:38:15 +0100 Subject: [PATCH 16/17] avoid OS=DARWINdigists --- configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c639c33..e1bada3 100644 --- a/configure.ac +++ b/configure.ac @@ -28,10 +28,14 @@ AS_CASE([${host_os}], [mingw32], [OS=WINDOWS32], [macos], [OS=DARWIN], [linux-android], [OS=ANDROID], - [OS="$(echo ${host_os}|tr "a-z" "A-Z_")"]) + [OS="$(echo ${host_os}|tr "a-z" "A-Z")"]) uname_os="$(uname | tr "a-z" "A-Z")" +# Avoid, e.g., OS=DARWIN15.6.0 +AS_CASE([${uname_os}], + [DARWIN], [OS=DARWIN]) + AC_MSG_NOTICE([host_os: ${host_os}]) AC_MSG_NOTICE([uname_os: ${uname_os}]) AC_MSG_NOTICE([adjusted OS: ${OS}]) From 4341c2707e55e29bf10b407ba0ec40c6d2357f4f Mon Sep 17 00:00:00 2001 From: "Barak A. Pearlmutter" Date: Thu, 29 Dec 2016 00:08:16 +0100 Subject: [PATCH 17/17] get IPV6_PKTINFO defined by Darwin headers --- src/common.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common.h b/src/common.h index 2de23e9..9aad5b5 100644 --- a/src/common.h +++ b/src/common.h @@ -18,6 +18,12 @@ #ifndef __COMMON_H__ #define __COMMON_H__ +#ifdef DARWIN +#ifndef __APPLE_USE_RFC_3542 +#define __APPLE_USE_RFC_2292 +#endif +#endif + /* Last byte of raw header is the command */ #define RAW_HDR_LEN 4 #define RAW_HDR_IDENT_LEN 3