openwrt-packages/net/iodine/patches/101-musl-workaround-incompl...

28 lines
901 B
Diff

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
@@ -32,7 +32,7 @@ cflags)
echo '-D__APPLE_USE_RFC_3542';
;;
Linux)
- FLAGS="-D_GNU_SOURCE"
+ FLAGS="-D_GNU_SOURCE -include endian.h"
echo $FLAGS;
;;
GNU/kFreeBSD|GNU)