Lines 7-13
Link Here
|
7 |
#define UTIL_H |
7 |
#define UTIL_H |
8 |
|
8 |
|
9 |
#include <stdlib.h> |
9 |
#include <stdlib.h> |
|
|
10 |
#include <stdio.h> |
10 |
#include <stdarg.h> |
11 |
#include <stdarg.h> |
|
|
12 |
#include <signal.h> |
13 |
#include <byteswap.h> |
11 |
|
14 |
|
12 |
#include "log.h" |
15 |
#include "log.h" |
13 |
|
16 |
|
Lines 88-93
Link Here
|
88 |
#define MAC_ZERO ((uint8_t [ETH_ALEN]){ 0 }) |
91 |
#define MAC_ZERO ((uint8_t [ETH_ALEN]){ 0 }) |
89 |
#define MAC_IS_ZERO(addr) (!memcmp((addr), MAC_ZERO, ETH_ALEN)) |
92 |
#define MAC_IS_ZERO(addr) (!memcmp((addr), MAC_ZERO, ETH_ALEN)) |
90 |
|
93 |
|
|
|
94 |
#if defined(__GLIBC__) || defined(__UCLIBC__) |
95 |
|
91 |
#if __BYTE_ORDER == __BIG_ENDIAN |
96 |
#if __BYTE_ORDER == __BIG_ENDIAN |
92 |
#define htons_constant(x) (x) |
97 |
#define htons_constant(x) (x) |
93 |
#define htonl_constant(x) (x) |
98 |
#define htonl_constant(x) (x) |
Lines 96-101
Link Here
|
96 |
#define htonl_constant(x) (__bswap_constant_32(x)) |
101 |
#define htonl_constant(x) (__bswap_constant_32(x)) |
97 |
#endif |
102 |
#endif |
98 |
|
103 |
|
|
|
104 |
#else |
105 |
|
106 |
/* mainly musl fallback */ |
107 |
|
108 |
#define htons_constant(x) (x) |
109 |
#define htonl_constant(x) (x) |
110 |
|
111 |
#endif |
112 |
|
99 |
#define IN4_IS_ADDR_UNSPECIFIED(a) \ |
113 |
#define IN4_IS_ADDR_UNSPECIFIED(a) \ |
100 |
((a)->s_addr == htonl(INADDR_ANY)) |
114 |
((a)->s_addr == htonl(INADDR_ANY)) |
101 |
#define IN4_IS_ADDR_BROADCAST(a) \ |
115 |
#define IN4_IS_ADDR_BROADCAST(a) \ |