Skip to content

Commit

Permalink
mgt: Move -a(cceptor) and -s(torage) configuration until after VEXT load
Browse files Browse the repository at this point in the history
... 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.
  • Loading branch information
nigoroll committed Sep 6, 2024
1 parent 8d48b2d commit 92c12f2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
25 changes: 16 additions & 9 deletions bin/varnishd/mgt/mgt_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,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;
Expand Down Expand Up @@ -791,9 +790,6 @@ main(int argc, char * const *argv)
/* Process delayed arguments */
VTAILQ_FOREACH(alp, &arglist, list) {
switch(alp->arg[0]) {
case 'a':
MAC_Arg(alp->val);
break;
case 'f':
if (*alp->val != '\0')
alp->priv = mgt_f_read(alp->val);
Expand Down Expand Up @@ -824,9 +820,6 @@ main(int argc, char * const *argv)
case 'r':
MCF_ParamProtect(cli, alp->val);
break;
case 's':
STV_Config(alp->val);
break;
default:
break;
}
Expand Down Expand Up @@ -908,9 +901,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':
MAC_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();
Expand Down
2 changes: 2 additions & 0 deletions bin/varnishtest/tests/c00003.vtc
Original file line number Diff line number Diff line change
@@ -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" {
Expand Down

0 comments on commit 92c12f2

Please sign in to comment.