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>
This commit is contained in:
parent
546332786c
commit
073f530bfe
2 changed files with 4 additions and 1 deletions
2
icmp.c
2
icmp.c
|
@ -169,7 +169,7 @@ int icmp_tap_handler(const struct ctx *c, uint8_t pif, int af,
|
||||||
if (af == AF_INET) {
|
if (af == AF_INET) {
|
||||||
struct sockaddr_in sa = {
|
struct sockaddr_in sa = {
|
||||||
.sin_family = AF_INET,
|
.sin_family = AF_INET,
|
||||||
.sin_addr = { .s_addr = htonl(INADDR_ANY) },
|
.sin_addr = IN4ADDR_ANY_INIT,
|
||||||
};
|
};
|
||||||
union icmp_epoll_ref iref;
|
union icmp_epoll_ref iref;
|
||||||
struct icmphdr *ih;
|
struct icmphdr *ih;
|
||||||
|
|
3
util.h
3
util.h
|
@ -122,6 +122,9 @@
|
||||||
(((struct in_addr *)(a))->s_addr == ((struct in_addr *)b)->s_addr)
|
(((struct in_addr *)(a))->s_addr == ((struct in_addr *)b)->s_addr)
|
||||||
#define IN4ADDR_LOOPBACK_INIT \
|
#define IN4ADDR_LOOPBACK_INIT \
|
||||||
{ .s_addr = htonl_constant(INADDR_LOOPBACK) }
|
{ .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)
|
#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,
|
int do_clone(int (*fn)(void *), char *stack_area, size_t stack_size, int flags,
|
||||||
|
|
Loading…
Reference in a new issue