ocean icon indicating copy to clipboard operation
ocean copied to clipboard

Make use of `IP_FREEBIND` in listeners.

Open nemanja-boric-sociomantic opened this issue 7 years ago • 2 comments

from man 7 ip:

       IP_FREEBIND (since Linux 2.4)
              If enabled, this boolean option allows binding to an IP
              address that is nonlocal or does not (yet) exist.  This
              permits listening on a socket, without requiring the
              underlying network interface or the specified dynamic IP
              address to be up at the time that the application is trying to
              bind to it.  This option is the per-socket equivalent of the
              ip_nonlocal_bind /proc interface described below.

How is this useful for us?

As applications are able to bind on the given address, it is possible that no interfaces have yet obtained the IP address. In that case, it is desirable to start up the daemon anyway, so that it can startup with the routing in parallel without crashing (as bind will fail), or without synchronizing the application to startup after it. IP_FREEBIND has been developed just for that case.