Commit ab550bae authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Report errors on listen() to the management process.

If the listen() system call were to report problems, they are now reported
back to the management process, failing the child startup (instead of
asserting). This can happen on many widely used Linux kernels if the
listen socket already has another process listening on that port with the
SO_REUSEPORT flag set.

Newer Linux kernels will report the problem at bind() time (causing error
to be reported upon management process startup).

Fixes: #2551
parent f9ea7e34
...@@ -631,7 +631,12 @@ ccf_start(struct cli *cli, const char * const *av, void *priv) ...@@ -631,7 +631,12 @@ ccf_start(struct cli *cli, const char * const *av, void *priv)
"Kernel TCP Fast Open: sock=%d, ret=%d %s", "Kernel TCP Fast Open: sock=%d, ret=%d %s",
ls->sock, i, strerror(errno)); ls->sock, i, strerror(errno));
} }
AZ(listen(ls->sock, cache_param->listen_depth)); if (listen(ls->sock, cache_param->listen_depth)) {
VCLI_SetResult(cli, CLIS_CANT);
VCLI_Out(cli, "Listen failed on socket '%s': %s",
ls->endpoint, strerror(errno));
return;
}
vca_tcp_opt_set(ls, 1); vca_tcp_opt_set(ls, 1);
if (cache_param->accept_filter) { if (cache_param->accept_filter) {
int i; int i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment