Skip to content

Commit

Permalink
socket_options: move comment for SO_REUSEADDR
Browse files Browse the repository at this point in the history
This commit moves the comment about setting SO_REUSEADDR
socket option to the code that is actually setting the option.

Signed-off-by: Marco Hofstetter <[email protected]>
  • Loading branch information
mhofstetter committed Jan 7, 2025
1 parent 6677a57 commit 825f251
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cilium/socket_option.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ class SocketMarkOption : public Network::Socket::Option,
// identity is zero for the listener socket itself, set transparent and reuse options also for
// the listener socket.
if (source_address || identity_ == 0) {
// Allow reuse of the original source address. This may by needed for
// retries to not fail on "address already in use" when using a specific
// source address and port.

{
// Set ip transparent option based on the socket address family
auto ip_socket_level = SOL_IP;
Expand Down Expand Up @@ -125,6 +121,9 @@ class SocketMarkOption : public Network::Socket::Option,
}
}

// Allow reuse of the original source address. This may by needed for
// retries to not fail on "address already in use" when using a specific
// source address and port.
{
auto status = socket.setSocketOption(SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
if (status.return_value_ < 0) {
Expand Down

0 comments on commit 825f251

Please sign in to comment.