From 073f530bfe0b21bb7c94cd047af94f0463dfe96d Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 8 Dec 2023 01:31:35 +1100 Subject: treewide: Add IN4ADDR_ANY_INIT macro We already define IN4ADDR_LOOPBACK_INIT to initialise a struct in_addr to the loopback address, make a similar one for the unspecified / any address. This avoids messying things with the internal structure of struct in_addr where we don't care about it. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- util.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index 9446ea7..fb8c3f1 100644 --- a/util.h +++ b/util.h @@ -122,6 +122,9 @@ (((struct in_addr *)(a))->s_addr == ((struct in_addr *)b)->s_addr) #define IN4ADDR_LOOPBACK_INIT \ { .s_addr = htonl_constant(INADDR_LOOPBACK) } +#define IN4ADDR_ANY_INIT \ + { .s_addr = htonl_constant(INADDR_ANY) } + #define NS_FN_STACK_SIZE (RLIMIT_STACK_VAL * 1024 / 8) int do_clone(int (*fn)(void *), char *stack_area, size_t stack_size, int flags, -- cgit v1.2.3