From 175cf9e985ff27d8a8561a4304e2bb63449b9cb1 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 29 Nov 2017 18:13:36 +0100 Subject: [PATCH] iodine: workaround incomplete musl nameser.h header The arpa/nameser.h header of musl libc indirectly depends on the endian.h header but fails to explicitely include it to properly define `__BYTE_ORDER` and `__BIG_ENDIAN` prior to declaring the DNS `HEADER` structure. When both the appropriate `__BYTE_ORDER` and `__BIG_ENDIAN` defines are unset, the `#if __BYTE_ORDER == __BIG_ENDIAN` condition in `nameser.h` evaluates to true, causing it to declare a bad (big endian) DNS packet header structure on little endian systems. Work around this musl bug by forcibly passing `-include endian.h` through the `osflags` file. An upstream fix for musl libc has been submitted with http://www.openwall.com/lists/musl/2017/12/04/3 This should solve iodine packet corruption on little endian musl systems reported at http://lists.infradead.org/pipermail/lede-dev/2017-November/010085.html Signed-off-by: Jo-Philipp Wich --- net/iodine/Makefile | 2 +- ...musl-workaround-incomplete-nameser-h.patch | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 net/iodine/patches/101-musl-workaround-incomplete-nameser-h.patch diff --git a/net/iodine/Makefile b/net/iodine/Makefile index 842d188c9..e6cf46c39 100644 --- a/net/iodine/Makefile +++ b/net/iodine/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iodine PKG_VERSION:=0.7.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://code.kryo.se/iodine/ diff --git a/net/iodine/patches/101-musl-workaround-incomplete-nameser-h.patch b/net/iodine/patches/101-musl-workaround-incomplete-nameser-h.patch new file mode 100644 index 000000000..1f075d099 --- /dev/null +++ b/net/iodine/patches/101-musl-workaround-incomplete-nameser-h.patch @@ -0,0 +1,27 @@ +The arpa/nameser.h header of musl libc indirectly depends on the endian.h +header but fails to explicitely include it to properly define +`__BYTE_ORDER` and `__BIG_ENDIAN` prior to declaring the DNS `HEADER` +structure. + +When both the appropriate `__BYTE_ORDER` and `__BIG_ENDIAN` defines are +unset, the `#if __BYTE_ORDER == __BIG_ENDIAN` condition in `nameser.h` +evaluates to true, causing it to declare a bad (big endian) DNS packet +header structure on little endian systems. + +Work around this musl bug by forcibly passing `-include endian.h` through +the `osflags` file. + +An upstream fix for musl libc has been submitted with +http://www.openwall.com/lists/musl/2017/12/04/3 + +--- a/src/osflags ++++ b/src/osflags +@@ -27,7 +27,7 @@ cflags) + echo '-Dsocklen_t=int'; + ;; + Linux) +- FLAGS="-D_GNU_SOURCE" ++ FLAGS="-D_GNU_SOURCE -include endian.h" + echo $FLAGS; + ;; + esac