diff options
-rw-r--r-- | main/musl/1001-add-rfc3678-mcast-structs.patch (renamed from main/musl/add-rfc3678-mcast-structs.patch) | 0 | ||||
-rw-r--r-- | main/musl/1002-add-linux-tcp-state-enums.patch | 35 | ||||
-rw-r--r-- | main/musl/1003-add-basic-dns-record-parsing-functions.patch | 272 | ||||
-rw-r--r-- | main/musl/2001-workaround-gcc-pr58245.patch (renamed from main/musl/workaround-gcc-pr58245.patch) | 0 | ||||
-rw-r--r-- | main/musl/APKBUILD | 27 |
5 files changed, 325 insertions, 9 deletions
diff --git a/main/musl/add-rfc3678-mcast-structs.patch b/main/musl/1001-add-rfc3678-mcast-structs.patch index c453d1403a..c453d1403a 100644 --- a/main/musl/add-rfc3678-mcast-structs.patch +++ b/main/musl/1001-add-rfc3678-mcast-structs.patch diff --git a/main/musl/1002-add-linux-tcp-state-enums.patch b/main/musl/1002-add-linux-tcp-state-enums.patch new file mode 100644 index 0000000000..f9e1719b54 --- /dev/null +++ b/main/musl/1002-add-linux-tcp-state-enums.patch @@ -0,0 +1,35 @@ +From c76c5b275a8dfa06468605369a5b025a68696183 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> +Date: Mon, 14 Oct 2013 08:28:19 +0300 +Subject: [PATCH] add linux tcp state enums + +--- + include/netinet/tcp.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h +index 8266f21..6f75eb3 100644 +--- a/include/netinet/tcp.h ++++ b/include/netinet/tcp.h +@@ -27,6 +27,18 @@ + #define TCP_FASTOPEN 23 + #define TCP_TIMESTAMP 24 + ++#define TCP_ESTABLISHED 1 ++#define TCP_SYN_SENT 2 ++#define TCP_SYN_RECV 3 ++#define TCP_FIN_WAIT1 4 ++#define TCP_FIN_WAIT2 5 ++#define TCP_TIME_WAIT 6 ++#define TCP_CLOSE 7 ++#define TCP_CLOSE_WAIT 8 ++#define TCP_LAST_ACK 9 ++#define TCP_LISTEN 10 ++#define TCP_CLOSING 11 ++ + #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + #define SOL_TCP 6 + #include <sys/types.h> +-- +1.8.4 + diff --git a/main/musl/1003-add-basic-dns-record-parsing-functions.patch b/main/musl/1003-add-basic-dns-record-parsing-functions.patch new file mode 100644 index 0000000000..9742e0945b --- /dev/null +++ b/main/musl/1003-add-basic-dns-record-parsing-functions.patch @@ -0,0 +1,272 @@ +From cc449aebaa572fbea2d400d1ee058f03f2638df2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> +Date: Mon, 14 Oct 2013 10:01:01 +0300 +Subject: [PATCH] add basic dns record parsing functions + +--- + include/arpa/nameser.h | 89 ++++++++++++++++++------------- + src/network/ns_parse.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 192 insertions(+), 37 deletions(-) + create mode 100644 src/network/ns_parse.c + +diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h +index b9ee665..1fc7339 100644 +--- a/include/arpa/nameser.h ++++ b/include/arpa/nameser.h +@@ -1,6 +1,11 @@ + #ifndef _ARPA_NAMESER_H + #define _ARPA_NAMESER_H + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include <sys/types.h> + #include <stdint.h> + + #define __NAMESER 19991006 +@@ -296,43 +301,49 @@ typedef enum __ns_cert_types { + #define NS_OPT_DNSSEC_OK 0x8000U + #define NS_OPT_NSID 3 + +-#define NS_GET16(s, cp) do { \ +- register const unsigned char *t_cp = (const unsigned char *)(cp); \ +- (s) = ((uint16_t)t_cp[0] << 8) \ +- | ((uint16_t)t_cp[1]) \ +- ; \ +- (cp) += NS_INT16SZ; \ +-} while (0) +- +-#define NS_GET32(l, cp) do { \ +- register const unsigned char *t_cp = (const unsigned char *)(cp); \ +- (l) = ((uint32_t)t_cp[0] << 24) \ +- | ((uint32_t)t_cp[1] << 16) \ +- | ((uint32_t)t_cp[2] << 8) \ +- | ((uint32_t)t_cp[3]) \ +- ; \ +- (cp) += NS_INT32SZ; \ +-} while (0) +- +-#define NS_PUT16(s, cp) do { \ +- register uint16_t t_s = (uint16_t)(s); \ +- register unsigned char *t_cp = (unsigned char *)(cp); \ +- *t_cp++ = t_s >> 8; \ +- *t_cp = t_s; \ +- (cp) += NS_INT16SZ; \ +-} while (0) +- +-#define NS_PUT32(l, cp) do { \ +- register uint32_t t_l = (uint32_t)(l); \ +- register unsigned char *t_cp = (unsigned char *)(cp); \ +- *t_cp++ = t_l >> 24; \ +- *t_cp++ = t_l >> 16; \ +- *t_cp++ = t_l >> 8; \ +- *t_cp = t_l; \ +- (cp) += NS_INT32SZ; \ +-} while (0) +- +- ++static __inline uint16_t ns_get16(const unsigned char *cp) ++{ ++ return ((uint16_t)cp[0] << 8) ++ | ((uint16_t)cp[1]); ++} ++ ++#define NS_GET16(s, cp) do { (s) = ns_get16(cp); (cp) += NS_INT16SZ; } while (0) ++ ++static __inline uint32_t ns_get32(const unsigned char *cp) ++{ ++ return ((uint32_t)cp[0] << 24) ++ | ((uint32_t)cp[1] << 16) ++ | ((uint32_t)cp[2] << 8) ++ | ((uint32_t)cp[3]); ++} ++ ++#define NS_GET32(s, cp) do { (s) = ns_get32(cp); (cp) += NS_INT32SZ; } while (0) ++ ++static __inline void ns_put16(uint16_t s, unsigned char *cp) ++{ ++ cp[0] = s >> 8; ++ cp[1] = s; ++} ++ ++#define NS_PUT16(s, cp) do { ns_put16(s, cp); (cp) += NS_INT16SZ; } while (0) ++ ++static __inline void ns_put32(uint32_t l, unsigned char *cp) ++{ ++ cp[0] = l >> 24; ++ cp[1] = l >> 16; ++ cp[2] = l >> 8; ++ cp[3] = l; ++} ++ ++#define NS_PUT32(s, cp) do { ns_put32(s, cp); (cp) += NS_INT32SZ; } while (0) ++ ++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ++int ns_initparse(const u_char *msg, int msglen, ns_msg *handle); ++int ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr); ++int ns_skiprr(const u_char *msg, const u_char *eom, ns_sect section, int count); ++int ns_name_uncompress(const u_char *msg, const u_char *eom, ++ const u_char *comp_dn, char *exp_dn, size_t length); ++#endif + + + #define __BIND 19950621 +@@ -464,4 +475,8 @@ typedef struct { + #define PUTSHORT NS_PUT16 + #define PUTLONG NS_PUT32 + ++#ifdef __cplusplus ++} ++#endif ++ + #endif +diff --git a/src/network/ns_parse.c b/src/network/ns_parse.c +new file mode 100644 +index 0000000..5ef0d90 +--- /dev/null ++++ b/src/network/ns_parse.c +@@ -0,0 +1,140 @@ ++#define _BSD_SOURCE ++#include <errno.h> ++#include <stddef.h> ++#include <resolv.h> ++#include <arpa/nameser.h> ++ ++int ns_initparse(const unsigned char *msg, int msglen, ns_msg *handle) ++{ ++ int i, r; ++ ++ handle->_msg = msg; ++ handle->_eom = msg + msglen; ++ if (msglen < (2 + ns_s_max) * NS_INT16SZ) ++ goto bad; ++ ++ NS_GET16(handle->_id, msg); ++ NS_GET16(handle->_flags, msg); ++ for (i = 0; i < ns_s_max; i++) ++ NS_GET16(handle->_counts[i], msg); ++ for (i = 0; i < ns_s_max; i++) { ++ if (handle->_counts[i]) { ++ handle->_sections[i] = msg; ++ r = ns_skiprr(msg, handle->_eom, i, handle->_counts[i]); ++ if (r < 0) return -1; ++ msg += r; ++ } else { ++ handle->_sections[i] = NULL; ++ } ++ } ++ if (msg != handle->_eom) ++ goto bad; ++ ++ handle->_sect = ns_s_max; ++ handle->_rrnum = -1; ++ handle->_msg_ptr = NULL; ++ return 0; ++bad: ++ errno = EMSGSIZE; ++ return -1; ++} ++ ++int ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) ++{ ++ const u_char *p = ptr; ++ int r; ++ ++ while (count--) { ++ r = dn_skipname(p, eom); ++ if (r < 0) goto bad; ++ p += r + 2 * NS_INT16SZ; ++ if (section != ns_s_qd) { ++ if (p + NS_INT32SZ + NS_INT16SZ > eom) goto bad; ++ p += NS_INT32SZ; ++ NS_GET16(r, p); ++ p += r; ++ } ++ } ++ if (p > eom) goto bad; ++ return ptr - p; ++bad: ++ errno = EMSGSIZE; ++ return -1; ++} ++ ++int ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) ++{ ++ int r; ++ ++ if (section < 0 || section >= ns_s_max) ++ goto bad; ++ if (section != handle->_sect) { ++ handle->_sect = section; ++ handle->_rrnum = 0; ++ handle->_msg_ptr = handle->_sections[section]; ++ } ++ if (rrnum == -1) ++ rrnum = handle->_rrnum; ++ if (rrnum < 0 || rrnum >= handle->_counts[section]) ++ goto bad; ++ if (rrnum < handle->_rrnum) { ++ handle->_rrnum = 0; ++ handle->_msg_ptr = handle->_sections[section]; ++ } ++ if (rrnum > handle->_rrnum) { ++ r = ns_skiprr(handle->_msg_ptr, handle->_eom, section, rrnum - handle->_rrnum); ++ if (r < 0) return -1; ++ handle->_msg_ptr += r; ++ handle->_rrnum = rrnum; ++ } ++ r = dn_expand(handle->_msg, handle->_eom, handle->_msg_ptr, rr->name, NS_MAXDNAME); ++ if (r < 0) return -1; ++ handle->_msg_ptr += r; ++ if (handle->_msg_ptr + 2 * NS_INT16SZ > handle->_eom) ++ goto size; ++ NS_GET16(rr->type, handle->_msg_ptr); ++ NS_GET16(rr->rr_class, handle->_msg_ptr); ++ if (section != ns_s_qd) { ++ if (handle->_msg_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom) ++ goto size; ++ NS_GET32(rr->ttl, handle->_msg_ptr); ++ NS_GET16(rr->rdlength, handle->_msg_ptr); ++ if (handle->_msg_ptr + rr->rdlength > handle->_eom) ++ goto size; ++ rr->rdata = handle->_msg_ptr; ++ handle->_msg_ptr += rr->rdlength; ++ } else { ++ rr->ttl = 0; ++ rr->rdlength = 0; ++ rr->rdata = NULL; ++ } ++ handle->_rrnum++; ++ if (handle->_rrnum > handle->_counts[section]) { ++ handle->_sect = section + 1; ++ if (handle->_sect == ns_s_max) { ++ handle->_rrnum = -1; ++ handle->_msg_ptr = NULL; ++ } else { ++ handle->_rrnum = 0; ++ } ++ } ++ return 0; ++bad: ++ errno = ENODEV; ++ return -1; ++size: ++ errno = EMSGSIZE; ++ return -1; ++} ++ ++int __dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int); ++ ++int ns_name_uncompress(const u_char *msg, const u_char *eom, ++ const u_char *src, char *dst, size_t dstsiz) ++{ ++ int r; ++ r = __dn_expand(msg, eom, src, dst, dstsiz); ++ if (r < 0) errno = EMSGSIZE; ++ return r; ++} ++ +-- +1.8.4 + diff --git a/main/musl/workaround-gcc-pr58245.patch b/main/musl/2001-workaround-gcc-pr58245.patch index 5f57d352ff..5f57d352ff 100644 --- a/main/musl/workaround-gcc-pr58245.patch +++ b/main/musl/2001-workaround-gcc-pr58245.patch diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index 2e014840bd..0d3e44f8f3 100644 --- a/main/musl/APKBUILD +++ b/main/musl/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teräs <timo.teras@iki.fi> pkgname=musl pkgver=0.9.14 -pkgrel=4 +pkgrel=5 pkgdesc="the musl c library (libc) implementation" url="http://www.musl-libc.org/" arch="all" @@ -20,8 +20,11 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz 0004-fix-new-environment-always-being-null-with-execle.patch 0005-fix-clockid-macro-names-in-time.h-reported-by-Paul-S.patch - add-rfc3678-mcast-structs.patch - workaround-gcc-pr58245.patch + 1001-add-rfc3678-mcast-structs.patch + 1002-add-linux-tcp-state-enums.patch + 1003-add-basic-dns-record-parsing-functions.patch + 2001-workaround-gcc-pr58245.patch + getopt_long.c __stack_chk_fail_local.c getent @@ -117,8 +120,10 @@ bfefbd099f555fe8fd22e7ffc3accbef 0002-fix-buffer-overflow-in-mbsrtowcs.patch 5d722e38a7ca2032c9f202db8ff7e369 0003-fix-off-by-one-error-in-getgrnam_r-and-getgrgid_r-cl.patch 216d6915ea8397102c22a7aeaafdd98f 0004-fix-new-environment-always-being-null-with-execle.patch aa4c3ccf3e074fcac609420573ce466a 0005-fix-clockid-macro-names-in-time.h-reported-by-Paul-S.patch -b28080b5c8c1d44521277aa3255d280a add-rfc3678-mcast-structs.patch -7a09c5cd7b3e9532e6902f54a5e928bb workaround-gcc-pr58245.patch +b28080b5c8c1d44521277aa3255d280a 1001-add-rfc3678-mcast-structs.patch +34044ab59029e9510a2760d669e1a377 1002-add-linux-tcp-state-enums.patch +6cdf1c56450d59f3a3acf452b2db4c2e 1003-add-basic-dns-record-parsing-functions.patch +7a09c5cd7b3e9532e6902f54a5e928bb 2001-workaround-gcc-pr58245.patch 61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c ef81489a6258501cf45db58dfc6d5211 getent @@ -129,8 +134,10 @@ a6cb8b279e5b737d43c2de1bd6229f5e6599e9514bcb41ddaa411cd44dc65ba7 0002-fix-buffe b6b161383b287505eecb53595039b8fe26c622508e783c86ee82d38c1ea582f4 0003-fix-off-by-one-error-in-getgrnam_r-and-getgrgid_r-cl.patch 2e9f262bf9c117f1ca59afd9615daa6f8d71aaddb719f5259218b088244622fb 0004-fix-new-environment-always-being-null-with-execle.patch f2fd3b921bd57190d0bf19c4a4beb5f808a5d19c71092e2962a3e7b1ca08c67e 0005-fix-clockid-macro-names-in-time.h-reported-by-Paul-S.patch -720cb88dd1ef57fc806a22b46b3c47d7a0a38a34d31edb583e97bfa7a47eb44c add-rfc3678-mcast-structs.patch -45d6efda7450809e4e68f6e951431dcadf6cb7f0260930d50a9f1a8667aca49f workaround-gcc-pr58245.patch +720cb88dd1ef57fc806a22b46b3c47d7a0a38a34d31edb583e97bfa7a47eb44c 1001-add-rfc3678-mcast-structs.patch +53637d1dfdbff7131277252d63cba7c3fc1f7b61c7b735e503fbccaa6dcdd887 1002-add-linux-tcp-state-enums.patch +54686df1392c52f4e9c62648dcb544f4bd48111be8d9734b7f65d8452b7ead12 1003-add-basic-dns-record-parsing-functions.patch +45d6efda7450809e4e68f6e951431dcadf6cb7f0260930d50a9f1a8667aca49f 2001-workaround-gcc-pr58245.patch d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c d6996273f5aaaed429058257e4646b243d9e3a4d8609522f802762453f5be4cb getent @@ -141,8 +148,10 @@ bb1a0025675fc0241a0ae15e04e12cfbb3c12604ccdb8ac9a2a192d76d346c2804d051f6698a6366 60fd9640ea6a8c46e8724ec80d228bcabb9ae3f0f366d2a21c7e15da4a31395aa6dfadeb480f22c720cbd773b73b245174adc3031ee04e69efecf4c45af8538f 0003-fix-off-by-one-error-in-getgrnam_r-and-getgrgid_r-cl.patch f37b4bb6e15c0fa02cb7643a3f291158901a13f5c39651d3feda371f9de9a05ce82ce7e81a45440422a4bf9198cd2baa1cb8fbebe267b6726e8d293aa5b836d3 0004-fix-new-environment-always-being-null-with-execle.patch f3f2f0cad04b58891e42d0846d929c05d793c1c7ab61aa0ac1377f38c1291bce45e39a7acdc62749804859a5de1b20f9ec0839c58a7015cb12c0b7c85c7a6194 0005-fix-clockid-macro-names-in-time.h-reported-by-Paul-S.patch -d63d3ea0c59dbff0cb24cc30ba0b013a33e81bc91de5f6c8b0082fa3e261b0c0dac3f2dc30c3b0370f7d1c4536e2042cd85ecb8e0357a805bd93855e42396d92 add-rfc3678-mcast-structs.patch -69ad3fc851b44f33dd7c98b83fd0adbd149b37263d17b989f4d7338ee0703dfe8994f4299744e2509492300227d652de6f21b6cdba9b633fcefd3d9f7ca0cf20 workaround-gcc-pr58245.patch +d63d3ea0c59dbff0cb24cc30ba0b013a33e81bc91de5f6c8b0082fa3e261b0c0dac3f2dc30c3b0370f7d1c4536e2042cd85ecb8e0357a805bd93855e42396d92 1001-add-rfc3678-mcast-structs.patch +53249ab17705190b17905623cc22b42616e1648f91f8f129bd1a5299b0231ce216154e009a0c8f62444f12fa6e51655cefeade7d383ed0427d879d508f338209 1002-add-linux-tcp-state-enums.patch +335ec63cfbc7f348f33cfba1238c069fed4c8c51a51d1ea39eff4b7dfcceeae7ff4afb1038fa7c5545a42854ed553a936c0b1ff6c4795fa25b982398a2cc02bd 1003-add-basic-dns-record-parsing-functions.patch +69ad3fc851b44f33dd7c98b83fd0adbd149b37263d17b989f4d7338ee0703dfe8994f4299744e2509492300227d652de6f21b6cdba9b633fcefd3d9f7ca0cf20 2001-workaround-gcc-pr58245.patch 140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c 4d92f934d760cf5157d80f19fd766be6b673c65317229b32ac824d9d192f6abcc414e2382b2416dfd5c2f757b46ced98c18e4762bf91f5a48647e0ee61813b06 getent |