]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
socket-default: Don't set SO_REUSEADDR on IKE sockets anymore
authorTobias Brunner <tobias@strongswan.org>
Tue, 6 Sep 2022 14:11:49 +0000 (16:11 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 21 Sep 2022 11:53:44 +0000 (13:53 +0200)
This was originally required when pluto and charon both bound sockets to
the same port to send messages.  Pluto also received messages on them but
charon didn't and used a raw socket instead.  Since the removal of pluto
we don't need to set this option anymore, which might actually mask
mistakes like running charon and charon-systemd concurrently (that could
result in messages getting sent fine by both daemons but only received
by one).

Note that a failure to create/bind the sockets will not immediately
result in a shutdown of the daemon.  Instead, there will be an error
once the receiver tries to read any messages and also whenever the sender
attempts to send a request.

src/libcharon/plugins/socket_default/socket_default_socket.c

index ef6350f10adaba9285ee5fc146ff7b9661c0c63b..f55171017741a9fdec66158898078f9e40d683ed 100644 (file)
@@ -698,12 +698,6 @@ static int open_socket(private_socket_default_socket_t *this,
                DBG1(DBG_NET, "could not open socket: %s", strerror(errno));
                return -1;
        }
-       if (setsockopt(skt, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof(on)) < 0)
-       {
-               DBG1(DBG_NET, "unable to set SO_REUSEADDR on socket: %s", strerror(errno));
-               close(skt);
-               return -1;
-       }
 
        /* bind the socket */
        if (bind(skt, &addr.sockaddr, addrlen) < 0)