]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
_dbus_listen_tcp_socket: comment on another reason to ignore EADDRINUSE
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 4 Feb 2015 13:16:18 +0000 (13:16 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 4 Feb 2015 15:19:43 +0000 (15:19 +0000)
Not being aware of the second reason described here caused bug #87999
in the equivalent code on Windows.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=87999

dbus/dbus-sysdeps-unix.c

index f6ec8abc521ae1ceb80e0ee1e3185c9ac451660c..dcfddd17c28c16d93eaa60c2844c0e9435a96658 100644 (file)
@@ -1463,9 +1463,18 @@ _dbus_listen_tcp_socket (const char     *host,
           _dbus_close(fd, NULL);
           if (saved_errno == EADDRINUSE)
             {
-              /* Depending on kernel policy, it may or may not
-                 be neccessary to bind to both IPv4 & 6 addresses
-                 so ignore EADDRINUSE here */
+              /* Depending on kernel policy, binding to an IPv6 address
+                 might implicitly bind to a corresponding IPv4
+                 address or vice versa, resulting in EADDRINUSE for the
+                 other one (e.g. bindv6only=0 on Linux).
+
+                 Also, after we "goto redo_lookup_with_port" after binding
+                 a port on one of the possible addresses, we will
+                 try to bind that same port on every address, including the
+                 same address again for a second time; that one will
+                 also fail with EADDRINUSE.
+
+                 For both those reasons, ignore EADDRINUSE here */
               tmp = tmp->ai_next;
               continue;
             }