Added support for musl libc, to support compilation on Alpine Linux and other musl libc based systems. (#957)
This commit is contained in:
parent
0b05308188
commit
27b25b8993
|
@ -109,6 +109,8 @@ extern "C" {
|
|||
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <sys/endian.h>
|
||||
#elif ! defined(__GLIBC__)
|
||||
#include <endian.h>
|
||||
#endif
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
|
@ -181,7 +183,7 @@ static ogs_inline ogs_uint24_t ogs_htobe24(ogs_uint24_t x)
|
|||
#endif
|
||||
|
||||
#define ogs_container_of(ptr, type, member) \
|
||||
(type *)((u_char *)ptr - offsetof(type, member))
|
||||
(type *)((unsigned char *)ptr - offsetof(type, member))
|
||||
|
||||
#ifndef SWITCH_CASE_INIT
|
||||
#define SWITCH_CASE_INIT
|
||||
|
|
|
@ -71,8 +71,8 @@
|
|||
static __inline time_t
|
||||
_long_to_time(long tlong)
|
||||
{
|
||||
if (sizeof(long) == sizeof(__int32_t))
|
||||
return((time_t)(__int32_t)(tlong));
|
||||
if (sizeof(long) == sizeof(u_int32_t))
|
||||
return((time_t)(u_int32_t)(tlong));
|
||||
return((time_t)tlong);
|
||||
}
|
||||
|
||||
|
@ -165,10 +165,14 @@ struct ether_addr * ether_aton(const char *a);
|
|||
|
||||
#define ICMP6_MAXTYPE 201
|
||||
#define __u6_addr in6_u
|
||||
#if !defined(__GLIBC__)
|
||||
#define in6_u __in6_union /* Adding support for musl libc netinet */
|
||||
#define __u6_addr32 s6_addr32
|
||||
#else
|
||||
#define in6_u __in6_u /* missing type for ipv6 (linux 2.6.28) */
|
||||
|
||||
|
||||
#define __u6_addr32 u6_addr32
|
||||
#endif
|
||||
|
||||
/* on freebsd sys/socket.h pf specific */
|
||||
#define NET_RT_IFLIST 3 /* survey interface list */
|
||||
|
||||
|
|
|
@ -517,12 +517,20 @@ typedef struct _ipfw_insn_nat {
|
|||
struct cfg_nat *nat;
|
||||
} ipfw_insn_nat;
|
||||
|
||||
#if !defined(__GLIBC__) /* Adding support for musl libc netint */
|
||||
/* Apply ipv6 mask on ipv6 addr */
|
||||
#define APPLY_MASK(addr,mask) \
|
||||
(addr)->__u6_addr.__s6_addr32[0] &= (mask)->__u6_addr.__s6_addr32[0]; \
|
||||
(addr)->__u6_addr.__s6_addr32[1] &= (mask)->__u6_addr.__s6_addr32[1]; \
|
||||
(addr)->__u6_addr.__s6_addr32[2] &= (mask)->__u6_addr.__s6_addr32[2]; \
|
||||
(addr)->__u6_addr.__s6_addr32[3] &= (mask)->__u6_addr.__s6_addr32[3];
|
||||
#else
|
||||
#define APPLY_MASK(addr,mask) \
|
||||
(addr)->__u6_addr.__u6_addr32[0] &= (mask)->__u6_addr.__u6_addr32[0]; \
|
||||
(addr)->__u6_addr.__u6_addr32[1] &= (mask)->__u6_addr.__u6_addr32[1]; \
|
||||
(addr)->__u6_addr.__u6_addr32[2] &= (mask)->__u6_addr.__u6_addr32[2]; \
|
||||
(addr)->__u6_addr.__u6_addr32[3] &= (mask)->__u6_addr.__u6_addr32[3];
|
||||
#endif
|
||||
|
||||
/* Structure for ipv6 */
|
||||
typedef struct _ipfw_insn_ip6 {
|
||||
|
|
|
@ -165,7 +165,7 @@ ogs_sbi_client_t *ogs_sbi_client_find(ogs_sockaddr_t *addr)
|
|||
}
|
||||
|
||||
#define mycase(code) \
|
||||
case code: s = __STRING(code)
|
||||
case code: s = (code)
|
||||
|
||||
static void mcode_or_die(const char *where, CURLMcode code)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue