diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-12-08 01:31:35 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-12-27 19:29:45 +0100 |
commit | 073f530bfe0b21bb7c94cd047af94f0463dfe96d (patch) | |
tree | 10550b1d10e7177ac2ba6268dd159fedd4e22c9e | |
parent | 546332786cee921213fc59db6207be23c2d70208 (diff) | |
download | passt-073f530bfe0b21bb7c94cd047af94f0463dfe96d.tar passt-073f530bfe0b21bb7c94cd047af94f0463dfe96d.tar.gz passt-073f530bfe0b21bb7c94cd047af94f0463dfe96d.tar.bz2 passt-073f530bfe0b21bb7c94cd047af94f0463dfe96d.tar.lz passt-073f530bfe0b21bb7c94cd047af94f0463dfe96d.tar.xz passt-073f530bfe0b21bb7c94cd047af94f0463dfe96d.tar.zst passt-073f530bfe0b21bb7c94cd047af94f0463dfe96d.zip |
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 <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | icmp.c | 2 | ||||
-rw-r--r-- | util.h | 3 |
2 files changed, 4 insertions, 1 deletions
@@ -169,7 +169,7 @@ int icmp_tap_handler(const struct ctx *c, uint8_t pif, int af, if (af == AF_INET) { struct sockaddr_in sa = { .sin_family = AF_INET, - .sin_addr = { .s_addr = htonl(INADDR_ANY) }, + .sin_addr = IN4ADDR_ANY_INIT, }; union icmp_epoll_ref iref; struct icmphdr *ih; @@ -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, |