summaryrefslogtreecommitdiff
path: root/src/wps/http_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wps/http_server.c')
-rw-r--r--src/wps/http_server.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wps/http_server.c b/src/wps/http_server.c
index 6ca32140ae83..ac088c429d60 100644
--- a/src/wps/http_server.c
+++ b/src/wps/http_server.c
@@ -232,6 +232,7 @@ struct http_server * http_server_init(struct in_addr *addr, int port,
{
struct sockaddr_in sin;
struct http_server *srv;
+ int on = 1;
srv = os_zalloc(sizeof(*srv));
if (srv == NULL)
@@ -242,6 +243,15 @@ struct http_server * http_server_init(struct in_addr *addr, int port,
srv->fd = socket(AF_INET, SOCK_STREAM, 0);
if (srv->fd < 0)
goto fail;
+
+ if (setsockopt(srv->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
+ {
+ wpa_printf(MSG_DEBUG,
+ "HTTP: setsockopt(SO_REUSEADDR) failed: %s",
+ strerror(errno));
+ /* try to continue anyway */
+ }
+
if (fcntl(srv->fd, F_SETFL, O_NONBLOCK) < 0)
goto fail;
if (port < 0)