From a63199832a737dde45500e4037608727701c782f Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 21 May 2024 15:57:04 +1000 Subject: inany: Better helpers for using inany and specific family addrs together This adds some extra inany helpers for comparing an inany address to addresses of a specific family (including special addresses), and building an inany from an IPv4 address (either statically or at runtime). Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- inany.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'inany.c') diff --git a/inany.c b/inany.c index c8479a7..5e391dc 100644 --- a/inany.c +++ b/inany.c @@ -17,21 +17,8 @@ #include "siphash.h" #include "inany.h" -const union inany_addr inany_loopback4 = { - .v4mapped = { - .zero = { 0 }, - .one = { 0xff, 0xff, }, - .a4 = IN4ADDR_LOOPBACK_INIT, - }, -}; - -const union inany_addr inany_any4 = { - .v4mapped = { - .zero = { 0 }, - .one = { 0xff, 0xff, }, - .a4 = IN4ADDR_ANY_INIT, - }, -}; +const union inany_addr inany_loopback4 = INANY_INIT4(IN4ADDR_LOOPBACK_INIT); +const union inany_addr inany_any4 = INANY_INIT4(IN4ADDR_ANY_INIT); /** inany_ntop - Convert an IPv[46] address to text format * @src: IPv[46] address -- cgit v1.2.3