From d52f7279063817055b6816d9f8372e374c90f75f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 21 Dec 2023 13:02:43 +0100 Subject: [PATCH] lib/util: let is_zero_addr() return true for AF_UNSPEC MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It means the completely zero'ed structure is detected as zero address, as AF_UNSPEC is 0. Signed-off-by: Stefan Metzmacher Reviewed-by: Günther Deschner Reviewed-by: Andreas Schneider --- lib/util/util_net.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/util/util_net.c b/lib/util/util_net.c index acaa76ea74e..48c9552558b 100644 --- a/lib/util/util_net.c +++ b/lib/util/util_net.c @@ -642,6 +642,9 @@ bool is_zero_addr(const struct sockaddr_storage *pss) const struct in_addr *pin = &((const struct sockaddr_in *)pss)->sin_addr; return is_zero_ip_v4(*pin); } + if (pss->ss_family == AF_UNSPEC) { + return true; + } return false; } -- 2.47.3