mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
Fix hardcoded limit on client requests in RPC code
The virNetServerClient object had a hardcoded limit of 10 requests per client. Extend constructor to allow it to be passed in as a configurable variable. Wire this up to the 'max_client_requests' config parameter in libvirtd * daemon/libvirtd.c: Pass max_client_requests into services * src/rpc/virnetserverservice.c, src/rpc/virnetserverservice.h: Pass nrequests_client_max to clients * src/rpc/virnetserverclient.c, src/rpc/virnetserverclient.h: Allow configurable request limit
This commit is contained in:
parent
e5b9f355b0
commit
27111b350f
@ -486,6 +486,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
unix_sock_gid,
|
||||
config->auth_unix_rw,
|
||||
false,
|
||||
config->max_client_requests,
|
||||
NULL)))
|
||||
goto error;
|
||||
if (sock_path_ro &&
|
||||
@ -494,6 +495,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
unix_sock_gid,
|
||||
config->auth_unix_ro,
|
||||
true,
|
||||
config->max_client_requests,
|
||||
NULL)))
|
||||
goto error;
|
||||
|
||||
@ -509,6 +511,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
config->tcp_port,
|
||||
config->auth_tcp,
|
||||
false,
|
||||
config->max_client_requests,
|
||||
NULL)))
|
||||
goto error;
|
||||
|
||||
@ -543,6 +546,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
config->tls_port,
|
||||
config->auth_tls,
|
||||
false,
|
||||
config->max_client_requests,
|
||||
ctxt))) {
|
||||
virNetTLSContextFree(ctxt);
|
||||
goto error;
|
||||
|
@ -282,6 +282,7 @@ virNetServerClientCheckAccess(virNetServerClientPtr client)
|
||||
virNetServerClientPtr virNetServerClientNew(virNetSocketPtr sock,
|
||||
int auth,
|
||||
bool readonly,
|
||||
size_t nrequests_max,
|
||||
virNetTLSContextPtr tls)
|
||||
{
|
||||
virNetServerClientPtr client;
|
||||
@ -301,7 +302,7 @@ virNetServerClientPtr virNetServerClientNew(virNetSocketPtr sock,
|
||||
client->auth = auth;
|
||||
client->readonly = readonly;
|
||||
client->tlsCtxt = tls;
|
||||
client->nrequests_max = 10; /* XXX */
|
||||
client->nrequests_max = nrequests_max;
|
||||
|
||||
if (tls)
|
||||
virNetTLSContextRef(tls);
|
||||
|
@ -41,6 +41,7 @@ typedef int (*virNetServerClientFilterFunc)(virNetServerClientPtr client,
|
||||
virNetServerClientPtr virNetServerClientNew(virNetSocketPtr sock,
|
||||
int auth,
|
||||
bool readonly,
|
||||
size_t nrequests_max,
|
||||
virNetTLSContextPtr tls);
|
||||
|
||||
int virNetServerClientAddFilter(virNetServerClientPtr client,
|
||||
|
@ -39,6 +39,7 @@ struct _virNetServerService {
|
||||
|
||||
int auth;
|
||||
bool readonly;
|
||||
size_t nrequests_client_max;
|
||||
|
||||
virNetTLSContextPtr tls;
|
||||
|
||||
@ -65,6 +66,7 @@ static void virNetServerServiceAccept(virNetSocketPtr sock,
|
||||
if (!(client = virNetServerClientNew(clientsock,
|
||||
svc->auth,
|
||||
svc->readonly,
|
||||
svc->nrequests_client_max,
|
||||
svc->tls)))
|
||||
goto error;
|
||||
|
||||
@ -88,6 +90,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
|
||||
const char *service,
|
||||
int auth,
|
||||
bool readonly,
|
||||
size_t nrequests_client_max,
|
||||
virNetTLSContextPtr tls)
|
||||
{
|
||||
virNetServerServicePtr svc;
|
||||
@ -99,6 +102,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
|
||||
svc->refs = 1;
|
||||
svc->auth = auth;
|
||||
svc->readonly = readonly;
|
||||
svc->nrequests_client_max = nrequests_client_max;
|
||||
svc->tls = tls;
|
||||
if (tls)
|
||||
virNetTLSContextRef(tls);
|
||||
@ -138,6 +142,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
|
||||
gid_t grp,
|
||||
int auth,
|
||||
bool readonly,
|
||||
size_t nrequests_client_max,
|
||||
virNetTLSContextPtr tls)
|
||||
{
|
||||
virNetServerServicePtr svc;
|
||||
@ -149,6 +154,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
|
||||
svc->refs = 1;
|
||||
svc->auth = auth;
|
||||
svc->readonly = readonly;
|
||||
svc->nrequests_client_max = nrequests_client_max;
|
||||
svc->tls = tls;
|
||||
if (tls)
|
||||
virNetTLSContextRef(tls);
|
||||
|
@ -40,12 +40,14 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
|
||||
const char *service,
|
||||
int auth,
|
||||
bool readonly,
|
||||
size_t nrequests_client_max,
|
||||
virNetTLSContextPtr tls);
|
||||
virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
|
||||
mode_t mask,
|
||||
gid_t grp,
|
||||
int auth,
|
||||
bool readonly,
|
||||
size_t nrequests_client_max,
|
||||
virNetTLSContextPtr tls);
|
||||
|
||||
int virNetServerServiceGetPort(virNetServerServicePtr svc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user