mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-25 20:38:03 +00:00
MINOR: enable IP_BIND_ADDRESS_NO_PORT on backend connections
Enable IP_BIND_ADDRESS_NO_PORT on backend connections when the source address is specified without port or port ranges. This is supported since Linux 4.2/libc 2.23. If the kernel supports it but the libc doesn't, we can define it at build time: make [...] DEFINE=-DIP_BIND_ADDRESS_NO_PORT=24 For more informations about this feature, see Linux commit 90c337da
This commit is contained in:
parent
a0bcbdcb04
commit
7d56c6d347
@ -10936,6 +10936,9 @@ source <addr>[:<pl>[-<ph>]] [interface <name>] ...
|
|||||||
total concurrent connections. The limit will then reach 64k connections per
|
total concurrent connections. The limit will then reach 64k connections per
|
||||||
server.
|
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
|
Supported in default-server: No
|
||||||
|
|
||||||
ssl
|
ssl
|
||||||
|
@ -467,6 +467,10 @@ int tcp_connect_server(struct connection *conn, int data, int delack)
|
|||||||
} while (ret != 0); /* binding NOK */
|
} while (ret != 0); /* binding NOK */
|
||||||
}
|
}
|
||||||
else {
|
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);
|
ret = tcp_bind_socket(fd, flags, &src->source_addr, &conn->addr.from);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
conn->err_code = CO_ER_CANT_BIND;
|
conn->err_code = CO_ER_CANT_BIND;
|
||||||
|
Loading…
Reference in New Issue
Block a user