net: Change makesock_addrinfo() to set given flowopts before SO_REUSEADDR.
[paraslash.git] / net.c
diff --git a/net.c b/net.c
index 5e4f131..a95f145 100644 (file)
--- a/net.c
+++ b/net.c
@@ -440,6 +440,7 @@ static int makesock_addrinfo(unsigned l4type, bool passive, struct addrinfo *ai,
                if (ret < 0)
                        goto get_next_dst;
                sockfd = ret;
+               flowopt_setopts(sockfd, fo);
                /*
                 * Reuse the address on passive sockets to avoid failure on
                 * restart (protocols using listen()) and when creating
@@ -453,7 +454,6 @@ static int makesock_addrinfo(unsigned l4type, bool passive, struct addrinfo *ai,
                                para_strerror(-ret));
                        break;
                }
-               flowopt_setopts(sockfd, fo);
 
                if (passive) {
                        if (bind(sockfd, src->ai_addr, src->ai_addrlen) < 0) {