Fix heartbeat receiver not working.
authorTatsuo Ishii <ishii@postgresql.org>
Thu, 5 Jun 2025 10:42:40 +0000 (19:42 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Thu, 5 Jun 2025 10:42:40 +0000 (19:42 +0900)
commitf0d0abb4c596c821fb81d8f47e12da75a89cb3fe
treee58bbfa2831c73b22b0635859be1788b4523f5cb
parentc15a1075a04d2c6089f2d4278d79e22b84500a87
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 <pengbo@sraoss.co.jp>
Backpatch-through: v4.6
src/watchdog/wd_heartbeat.c