From 15808b8d1147d23a725481883e462648ec949159 Mon Sep 17 00:00:00 2001 From: Nils Goroll Date: Fri, 6 Sep 2024 12:35:44 +0200 Subject: [PATCH] mgt: Move -a(cceptor) and -s(torage) configuration until after VEXT load ... to enable acceptor implementations as extensions (and also allow storage to make use of manager privileges, but for this we probably need a new or repurposed STV callback). One test adjustment was required: c3.vtc tests invalid -a usage, but did not set up a good working directory. Now that -a is processed later, the test ran into a working directory error instead of the expected acceptor error. --- bin/varnishd/mgt/mgt_main.c | 25 ++++++++++++++++--------- bin/varnishtest/tests/c00003.vtc | 2 ++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c index b11f253c4ac..eef8df2dc41 100644 --- a/bin/varnishd/mgt/mgt_main.c +++ b/bin/varnishd/mgt/mgt_main.c @@ -626,7 +626,6 @@ main(int argc, char * const *argv) const char *h_arg = "critbit"; const char *n_arg = getenv("VARNISH_DEFAULT_N"); const char *S_arg = NULL; - const char *s_arg = "default,100m"; const char *W_arg = NULL; const char *c; char *p; @@ -794,9 +793,6 @@ main(int argc, char * const *argv) /* Process delayed arguments */ VTAILQ_FOREACH(alp, &arglist, list) { switch(alp->arg[0]) { - case 'a': - VCA_Arg(alp->val); - break; case 'f': if (*alp->val != '\0') alp->priv = mgt_f_read(alp->val); @@ -827,9 +823,6 @@ main(int argc, char * const *argv) case 'r': MCF_ParamProtect(cli, alp->val); break; - case 's': - STV_Config(alp->val); - break; default: break; } @@ -922,9 +915,23 @@ main(int argc, char * const *argv) vext_copyin(vident); vext_load(); - /* If no -s argument specified, process default -s argument */ + /* defaults if arguments not present */ if (!arg_list_count("s")) - STV_Config(s_arg); + (void) arg_list_add('s', "default,100m"); + + VTAILQ_FOREACH(alp, &arglist, list) { + switch(alp->arg[0]) { + case 'a': + VCA_Arg(alp->val); + break; + case 's': + STV_Config(alp->val); + break; + default: + break; + } + cli_check(cli); + } /* Configure CLI and Transient storage, if user did not */ STV_Config_Final(); diff --git a/bin/varnishtest/tests/c00003.vtc b/bin/varnishtest/tests/c00003.vtc index 1ad25692225..08cbe9e629e 100644 --- a/bin/varnishtest/tests/c00003.vtc +++ b/bin/varnishtest/tests/c00003.vtc @@ -1,5 +1,7 @@ varnishtest "Check that we fail to start with erroneous -a/-b arguments" +setenv VARNISH_DEFAULT_N ${tmpdir} + # Duplicate -a arguments # XXX: this cannot be tested reliably, we tolerate port collision shell -err -match "have same address|already in use|Address in use" {