public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Stelios Malathouras <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Does PostgreSQL listen_addresses='*' Dynamically Detect New Interfaces
Date: Mon, 05 May 2025 10:31:24 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <PAWPR05MB10431391F889466D240403A988D8E2@PAWPR05MB10431.eurprd05.prod.outlook.com>
References: <PAWPR05MB10431391F889466D240403A988D8E2@PAWPR05MB10431.eurprd05.prod.outlook.com>
Stelios Malathouras <[email protected]> writes:
> Our local tests, with listen_addresses = '*', show that the postgres listener accepts connections immediately to the new IP.
> The same behavior is observed when adding a new network interface. Postgres accepts connections to the new network interface (and IP) immediately without requiring a restart.
It might be platform-dependent. We call getaddrinfo(3) only once at
postmaster start, passing node = NULL if you said "*", and then
bind(2) to each resulting address. The Linux manpage for getaddrinfo
quoth
If the AI_PASSIVE flag is specified in hints.ai_flags, and node is
NULL, then the returned socket addresses will be suitable for
bind(2)ing a socket that will accept(2) connections. The returned
socket address will contain the "wildcard address" (INADDR_ANY for IPv4
addresses, IN6ADDR_ANY_INIT for IPv6 address). The wildcard address is
used by applications (typically servers) that intend to accept connecā
tions on any of the host's network addresses.
The POSIX standard for getaddrinfo also says that these parameters
yield a wildcard address, but it doesn't say in so many words that
that results in accepting connections on any of the machine's
interfaces. Maybe it says that elsewhere, though; I didn't go
digging. In any case, you're probably fine on any Linux box,
but if you want to rely on this behavior on some other platform
I'd advise testing first.
regards, tom lane
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Does PostgreSQL listen_addresses='*' Dynamically Detect New Interfaces
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox