Thursday, October 29, 2020

Re: wg(4) listen on a specific interface / address

Pierre Emeriaud <petrus.lt+openbsd@gmail.com> wrote:

> Totally agreed. This is because of my stupid idea to share port 53 for
> this use. Maybe my understanding of sockets was wrong, but I thought
> that applications could use the bind port _if and only_ they weren't
> trying to bind the same IP+port, hence my question about this
> conflict, which could happen with other ports as well.

Such a weird perspective. I guess you've never setup a multhomed
machine. INADDR_ANY means all interfaces, so a daemon doesn't need
to open a new socket on each interfaces, and listen to the route socket
for new interfaces to arrive, or old ones to be disconnected.

> Thanks everyone who answered, and if anyone has the definitive answer
> about why it wg binds INADDR_ANY, I'd be interested to know.

Why does sshd bind to INADDR_ANY? Why does httpd bind to INADDR_ANY?
The same reason for wg. It wants to respond to requests on all interfaces.
And the loopback is not exempt.

No comments:

Post a Comment