Fix heartbeat device treatment.
authorTatsuo Ishii <ishii@postgresql.org>
Sat, 14 Jun 2025 11:12:57 +0000 (20:12 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Sat, 14 Jun 2025 11:29:17 +0000 (20:29 +0900)
commite5564eb541af139fe825e1563e3ca0a6d522553c
tree2dc0ed6e4f2ade97efeddd51a673201fd7456032
parent6b28f44f8077ec92276e1e5bd03517bd8b8a0b72
Fix heartbeat device treatment.

wd_create_hb_recv_socket() and wd_create_hb_send_socket() called
setsockopt(2) with wrong argument.

struct ifreq i;
strlcpy(i.ifr_name, hb_if->if_name, sizeof(i.ifr_name));
if (setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, &i, sizeof(i)) == -1)
:

This is not quite correct since the 4th argument should be
just a null terminated string (device name), not struct ifreq.

Discussion: [pgpool-hackers: 4602] heartbeat and SO_BINDTODEVICE
https://www.pgpool.net/pipermail/pgpool-hackers/2025-May/004603.html
Backpatch-through: v4.6
src/watchdog/wd_heartbeat.c