diff --git a/doc/configuration.txt b/doc/configuration.txt index 52e6cf44b..dc43003e8 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -10936,6 +10936,9 @@ source [:[-]] [interface ] ... total concurrent connections. The limit will then reach 64k connections per server. + Since Linux 4.2/libc 2.23 IP_BIND_ADDRESS_NO_PORT is set for connections + specifying the source address without port(s). + Supported in default-server: No ssl diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 91d66881a..424731a6a 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -467,6 +467,10 @@ int tcp_connect_server(struct connection *conn, int data, int delack) } while (ret != 0); /* binding NOK */ } else { +#ifdef IP_BIND_ADDRESS_NO_PORT + static int bind_address_no_port = 1; + setsockopt(fd, SOL_IP, IP_BIND_ADDRESS_NO_PORT, (const void *) &bind_address_no_port, sizeof(int)); +#endif ret = tcp_bind_socket(fd, flags, &src->source_addr, &conn->addr.from); if (ret != 0) conn->err_code = CO_ER_CANT_BIND;