mirror of git://git.gnupg.org/gnupg.git
Change backlog from 5 to 64 and provide option --listen-backlog.
* agent/gpg-agent.c (oListenBacklog): New const. (opts): New option --listen-backlog. (listen_backlog): New var. (main): Parse new options. (create_server_socket): Use var instead of 5. * dirmngr/dirmngr.c: Likewise. * scd/scdaemon.c: Likewise. -- GnuPG-bug-id: 3473 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
17efcd2a2a
commit
c81a447190
|
@ -136,6 +136,7 @@ enum cmd_and_opt_values
|
||||||
oDisableCheckOwnSocket,
|
oDisableCheckOwnSocket,
|
||||||
oS2KCount,
|
oS2KCount,
|
||||||
oAutoExpandSecmem,
|
oAutoExpandSecmem,
|
||||||
|
oListenBacklog,
|
||||||
|
|
||||||
oWriteEnvFile
|
oWriteEnvFile
|
||||||
};
|
};
|
||||||
|
@ -255,6 +256,8 @@ static ARGPARSE_OPTS opts[] = {
|
||||||
|
|
||||||
ARGPARSE_op_u (oAutoExpandSecmem, "auto-expand-secmem", "@"),
|
ARGPARSE_op_u (oAutoExpandSecmem, "auto-expand-secmem", "@"),
|
||||||
|
|
||||||
|
ARGPARSE_s_i (oListenBacklog, "listen-backlog", "@"),
|
||||||
|
|
||||||
/* Dummy options for backward compatibility. */
|
/* Dummy options for backward compatibility. */
|
||||||
ARGPARSE_o_s (oWriteEnvFile, "write-env-file", "@"),
|
ARGPARSE_o_s (oWriteEnvFile, "write-env-file", "@"),
|
||||||
ARGPARSE_s_n (oUseStandardSocket, "use-standard-socket", "@"),
|
ARGPARSE_s_n (oUseStandardSocket, "use-standard-socket", "@"),
|
||||||
|
@ -371,6 +374,10 @@ static assuan_sock_nonce_t socket_nonce_extra;
|
||||||
static assuan_sock_nonce_t socket_nonce_browser;
|
static assuan_sock_nonce_t socket_nonce_browser;
|
||||||
static assuan_sock_nonce_t socket_nonce_ssh;
|
static assuan_sock_nonce_t socket_nonce_ssh;
|
||||||
|
|
||||||
|
/* Value for the listen() backlog argument. We use the same value for
|
||||||
|
* all sockets - 64 is on current Linux half of the default maximum.
|
||||||
|
* Let's try this as default. Change at runtime with --listen-backlog. */
|
||||||
|
static int listen_backlog = 64;
|
||||||
|
|
||||||
/* Default values for options passed to the pinentry. */
|
/* Default values for options passed to the pinentry. */
|
||||||
static char *default_display;
|
static char *default_display;
|
||||||
|
@ -1245,6 +1252,10 @@ main (int argc, char **argv )
|
||||||
(unsigned int)pargs.r.ret_ulong, 0);
|
(unsigned int)pargs.r.ret_ulong, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case oListenBacklog:
|
||||||
|
listen_backlog = pargs.r.ret_int;
|
||||||
|
break;
|
||||||
|
|
||||||
case oDebugQuickRandom:
|
case oDebugQuickRandom:
|
||||||
/* Only used by the first stage command line parser. */
|
/* Only used by the first stage command line parser. */
|
||||||
break;
|
break;
|
||||||
|
@ -2248,9 +2259,10 @@ create_server_socket (char *name, int primary, int cygwin,
|
||||||
log_error (_("can't set permissions of '%s': %s\n"),
|
log_error (_("can't set permissions of '%s': %s\n"),
|
||||||
unaddr->sun_path, strerror (errno));
|
unaddr->sun_path, strerror (errno));
|
||||||
|
|
||||||
if (listen (FD2INT(fd), 5 ) == -1)
|
if (listen (FD2INT(fd), listen_backlog ) == -1)
|
||||||
{
|
{
|
||||||
log_error (_("listen() failed: %s\n"), strerror (errno));
|
log_error ("listen(fd,%d) failed: %s\n",
|
||||||
|
listen_backlog, strerror (errno));
|
||||||
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
*name = 0; /* Inhibit removal of the socket by cleanup(). */
|
||||||
assuan_sock_close (fd);
|
assuan_sock_close (fd);
|
||||||
xfree (unaddr);
|
xfree (unaddr);
|
||||||
|
|
|
@ -151,6 +151,7 @@ enum cmd_and_opt_values {
|
||||||
oResolverTimeout,
|
oResolverTimeout,
|
||||||
oConnectTimeout,
|
oConnectTimeout,
|
||||||
oConnectQuickTimeout,
|
oConnectQuickTimeout,
|
||||||
|
oListenBacklog,
|
||||||
aTest
|
aTest
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -256,6 +257,7 @@ static ARGPARSE_OPTS opts[] = {
|
||||||
ARGPARSE_s_i (oResolverTimeout, "resolver-timeout", "@"),
|
ARGPARSE_s_i (oResolverTimeout, "resolver-timeout", "@"),
|
||||||
ARGPARSE_s_i (oConnectTimeout, "connect-timeout", "@"),
|
ARGPARSE_s_i (oConnectTimeout, "connect-timeout", "@"),
|
||||||
ARGPARSE_s_i (oConnectQuickTimeout, "connect-quick-timeout", "@"),
|
ARGPARSE_s_i (oConnectQuickTimeout, "connect-quick-timeout", "@"),
|
||||||
|
ARGPARSE_s_i (oListenBacklog, "listen-backlog", "@"),
|
||||||
|
|
||||||
ARGPARSE_group (302,N_("@\n(See the \"info\" manual for a complete listing "
|
ARGPARSE_group (302,N_("@\n(See the \"info\" manual for a complete listing "
|
||||||
"of all commands and options)\n")),
|
"of all commands and options)\n")),
|
||||||
|
@ -296,6 +298,10 @@ static const char *redir_socket_name;
|
||||||
POSIX systems). */
|
POSIX systems). */
|
||||||
static assuan_sock_nonce_t socket_nonce;
|
static assuan_sock_nonce_t socket_nonce;
|
||||||
|
|
||||||
|
/* Value for the listen() backlog argument.
|
||||||
|
* Change at runtime with --listen-backlog. */
|
||||||
|
static int listen_backlog = 64;
|
||||||
|
|
||||||
/* Only if this flag has been set will we remove the socket file. */
|
/* Only if this flag has been set will we remove the socket file. */
|
||||||
static int cleanup_socket;
|
static int cleanup_socket;
|
||||||
|
|
||||||
|
@ -1019,6 +1025,10 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
case oSocketName: socket_name = pargs.r.ret_str; break;
|
case oSocketName: socket_name = pargs.r.ret_str; break;
|
||||||
|
|
||||||
|
case oListenBacklog:
|
||||||
|
listen_backlog = pargs.r.ret_int;
|
||||||
|
break;
|
||||||
|
|
||||||
default : pargs.err = configfp? 1:2; break;
|
default : pargs.err = configfp? 1:2; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1263,9 +1273,10 @@ main (int argc, char **argv)
|
||||||
log_error (_("can't set permissions of '%s': %s\n"),
|
log_error (_("can't set permissions of '%s': %s\n"),
|
||||||
serv_addr.sun_path, strerror (errno));
|
serv_addr.sun_path, strerror (errno));
|
||||||
|
|
||||||
if (listen (FD2INT (fd), 5) == -1)
|
if (listen (FD2INT (fd), listen_backlog) == -1)
|
||||||
{
|
{
|
||||||
log_error (_("listen() failed: %s\n"), strerror (errno));
|
log_error ("listen(fd,%d) failed: %s\n",
|
||||||
|
listen_backlog, strerror (errno));
|
||||||
assuan_sock_close (fd);
|
assuan_sock_close (fd);
|
||||||
dirmngr_exit (1);
|
dirmngr_exit (1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,6 +282,10 @@ default values are 15 and 2 seconds. Note that the timeout values are
|
||||||
for each connection attempt; the connection code will attempt to
|
for each connection attempt; the connection code will attempt to
|
||||||
connect all addresses listed for a server.
|
connect all addresses listed for a server.
|
||||||
|
|
||||||
|
@item --listen-backlog @var{n}
|
||||||
|
@opindex listen-backlog
|
||||||
|
Set the size of the queue for pending connections. The default is 64.
|
||||||
|
|
||||||
@item --allow-version-check
|
@item --allow-version-check
|
||||||
@opindex allow-version-check
|
@opindex allow-version-check
|
||||||
Allow Dirmngr to connect to @code{https://versions.gnupg.org} to get
|
Allow Dirmngr to connect to @code{https://versions.gnupg.org} to get
|
||||||
|
|
|
@ -563,6 +563,9 @@ Ignore requests to change the current @code{tty} or X window system's
|
||||||
@code{DISPLAY} variable respectively. This is useful to lock the
|
@code{DISPLAY} variable respectively. This is useful to lock the
|
||||||
pinentry to pop up at the @code{tty} or display you started the agent.
|
pinentry to pop up at the @code{tty} or display you started the agent.
|
||||||
|
|
||||||
|
@item --listen-backlog @var{n}
|
||||||
|
@opindex listen-backlog
|
||||||
|
Set the size of the queue for pending connections. The default is 64.
|
||||||
|
|
||||||
@anchor{option --extra-socket}
|
@anchor{option --extra-socket}
|
||||||
@item --extra-socket @var{name}
|
@item --extra-socket @var{name}
|
||||||
|
|
|
@ -236,6 +236,12 @@ a list of categories see the Libassuan manual.
|
||||||
Don't detach the process from the console. This is mainly useful for
|
Don't detach the process from the console. This is mainly useful for
|
||||||
debugging.
|
debugging.
|
||||||
|
|
||||||
|
@item --listen-backlog @var{n}
|
||||||
|
@opindex listen-backlog
|
||||||
|
Set the size of the queue for pending connections. The default is 64.
|
||||||
|
This option has an effect only if @option{--multi-server} is also
|
||||||
|
used.
|
||||||
|
|
||||||
@item --log-file @var{file}
|
@item --log-file @var{file}
|
||||||
@opindex log-file
|
@opindex log-file
|
||||||
Append all logging output to @var{file}. This is very helpful in
|
Append all logging output to @var{file}. This is very helpful in
|
||||||
|
|
|
@ -99,6 +99,7 @@ enum cmd_and_opt_values
|
||||||
oDenyAdmin,
|
oDenyAdmin,
|
||||||
oDisableApplication,
|
oDisableApplication,
|
||||||
oEnablePinpadVarlen,
|
oEnablePinpadVarlen,
|
||||||
|
oListenBacklog
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,6 +157,7 @@ static ARGPARSE_OPTS opts[] = {
|
||||||
ARGPARSE_s_n (oEnablePinpadVarlen, "enable-pinpad-varlen",
|
ARGPARSE_s_n (oEnablePinpadVarlen, "enable-pinpad-varlen",
|
||||||
N_("use variable length input for pinpad")),
|
N_("use variable length input for pinpad")),
|
||||||
ARGPARSE_s_s (oHomedir, "homedir", "@"),
|
ARGPARSE_s_s (oHomedir, "homedir", "@"),
|
||||||
|
ARGPARSE_s_i (oListenBacklog, "listen-backlog", "@"),
|
||||||
|
|
||||||
ARGPARSE_end ()
|
ARGPARSE_end ()
|
||||||
};
|
};
|
||||||
|
@ -224,6 +226,10 @@ static char *redir_socket_name;
|
||||||
POSIX systems). */
|
POSIX systems). */
|
||||||
static assuan_sock_nonce_t socket_nonce;
|
static assuan_sock_nonce_t socket_nonce;
|
||||||
|
|
||||||
|
/* Value for the listen() backlog argument. Change at runtime with
|
||||||
|
* --listen-backlog. */
|
||||||
|
static int listen_backlog = 64;
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
static HANDLE the_event;
|
static HANDLE the_event;
|
||||||
#else
|
#else
|
||||||
|
@ -594,6 +600,10 @@ main (int argc, char **argv )
|
||||||
|
|
||||||
case oEnablePinpadVarlen: opt.enable_pinpad_varlen = 1; break;
|
case oEnablePinpadVarlen: opt.enable_pinpad_varlen = 1; break;
|
||||||
|
|
||||||
|
case oListenBacklog:
|
||||||
|
listen_backlog = pargs.r.ret_int;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
pargs.err = configfp? ARGPARSE_PRINT_WARNING:ARGPARSE_PRINT_ERROR;
|
pargs.err = configfp? ARGPARSE_PRINT_WARNING:ARGPARSE_PRINT_ERROR;
|
||||||
break;
|
break;
|
||||||
|
@ -1128,10 +1138,10 @@ create_server_socket (const char *name, char **r_redir_name,
|
||||||
log_error (_("can't set permissions of '%s': %s\n"),
|
log_error (_("can't set permissions of '%s': %s\n"),
|
||||||
unaddr->sun_path, strerror (errno));
|
unaddr->sun_path, strerror (errno));
|
||||||
|
|
||||||
if (listen (FD2INT(fd), 5 ) == -1)
|
if (listen (FD2INT(fd), listen_backlog) == -1)
|
||||||
{
|
{
|
||||||
log_error (_("listen() failed: %s\n"),
|
log_error ("listen(fd, %d) failed: %s\n",
|
||||||
gpg_strerror (gpg_error_from_syserror ()));
|
listen_backlog, gpg_strerror (gpg_error_from_syserror ()));
|
||||||
assuan_sock_close (fd);
|
assuan_sock_close (fd);
|
||||||
scd_exit (2);
|
scd_exit (2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue