From: Tobias Brunner Date: Tue, 6 Sep 2022 14:11:49 +0000 (+0200) Subject: socket-default: Don't set SO_REUSEADDR on IKE sockets anymore X-Git-Tag: 5.9.8rc1~17 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=83da1337129221935afdbc16ffd5a6573e974073;p=thirdparty%2Fstrongswan.git socket-default: Don't set SO_REUSEADDR on IKE sockets anymore 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. --- diff --git a/src/libcharon/plugins/socket_default/socket_default_socket.c b/src/libcharon/plugins/socket_default/socket_default_socket.c index ef6350f10a..f551710177 100644 --- a/src/libcharon/plugins/socket_default/socket_default_socket.c +++ b/src/libcharon/plugins/socket_default/socket_default_socket.c @@ -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)