From f0d0abb4c596c821fb81d8f47e12da75a89cb3fe Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Thu, 5 Jun 2025 19:42:40 +0900 Subject: [PATCH] Fix heartbeat receiver not working. 65dbbe7a0 added IPv6 support for heartbeat in 4.6. However it mistakenly bound to only loopback addresses in heartbeat receive process. Thus heartbeat messages from other watchdog heartbeat sender were never received. To fix this add AI_PASSIVE flag to hints argument to getaddrinfo(), which results in binding all network interfaces. Note that before 4.6, heartbeat receive process uses INADDR_ANY for bind(), which resulted in binding all network interfaces too. So there's no big difference between 4.6 and pre-4.6. Reviewed-by: Bo Peng Backpatch-through: v4.6 --- src/watchdog/wd_heartbeat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/watchdog/wd_heartbeat.c b/src/watchdog/wd_heartbeat.c index c13e12b6c..561cdfccf 100644 --- a/src/watchdog/wd_heartbeat.c +++ b/src/watchdog/wd_heartbeat.c @@ -271,7 +271,7 @@ wd_create_hb_recv_socket(WdHbIf * hb_if) hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; - hints.ai_flags = AI_NUMERICSERV; + hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE; if ((gai_ret = getaddrinfo(NULL, portstr, &hints, &res)) != 0) { -- 2.39.5