aboutgitcodebugslistschat
path: root/util.h
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-05-21 11:14:47 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-05-21 11:14:47 +0200
commit9010054ea4ceee9105aa938f15b79a3a91ec5969 (patch)
treef9f1ca6a2b506d6b4b2f1fdb210e702d016fecf8 /util.h
parent0231ac1c86578a8dac2ae6531d30c71ba89688e1 (diff)
downloadpasst-9010054ea4ceee9105aa938f15b79a3a91ec5969.tar
passt-9010054ea4ceee9105aa938f15b79a3a91ec5969.tar.gz
passt-9010054ea4ceee9105aa938f15b79a3a91ec5969.tar.bz2
passt-9010054ea4ceee9105aa938f15b79a3a91ec5969.tar.lz
passt-9010054ea4ceee9105aa938f15b79a3a91ec5969.tar.xz
passt-9010054ea4ceee9105aa938f15b79a3a91ec5969.tar.zst
passt-9010054ea4ceee9105aa938f15b79a3a91ec5969.zip
dhcp, ndp, dhcpv6: Support for multiple DNS servers, search list
Add support for a variable amount of DNS servers, including zero, from /etc/resolv.conf, in DHCP, NDP and DHCPv6 implementations. Introduce support for domain search list for DHCP (RFC 3397), NDP (RFC 8106), and DHCPv6 (RFC 3646), also sourced from /etc/resolv.conf. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.h')
-rw-r--r--util.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/util.h b/util.h
index fe129ee..7d0704c 100644
--- a/util.h
+++ b/util.h
@@ -22,11 +22,16 @@ void debug(const char *format, ...);
CHECK_SET_MIN_MAX(c->proto_ctx.fd_, (fd)); \
} while (0)
+#ifndef MIN
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
+#endif
+#ifndef MAX
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
+#endif
-#define IN_INTERVAL(a, b, x) ((x) >= (a) && (x) <= (b))
+#define ARRAY_SIZE(a) ((int)(sizeof(a) / sizeof((a)[0])))
+#define IN_INTERVAL(a, b, x) ((x) >= (a) && (x) <= (b))
#define FD_PROTO(x, proto) \
(IN_INTERVAL(c->proto.fd_min, c->proto.fd_max, (x)))