From phk at FreeBSD.org Tue Nov 11 09:03:05 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 11 Nov 2025 09:03:05 +0000 (UTC) Subject: [master] ecbbfc9c3 Update vtest2 Message-ID: <20251111090305.678C9119592@lists.vinyl-cache.org> commit ecbbfc9c3d25a6b2512e781b9c1aadfa6185ece1 Author: Poul-Henning Kamp Date: Tue Nov 11 08:12:31 2025 +0000 Update vtest2 diff --git a/bin/varnishtest/vtest2 b/bin/varnishtest/vtest2 index 11ee91098..6d0d1164b 160000 --- a/bin/varnishtest/vtest2 +++ b/bin/varnishtest/vtest2 @@ -1 +1 @@ -Subproject commit 11ee91098c7a1f0a1f8afab9a7356609bfd3cb2d +Subproject commit 6d0d1164be900f61cdf56211849312473bc1a200 From phk at FreeBSD.org Tue Nov 11 09:03:05 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 11 Nov 2025 09:03:05 +0000 (UTC) Subject: [master] 243104bd9 Adapt to VTest2 exposing api in vtest_api.h Message-ID: <20251111090305.7ABDE119596@lists.vinyl-cache.org> commit 243104bd9db10a0adc32f2fbdc58bbb0a1daa9be Author: Poul-Henning Kamp Date: Tue Nov 11 09:01:55 2025 +0000 Adapt to VTest2 exposing api in vtest_api.h diff --git a/bin/varnishtest/Makefile.am b/bin/varnishtest/Makefile.am index f001eb215..5138fda22 100644 --- a/bin/varnishtest/Makefile.am +++ b/bin/varnishtest/Makefile.am @@ -11,7 +11,8 @@ AM_CPPFLAGS = \ -I$(top_builddir)/include \ -I$(top_builddir) \ -I$(top_srcdir)/lib/libvgz \ - -I$(srcdir)/vtest2/lib + -I$(srcdir)/vtest2/lib \ + -I$(srcdir)/vtest2/src bin_PROGRAMS = varnishtest @@ -65,6 +66,7 @@ varnishtest_SOURCES = \ vtest2/src/vtc_tunnel.c \ vtest2/src/vtc_varnish.c \ vtest2/src/vtc_vsm.c \ + vtest2/src/vtest_api.h \ vtest2/lib/vudp.h \ vtest2/lib/vudp.c From phk at FreeBSD.org Tue Nov 11 09:32:05 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 11 Nov 2025 09:32:05 +0000 (UTC) Subject: [master] 8791e7a13 VTest2 needs -ldl now Message-ID: <20251111093205.4762911A810@lists.vinyl-cache.org> commit 8791e7a134cd9200f21533761af7874d4a96bd74 Author: Poul-Henning Kamp Date: Tue Nov 11 09:31:40 2025 +0000 VTest2 needs -ldl now diff --git a/bin/varnishtest/Makefile.am b/bin/varnishtest/Makefile.am index 5138fda22..863287324 100644 --- a/bin/varnishtest/Makefile.am +++ b/bin/varnishtest/Makefile.am @@ -74,7 +74,7 @@ varnishtest_LDADD = \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvgz/libvgz.la \ - ${PTHREAD_LIBS} ${NET_LIBS} ${LIBM} + ${PTHREAD_LIBS} ${NET_LIBS} ${LIBM} -ldl varnishtest_CFLAGS = \ -DVTEST_WITH_VTC_LOGEXPECT \ From phk at FreeBSD.org Tue Nov 11 09:32:05 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 11 Nov 2025 09:32:05 +0000 (UTC) Subject: [master] cb2cb1e98 Update vtest2 Message-ID: <20251111093205.5BF0D11A813@lists.vinyl-cache.org> commit cb2cb1e98f008e7cb1cf1736ff7c46a8003d108f Author: Poul-Henning Kamp Date: Tue Nov 11 09:31:50 2025 +0000 Update vtest2 diff --git a/bin/varnishtest/vtest2 b/bin/varnishtest/vtest2 index 6d0d1164b..9543477d8 160000 --- a/bin/varnishtest/vtest2 +++ b/bin/varnishtest/vtest2 @@ -1 +1 @@ -Subproject commit 6d0d1164be900f61cdf56211849312473bc1a200 +Subproject commit 9543477d8ae296908d23f42fd6ecaa362ea7be20 From phk at FreeBSD.org Wed Nov 19 07:56:05 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 19 Nov 2025 07:56:05 +0000 (UTC) Subject: [master] b94cb3d3b Update vtest2 Message-ID: <20251119075605.C9D5F1131FD@lists.vinyl-cache.org> commit b94cb3d3b3dd28a72b3faa217deb8375d719af4c Author: Poul-Henning Kamp Date: Wed Nov 19 07:40:06 2025 +0000 Update vtest2 diff --git a/bin/varnishtest/vtest2 b/bin/varnishtest/vtest2 index 9543477d8..7815ec5cd 160000 --- a/bin/varnishtest/vtest2 +++ b/bin/varnishtest/vtest2 @@ -1 +1 @@ -Subproject commit 9543477d8ae296908d23f42fd6ecaa362ea7be20 +Subproject commit 7815ec5cd02a56eb595ed14df7c77459a516c657 From phk at FreeBSD.org Wed Nov 19 07:56:05 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 19 Nov 2025 07:56:05 +0000 (UTC) Subject: [master] bb26ffcb9 Dont return values from void functions. Message-ID: <20251119075605.DE2B9113200@lists.vinyl-cache.org> commit bb26ffcb9652919621a465d9e5d4babc84f28319 Author: Poul-Henning Kamp Date: Wed Nov 19 07:55:28 2025 +0000 Dont return values from void functions. diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c index 4cdff3685..cc99f0153 100644 --- a/bin/varnishd/cache/cache_vrt_var.c +++ b/bin/varnishd/cache/cache_vrt_var.c @@ -608,7 +608,7 @@ REQ_VAR_U(grace, d_grace, -1) // deprecated, to be removed VCL_VOID VRT_l_req_ttl(VRT_CTX, VCL_DURATION arg) { VRT_l_req_max_age(ctx, arg); } VCL_DURATION VRT_r_req_ttl(VRT_CTX) { return (VRT_r_req_max_age(ctx)); } -VCL_VOID VRT_u_req_ttl(VRT_CTX) { return (VRT_u_req_max_age(ctx)); } +VCL_VOID VRT_u_req_ttl(VRT_CTX) { VRT_u_req_max_age(ctx); } VCL_VOID VRT_l_req_backend_hint(VRT_CTX, VCL_BACKEND be) From nils.goroll at uplex.de Wed Nov 19 14:14:04 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Wed, 19 Nov 2025 14:14:04 +0000 (UTC) Subject: [master] 45bee5f30 doc: fix typo Message-ID: <20251119141404.E17DE1205BB@lists.vinyl-cache.org> commit 45bee5f3086209ef9b2d29eeb8be8a7aa802081e Author: Nils Goroll Date: Wed Nov 19 15:13:49 2025 +0100 doc: fix typo diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index 3df2d4d0d..307c97a4b 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -352,7 +352,7 @@ individually: folded (e.g. if both 1.2.3.0/25 and 1.2.3.128/25 are added, they will be folded to 1.2.3.0/24). - Skip and fold operations on VCL entries are output as warnings + Skip and fold operations on ACL entries are output as warnings during VCL compilation as entries from the VCL are processed in order. From nils.goroll at uplex.de Wed Nov 19 14:20:05 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Wed, 19 Nov 2025 14:20:05 +0000 (UTC) Subject: [master] bb99e54f0 vcc_acl: pull out fold argument parsing Message-ID: <20251119142005.B7309120A55@lists.vinyl-cache.org> commit bb99e54f087038b8243e044875d5f50743b60bcb Author: Nils Goroll Date: Tue Oct 7 10:37:43 2025 +0200 vcc_acl: pull out fold argument parsing to reduce nesting in the next commit diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c index 356c77072..4f52ca1e9 100644 --- a/lib/libvcc/vcc_acl.c +++ b/lib/libvcc/vcc_acl.c @@ -803,6 +803,20 @@ vcc_acl_emit(struct vcc *tl, const struct symbol *sym) VSB_destroy(&func); } +static void +vcc_parseAclFold(struct vcc *tl, int sign) +{ + struct acl *acl; + + CHECK_OBJ_NOTNULL(tl, VCC_MAGIC); + assert(vcc_IdIs(tl->t, "fold")); + acl = tl->acl; + CHECK_OBJ_NOTNULL(acl, VCC_ACL_MAGIC); + + acl->flag_fold = sign; + vcc_NextToken(tl); +} + void vcc_ParseAcl(struct vcc *tl) { @@ -837,8 +851,7 @@ vcc_ParseAcl(struct vcc *tl) acl->flag_log = sign; vcc_NextToken(tl); } else if (vcc_IdIs(tl->t, "fold")) { - acl->flag_fold = sign; - vcc_NextToken(tl); + vcc_parseAclFold(tl, sign); } else if (vcc_IdIs(tl->t, "pedantic")) { acl->flag_pedantic = sign; vcc_NextToken(tl); From nils.goroll at uplex.de Wed Nov 19 14:20:05 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Wed, 19 Nov 2025 14:20:05 +0000 (UTC) Subject: [master] 155e83441 vcc_acl: Add +fold(-report) sub-option to omit fold warnings Message-ID: <20251119142005.CA9CC120A58@lists.vinyl-cache.org> commit 155e83441dd9068b03fe35c5b1b62d52012762ca Author: Nils Goroll Date: Wed Nov 12 09:56:26 2025 +0100 vcc_acl: Add +fold(-report) sub-option to omit fold warnings With a lot of folding going on, the warnings can easily bury more relevant CLI output. diff --git a/bin/varnishtest/tests/c00005.vtc b/bin/varnishtest/tests/c00005.vtc index 0a6e90517..51bb31e35 100644 --- a/bin/varnishtest/tests/c00005.vtc +++ b/bin/varnishtest/tests/c00005.vtc @@ -375,3 +375,39 @@ client c1 { } -run logexpect l1 -wait + +# test +fold(-report) +varnish v1 -cliexpect "^$" {vcl.inline silent << EOF + vcl 4.1; + + backend dummy None; + + acl acl1 +log +pedantic +fold(-report) { + "1.2.0.0"/23; + "1.2.2.0"/24; + "1.2.3.0"/24; + } + + sub vcl_recv { + if (client.ip ~ acl1) { + return (synth(403)); + } + } + EOF +} + +varnish v1 -errvcl "-fold(...) is invalid, use -fold" { + backend dummy None; + + acl acl1 +log +pedantic -fold(+foo) { + "1.2.0.0"/23; + } +} + +varnish v1 -errvcl "The only ACL fold sub-flag is `report`" { + backend dummy None; + + acl acl1 +log +pedantic +fold(+foo) { + "1.2.0.0"/23; + } +} diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index 307c97a4b..aae98629e 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -354,7 +354,7 @@ individually: Skip and fold operations on ACL entries are output as warnings during VCL compilation as entries from the VCL are processed in - order. + order unless the `-report` sub-flag is also given (see below). Logging under the ``VCL_acl`` tag can change with this parameter enabled: Matches on skipped subnet entries are now logged as matches @@ -365,6 +365,19 @@ individually: Negated ACL entries are never folded. + Exactly one sub-flag is supported following `fold` in parenthesis: + + - `+fold(+report)` - Fold with reporting (default) + + Report about folding as described above + + - `+fold(-report)` - Fold without reporting + + Enable folding, but do not output folding-related warnings during VCL + compilation + + The ``report`` sub-option is only valid with ``+fold``. + VCL objects ----------- diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c index 4f52ca1e9..47d4d3350 100644 --- a/lib/libvcc/vcc_acl.c +++ b/lib/libvcc/vcc_acl.c @@ -54,6 +54,7 @@ struct acl { int flag_log; int flag_fold; + int flag_fold_report; int flag_pedantic; int flag_table; @@ -263,11 +264,13 @@ vcl_acl_fold(struct vcc *tl, struct acl_e **l, struct acl_e **r) do { switch (cmp) { case ACL_CONTAINED: - VSB_cat(tl->sb, "ACL entry:\n"); - vcc_ErrWhere(tl, (*r)->t_addr); - VSB_cat(tl->sb, "supersedes / removes:\n"); - vcc_ErrWhere(tl, (*l)->t_addr); - vcc_Warn(tl); + if (tl->acl->flag_fold_report) { + VSB_cat(tl->sb, "ACL entry:\n"); + vcc_ErrWhere(tl, (*r)->t_addr); + VSB_cat(tl->sb, "supersedes / removes:\n"); + vcc_ErrWhere(tl, (*l)->t_addr); + vcc_Warn(tl); + } VRBT_REMOVE(acl_tree, &tl->acl->acl_tree, *l); FREE_OBJ(*l); *l = VRBT_PREV(acl_tree, &tl->acl->acl_tree, *r); @@ -275,14 +278,16 @@ vcl_acl_fold(struct vcc *tl, struct acl_e **l, struct acl_e **r) case ACL_LEFT: (*l)->mask--; (*l)->fixed = "folded"; - VSB_cat(tl->sb, "ACL entry:\n"); - vcc_ErrWhere(tl, (*l)->t_addr); - VSB_cat(tl->sb, "left of:\n"); - vcc_ErrWhere(tl, (*r)->t_addr); - VSB_printf(tl->sb, "removing the latter and expanding " - "mask of the former by one to /%u\n", - (*l)->mask - 8); - vcc_Warn(tl); + if (tl->acl->flag_fold_report) { + VSB_cat(tl->sb, "ACL entry:\n"); + vcc_ErrWhere(tl, (*l)->t_addr); + VSB_cat(tl->sb, "left of:\n"); + vcc_ErrWhere(tl, (*r)->t_addr); + VSB_printf(tl->sb, "removing the latter and " + "expanding mask of the former by one to " + "/%u\n", (*l)->mask - 8); + vcc_Warn(tl); + } VRBT_REMOVE(acl_tree, &tl->acl->acl_tree, *r); FREE_OBJ(*r); VRBT_REMOVE(acl_tree, &tl->acl->acl_tree, *l); @@ -814,7 +819,39 @@ vcc_parseAclFold(struct vcc *tl, int sign) CHECK_OBJ_NOTNULL(acl, VCC_ACL_MAGIC); acl->flag_fold = sign; + acl->flag_fold_report = 1; vcc_NextToken(tl); + if (tl->t->tok != '(') + return; + + if (! acl->flag_fold) { + VSB_cat(tl->sb, "-fold(...) is invalid, use -fold:\n"); + vcc_ErrWhere(tl, tl->t); + return; + } + + SkipToken(tl, '('); + +#define FOLD_SUBFLAGS_MSG "The only ACL fold sub-flag is `report`:\n" + + sign = vcc_IsFlag(tl); + if (tl->err) { + VSB_cat(tl->sb, FOLD_SUBFLAGS_MSG); + return; + } + if (sign < 0) + return; + + if (! vcc_IdIs(tl->t, "report")) { + VSB_cat(tl->sb, FOLD_SUBFLAGS_MSG); + vcc_ErrWhere(tl, tl->t); + return; + } + + acl->flag_fold_report = sign; + + vcc_NextToken(tl); + SkipToken(tl, ')'); } void @@ -828,6 +865,7 @@ vcc_ParseAcl(struct vcc *tl) tl->acl = acl; acl->flag_pedantic = 1; acl->flag_fold = 1; + acl->flag_fold_report = 1; vcc_NextToken(tl); VRBT_INIT(&acl->acl_tree); From nils.goroll at uplex.de Thu Nov 20 09:50:05 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Thu, 20 Nov 2025 09:50:05 +0000 (UTC) Subject: [master] 26a232bad vcc_acl: Polish to avoid double error reporting Message-ID: <20251120095005.61A6112162C@lists.vinyl-cache.org> commit 26a232badffd2f59f3e9926e7953cb3e1cc82a24 Author: Nils Goroll Date: Thu Nov 20 10:47:53 2025 +0100 vcc_acl: Polish to avoid double error reporting Thank you to walid for insisting that it existed. diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c index 47d4d3350..003e91fae 100644 --- a/lib/libvcc/vcc_acl.c +++ b/lib/libvcc/vcc_acl.c @@ -890,6 +890,8 @@ vcc_ParseAcl(struct vcc *tl) vcc_NextToken(tl); } else if (vcc_IdIs(tl->t, "fold")) { vcc_parseAclFold(tl, sign); + if (tl->err) + return; } else if (vcc_IdIs(tl->t, "pedantic")) { acl->flag_pedantic = sign; vcc_NextToken(tl); From phk at FreeBSD.org Mon Nov 24 14:01:05 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 24 Nov 2025 14:01:05 +0000 (UTC) Subject: [master] 16f1f3295 Update vtest2 Message-ID: <20251124140105.13306635DC@lists.vinyl-cache.org> commit 16f1f3295f71273638503b9bedd2ca606f53df52 Author: Poul-Henning Kamp Date: Mon Nov 24 13:33:02 2025 +0000 Update vtest2 diff --git a/bin/varnishtest/vtest2 b/bin/varnishtest/vtest2 index 7815ec5cd..cb965f4d7 160000 --- a/bin/varnishtest/vtest2 +++ b/bin/varnishtest/vtest2 @@ -1 +1 @@ -Subproject commit 7815ec5cd02a56eb595ed14df7c77459a516c657 +Subproject commit cb965f4d75f615725cf5e601a9b7e88104171913 From phk at FreeBSD.org Mon Nov 24 14:01:05 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 24 Nov 2025 14:01:05 +0000 (UTC) Subject: [master] 39233521d Track libz changes Message-ID: <20251124140105.25F08635E0@lists.vinyl-cache.org> commit 39233521d3669206c94deedae1915b365dc6d6b8 Author: Poul-Henning Kamp Date: Mon Nov 24 14:00:13 2025 +0000 Track libz changes diff --git a/lib/libvgz/deflate.c b/lib/libvgz/deflate.c index 05a2d4517..a3c8935b8 100644 --- a/lib/libvgz/deflate.c +++ b/lib/libvgz/deflate.c @@ -1792,8 +1792,10 @@ local block_state deflate_stored(deflate_state *s, int flush) { s->high_water = s->strstart; /* If the last block was written to next_out, then done. */ - if (last) + if (last) { + s->bi_used = 8; return finish_done; + } /* If flushing and all input has been consumed, then done. */ if (flush != Z_NO_FLUSH && flush != Z_FINISH && @@ -1845,6 +1847,8 @@ local block_state deflate_stored(deflate_state *s, int flush) { } /* We've done all we can with the available input and output. */ + if (last) + s->bi_used = 8; return last ? finish_started : need_more; } diff --git a/lib/libvgz/zconf.h b/lib/libvgz/zconf.h index 4a52aed7c..2c7991abf 100644 --- a/lib/libvgz/zconf.h +++ b/lib/libvgz/zconf.h @@ -235,10 +235,12 @@ # endif #endif -#if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const -#else -# define z_const +#ifndef z_const +# ifdef ZLIB_CONST +# define z_const const +# else +# define z_const +# endif #endif #ifdef Z_SOLO @@ -434,11 +436,11 @@ typedef uLong FAR uLongf; typedef unsigned long z_crc_t; #endif -#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +#if HAVE_UNISTD_H-0 /* may be set to #if 1 by ./configure */ # define Z_HAVE_UNISTD_H #endif -#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ +#if HAVE_STDARG_H-0 /* may be set to #if 1 by ./configure */ # define Z_HAVE_STDARG_H #endif diff --git a/lib/libvgz/zutil.h b/lib/libvgz/zutil.h index c095a04d1..0dfa02357 100644 --- a/lib/libvgz/zutil.h +++ b/lib/libvgz/zutil.h @@ -65,7 +65,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* To be used only when the state is known to be valid */ /* common constants */ - +#if MAX_WBITS < 9 || MAX_WBITS > 15 +# error MAX_WBITS must be in 9..15 +#endif #ifndef DEF_WBITS # define DEF_WBITS MAX_WBITS #endif From walid.boudebouda at gmail.com Mon Nov 24 14:26:04 2025 From: walid.boudebouda at gmail.com (Walid Boudebouda) Date: Mon, 24 Nov 2025 14:26:04 +0000 (UTC) Subject: [master] a1d317dd6 cache_backend: Rename extrachance to retry_connect for consistency Message-ID: <20251124142604.A4575647F4@lists.vinyl-cache.org> commit a1d317dd686a5ee947c69ccbce0d38159ab4abbc Author: Walid Boudebouda Date: Fri Nov 21 12:59:15 2025 +0100 cache_backend: Rename extrachance to retry_connect for consistency This will keep it consistent with the vcl variable introduced in the followup commit diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index bdb6fefd7..35b26f084 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -396,7 +396,7 @@ vbe_dir_finish(VRT_CTX, VCL_BACKEND d) static int v_matchproto_(vdi_gethdrs_f) vbe_dir_gethdrs(VRT_CTX, VCL_BACKEND d) { - int i, extrachance = 1; + int i, retry_connect = 1; struct backend *bp; struct pfd *pfd; struct busyobj *bo; @@ -424,13 +424,13 @@ vbe_dir_gethdrs(VRT_CTX, VCL_BACKEND d) do { if (bo->htc != NULL) CHECK_OBJ_NOTNULL(bo->htc->doclose, STREAM_CLOSE_MAGIC); - pfd = vbe_dir_getfd(ctx, wrk, d, bp, extrachance == 0 ? 1 : 0); + pfd = vbe_dir_getfd(ctx, wrk, d, bp, retry_connect == 0 ? 1 : 0); if (pfd == NULL) return (-1); AN(bo->htc); CHECK_OBJ_NOTNULL(bo->htc->doclose, STREAM_CLOSE_MAGIC); if (PFD_State(pfd) != PFD_STATE_STOLEN) - extrachance = 0; + retry_connect = 0; i = V1F_SendReq(wrk, bo, &bo->acct.bereq_hdrbytes, &bo->acct.bereq_bodybytes); @@ -441,7 +441,7 @@ vbe_dir_gethdrs(VRT_CTX, VCL_BACKEND d) bo->htc->doclose = SC_RX_TIMEOUT; VSLb(bo->vsl, SLT_FetchError, "first byte timeout (reused connection)"); - extrachance = 0; + retry_connect = 0; } } @@ -464,12 +464,12 @@ vbe_dir_gethdrs(VRT_CTX, VCL_BACKEND d) */ vbe_dir_finish(ctx, d); AZ(bo->htc); - if (i < 0 || extrachance == 0) + if (i < 0 || retry_connect == 0) break; if (bo->no_retry != NULL) break; VSC_C_main->backend_retry++; - } while (extrachance--); + } while (retry_connect--); return (-1); } From walid.boudebouda at gmail.com Mon Nov 24 14:26:04 2025 From: walid.boudebouda at gmail.com (Walid Boudebouda) Date: Mon, 24 Nov 2025 14:26:04 +0000 (UTC) Subject: [master] 764a86caf vcl: New bereq.retry_connect variable Message-ID: <20251124142604.BB0DD647F7@lists.vinyl-cache.org> commit 764a86cafb6f8f685d5ae9421f22fe157319c411 Author: Walid Boudebouda Date: Fri Nov 21 13:05:36 2025 +0100 vcl: New bereq.retry_connect variable Controls whether Varnish will make a second attempt to connect to the backend if recycling an existing connection failed. This allows users to prevent undesired retries of potentially non-idempotent requests on backend connection failures, and provides a finer grained control. Fixes: #4413 diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index fc5b9cf93..c86fa83f7 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -455,6 +455,7 @@ struct busyobj { #define BUSYOBJ_TMO(bo, pfx, tmo) \ (isnan((bo)->tmo) ? cache_param->pfx##tmo : (bo)->tmo) +extern const char *retry_disabled; /*--------------------------------------------------------------------*/ diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 0bfd34637..8f185ce4f 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -315,7 +315,7 @@ vbf_stp_retry(struct worker *wrk, struct busyobj *bo) assert(bo->fetch_objcore->boc->state <= BOS_REQ_DONE); - if (bo->no_retry != NULL) { + if (bo->no_retry != NULL && bo->no_retry != retry_disabled) { VSLb(bo->vsl, SLT_Error, "Retry not possible, %s", bo->no_retry); return (F_STP_FAIL); diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c index cc99f0153..a6d049764 100644 --- a/bin/varnishd/cache/cache_vrt_var.c +++ b/bin/varnishd/cache/cache_vrt_var.c @@ -48,6 +48,7 @@ #define VRT_TMO(tmo) (isinf(tmo) ? VRT_DECIMAL_MAX : tmo) static char vrt_hostname[255] = ""; +const char *retry_disabled = "disabled from VCL"; /*-------------------------------------------------------------------- * VRT variables relating to first line of HTTP/1.1 req/resp @@ -737,6 +738,28 @@ VRT_r_bereq_retries(VRT_CTX) return (ctx->bo->retries); } +VCL_VOID +VRT_l_bereq_retry_connect(VRT_CTX, VCL_BOOL b) +{ + + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); + + if (!b && ctx->bo->no_retry == NULL) + ctx->bo->no_retry = retry_disabled; + else if (b && ctx->bo->no_retry == retry_disabled) + ctx->bo->no_retry = NULL; +} + +VCL_BOOL +VRT_r_bereq_retry_connect(VRT_CTX) +{ + + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); + return (ctx->bo->no_retry == NULL); +} + /*--------------------------------------------------------------------*/ VCL_STRING diff --git a/doc/sphinx/reference/vcl_var.rst b/doc/sphinx/reference/vcl_var.rst index 52cff63da..1c0d8e9ef 100644 --- a/doc/sphinx/reference/vcl_var.rst +++ b/doc/sphinx/reference/vcl_var.rst @@ -908,6 +908,27 @@ bereq.retries A count of how many times this request has been retried. +.. _bereq.retry_connect: + +bereq.retry_connect + + Type: BOOL + + Readable from: backend + + Writable from: backend + + Default: ``true``. + Controls whether Varnish will make a second attempt to connect to the + backend if a first connection reuse attempt failed. Setting to ``false`` + means that no retries will be made. However, setting this to ``true`` + does not guarantee that a retry will always be attempted, as there are + other factors involved in the decision (ex: a request body not being + cached). + Note that this only controls automatic retries due to connection + failures, and does not affect retries initiated from VCL using + ``return(retry);``. + .. _bereq.task_deadline: From walid.boudebouda at gmail.com Mon Nov 24 14:26:04 2025 From: walid.boudebouda at gmail.com (Walid Boudebouda) Date: Mon, 24 Nov 2025 14:26:04 +0000 (UTC) Subject: [master] cbf54610e vcl: Add coverage for bereq.retry_connect Message-ID: <20251124142604.D6D0A647FB@lists.vinyl-cache.org> commit cbf54610ea11590c881a12de2cdaecf19ed0d06c Author: Walid Boudebouda Date: Fri Nov 21 13:09:34 2025 +0100 vcl: Add coverage for bereq.retry_connect diff --git a/bin/varnishtest/tests/b00097.vtc b/bin/varnishtest/tests/b00097.vtc new file mode 100644 index 000000000..a18ae7b4f --- /dev/null +++ b/bin/varnishtest/tests/b00097.vtc @@ -0,0 +1,127 @@ +varnishtest "Test bereq.retry_connect aka extrachance" + +server s0 { + rxreq + txresp -hdr "Connection: keep-alive" -body "hello" + + rxreq + close + accept + rxreq + txresp -hdr "Connection: keep-alive" -body "hello" +} -start + +varnish v1 -vcl+backend { + sub vcl_recv { + return (pass); + } +} -start + +client c1 { + # First backend connection + txreq + rxresp + expect resp.status == 200 + expect resp.body == "hello" + # Reuse with extrachance + txreq + rxresp + expect resp.status == 200 + expect resp.body == "hello" +} -run + +server s0 -start + +client c2 { + # First backend connection + txreq + rxresp + expect resp.status == 200 + expect resp.body == "hello" + # We should not retry when reqbody is not cached + txreq -req "POST" -bodylen 5 + rxresp + expect resp.status == 503 +} -run + +server s0 -break +server s0 -start + +varnish v1 -vcl+backend { + sub vcl_recv { + return (pass); + } + + sub vcl_backend_fetch { + set bereq.retry_connect = false; + } +} + +client c3 { + # First backend connection + txreq + rxresp + expect resp.status == 200 + expect resp.body == "hello" + # No retry when retry_connect = false + txreq + rxresp + expect resp.status == 503 +} -run + + +server s0 -break +server s0 -start + +varnish v1 -vcl+backend { + sub vcl_recv { + return (pass); + } + + sub vcl_backend_fetch { + set bereq.retry_connect = true; + } +} + +client c4 { + # First backend connection + txreq + rxresp + expect resp.status == 200 + expect resp.body == "hello" + # retry_connect does not force a retry when reqbody is not cached + txreq -req "POST" -bodylen 5 + rxresp + expect resp.status == 503 +} -run + +server s0 -break +server s0 -start + +varnish v1 -vcl+backend { + sub vcl_recv { + return (pass); + } + + sub vcl_backend_fetch { + set bereq.retry_connect = false; + } + + sub vcl_backend_error { + if (bereq.retries < 1) { + return (retry); + } + } +} + +client c5 { + # First backend connection + txreq + rxresp + expect resp.status == 200 + expect resp.body == "hello" + # Disabling retry_connect from vcl does not prevent vcl retry + txreq + rxresp + expect resp.status == 200 +} -run From walid.boudebouda at gmail.com Mon Nov 24 14:27:05 2025 From: walid.boudebouda at gmail.com (Walid Boudebouda) Date: Mon, 24 Nov 2025 14:27:05 +0000 (UTC) Subject: [master] fd0764769 vcc: Reference unsued probes in vgc.c Message-ID: <20251124142705.53C9B64D63@lists.vinyl-cache.org> commit fd07647694906ecdceec041d9ac60588d75e6787 Author: Walid Boudebouda Date: Thu Nov 20 12:24:09 2025 +0100 vcc: Reference unsued probes in vgc.c This avoids C compiler failures when an unreferenced probe is used with 'vcc_feature=-err_unref' Fixes: #4410 diff --git a/bin/varnishtest/tests/v00031.vtc b/bin/varnishtest/tests/v00031.vtc index f9858540b..a6a5d0fbe 100644 --- a/bin/varnishtest/tests/v00031.vtc +++ b/bin/varnishtest/tests/v00031.vtc @@ -12,9 +12,19 @@ varnish v1 -vcl { backend c { .host = "${localhost}"; } } +varnish v1 -vcl { + backend default none; + probe p { } +} + varnish v1 -cliok "param.set vcc_feature +err_unref" varnish v1 -errvcl {Unused backend c, defined:} { backend b { .host = "${localhost}"; } backend c { .host = "${localhost}"; } } + +varnish v1 -errvcl {Unused probe p, defined:} { + backend default none; + probe p { } +} diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c index 082205a89..368a6a34d 100644 --- a/lib/libvcc/vcc_compile.c +++ b/lib/libvcc/vcc_compile.c @@ -147,6 +147,13 @@ TLWriteVSB(struct vcc *tl, const char *fn, const struct vsb *vsb, /*--------------------------------------------------------------------*/ +static void +vcc_refUnusedProbes(struct vcc *tl, const struct symbol *sym) +{ + if (sym->ndef != 0 && sym->nref == 0) + Fc(tl, 0, "\t(void)%s;\n", sym->rname); +} + struct proc * vcc_NewProc(struct vcc *tl, struct symbol *sym) { @@ -426,7 +433,7 @@ EmitCoordinates(const struct vcc *tl, struct vsb *vsb) */ static void -EmitInitFini(const struct vcc *tl) +EmitInitFini(struct vcc *tl) { struct inifin *p, *q = NULL; unsigned has_event = 0; @@ -574,6 +581,7 @@ EmitInitFini(const struct vcc *tl) Fc(tl, 0, "\n"); if (!has_event) Fc(tl, 0, "\t(void)vgc_warmupstep;\n"); + VCC_WalkSymbols(tl, vcc_refUnusedProbes, SYM_MAIN, SYM_PROBE); Fc(tl, 0, "\treturn (%d);\n", has_event ? 1 : 0); Fc(tl, 0, "}\n"); } From phk at FreeBSD.org Tue Nov 25 10:28:05 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 25 Nov 2025 10:28:05 +0000 (UTC) Subject: [master] 9db34c446 Try to shut down more gracefully in h00007 Message-ID: <20251125102805.91E701018BD@lists.vinyl-cache.org> commit 9db34c4462c4c09a1dd21cd7edd77caea90dceb4 Author: Poul-Henning Kamp Date: Tue Nov 25 10:27:18 2025 +0000 Try to shut down more gracefully in h00007 diff --git a/bin/varnishtest/tests/h00007.vtc b/bin/varnishtest/tests/h00007.vtc index 9951ef7fc..e2d7e75d6 100644 --- a/bin/varnishtest/tests/h00007.vtc +++ b/bin/varnishtest/tests/h00007.vtc @@ -9,6 +9,7 @@ feature cmd {haproxy --version 2>&1 | grep -q 'HA-*Proxy version'} server s1 { rxreq txresp -body "s1 >>> Hello world!" + shutdown } -start varnish v1 -proto "PROXY" -vcl+backend {} -start @@ -28,7 +29,7 @@ haproxy h1 -D -conf { varnish v1 -vcl+backend { import std; - acl localhost { + acl localhost -fold { "localhost"; "127.0.0.1"; "::1"; @@ -58,3 +59,7 @@ client c1 -connect ${h1_fe1_sock} { expect resp.http.notstdip == false expect resp.body == "s1 >>> Hello world!" } -run + +varnish v1 -vsl_catchup + +haproxy h1 -wait From nils.goroll at uplex.de Tue Nov 25 11:45:05 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Tue, 25 Nov 2025 11:45:05 +0000 (UTC) Subject: [master] c9525cf9c Update vtest2 Message-ID: <20251125114505.823E4104432@lists.vinyl-cache.org> commit c9525cf9c3ccc9a84208dcf8212e6c552a9af0cd Author: Nils Goroll Date: Tue Nov 25 12:42:40 2025 +0100 Update vtest2 diff --git a/bin/varnishtest/vtest2 b/bin/varnishtest/vtest2 index cb965f4d7..8c1ad41e4 160000 --- a/bin/varnishtest/vtest2 +++ b/bin/varnishtest/vtest2 @@ -1 +1 @@ -Subproject commit cb965f4d75f615725cf5e601a9b7e88104171913 +Subproject commit 8c1ad41e4c8844d7862d88f973732349ccfac8c0 From nils.goroll at uplex.de Tue Nov 25 11:45:05 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Tue, 25 Nov 2025 11:45:05 +0000 (UTC) Subject: [master] b628c9bb7 Fix c5.vtc for when other warnings exist in the CLI output Message-ID: <20251125114505.9BA0C104435@lists.vinyl-cache.org> commit b628c9bb77a899b38b5d8ea85422246e667b600e Author: Nils Goroll Date: Tue Nov 25 12:41:41 2025 +0100 Fix c5.vtc for when other warnings exist in the CLI output as with ASAN and on Solaris-descendents needs Vtest2 8c1ad41e4c8844d7862d88f973732349ccfac8c0 or later diff --git a/bin/varnishtest/tests/c00005.vtc b/bin/varnishtest/tests/c00005.vtc index 51bb31e35..cc995788e 100644 --- a/bin/varnishtest/tests/c00005.vtc +++ b/bin/varnishtest/tests/c00005.vtc @@ -377,7 +377,7 @@ client c1 { logexpect l1 -wait # test +fold(-report) -varnish v1 -cliexpect "^$" {vcl.inline silent << EOF +varnish v1 -cliexpect ! "fold" {vcl.inline silent << EOF vcl 4.1; backend dummy None; From nils.goroll at uplex.de Tue Nov 25 12:25:03 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Tue, 25 Nov 2025 12:25:03 +0000 (UTC) Subject: [master] d496f0004 varnishd: add backend age & reuses to Open & Close Message-ID: <20251125122503.7938B105CCA@lists.vinyl-cache.org> commit d496f0004e31e85700701b2d6cdc263d30eab857 Author: Asad Sajjad Ahmed Date: Mon Aug 19 13:48:29 2024 +0200 varnishd: add backend age & reuses to Open & Close This extra information comes handy when trubleshooting idle timeout from the backend. Signed-off-by: Asad Sajjad Ahmed diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 35b26f084..4af19052b 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -334,9 +334,15 @@ vbe_dir_getfd(VRT_CTX, struct worker *wrk, VCL_BACKEND dir, struct backend *bp, PFD_LocalName(pfd, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1); PFD_RemoteName(pfd, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2); - VSLb(bo->vsl, SLT_BackendOpen, "%d %s %s %s %s %s %s", - *fdp, VRT_BACKEND_string(dir), abuf2, pbuf2, abuf1, pbuf1, - PFD_State(pfd) == PFD_STATE_STOLEN ? "reuse" : "connect"); + if (PFD_State(pfd) != PFD_STATE_STOLEN) { + VSLb(bo->vsl, SLT_BackendOpen, "%d %s %s %s %s %s connect", + *fdp, VRT_BACKEND_string(dir), abuf2, pbuf2, abuf1, pbuf1); + } else { + VSLb(bo->vsl, SLT_BackendOpen, + "%d %s %s %s %s %s reuse %.6f %ju", *fdp, + VRT_BACKEND_string(dir), abuf2, pbuf2, abuf1, pbuf1, + PFD_Age(pfd), PFD_Reused(pfd)); + } INIT_OBJ(bo->htc, HTTP_CONN_MAGIC); bo->htc->priv = pfd; diff --git a/bin/varnishd/cache/cache_conn_pool.c b/bin/varnishd/cache/cache_conn_pool.c index 5dd02723a..00a190da3 100644 --- a/bin/varnishd/cache/cache_conn_pool.c +++ b/bin/varnishd/cache/cache_conn_pool.c @@ -66,6 +66,9 @@ struct pfd { struct conn_pool *conn_pool; pthread_cond_t *cond; + + vtim_mono created; + uint64_t reused; }; /*-------------------------------------------------------------------- @@ -139,6 +142,25 @@ PFD_Fd(struct pfd *p) return (&(p->fd)); } +vtim_dur +PFD_Age(const struct pfd *p) +{ + vtim_mono t_mono; + + CHECK_OBJ_NOTNULL(p, PFD_MAGIC); + t_mono = VTIM_mono(); + assert(t_mono >= p->created); + + return (t_mono - p->created); +} + +uint64_t +PFD_Reused(const struct pfd *p) +{ + CHECK_OBJ_NOTNULL(p, PFD_MAGIC); + return (p->reused); +} + void PFD_LocalName(const struct pfd *p, char *abuf, unsigned alen, char *pbuf, unsigned plen) @@ -541,6 +563,7 @@ VCP_Get(struct conn_pool *cp, vtim_dur tmo, struct worker *wrk, VSC_C_main->backend_reuse++; pfd->state = PFD_STATE_STOLEN; pfd->cond = &wrk->cond; + pfd->reused++; } cp->n_used++; // Opening mostly works Lck_Unlock(&cp->mtx); @@ -559,8 +582,10 @@ VCP_Get(struct conn_pool *cp, vtim_dur tmo, struct worker *wrk, Lck_Lock(&cp->mtx); cp->n_used--; // Nope, didn't work after all. Lck_Unlock(&cp->mtx); - } else + } else { + pfd->created = VTIM_mono(); VSC_C_main->backend_conn++; + } return (pfd); } diff --git a/bin/varnishd/cache/cache_conn_pool.h b/bin/varnishd/cache/cache_conn_pool.h index 0da4c99c6..1b3903277 100644 --- a/bin/varnishd/cache/cache_conn_pool.h +++ b/bin/varnishd/cache/cache_conn_pool.h @@ -45,6 +45,8 @@ struct pfd; unsigned PFD_State(const struct pfd *); int *PFD_Fd(struct pfd *); +vtim_dur PFD_Age(const struct pfd *); +uint64_t PFD_Reused(const struct pfd *); void PFD_LocalName(const struct pfd *, char *, unsigned, char *, unsigned); void PFD_RemoteName(const struct pfd *, char *, unsigned, char *, unsigned); diff --git a/bin/varnishtest/tests/b00098.vtc b/bin/varnishtest/tests/b00098.vtc new file mode 100644 index 000000000..da5c37a7b --- /dev/null +++ b/bin/varnishtest/tests/b00098.vtc @@ -0,0 +1,28 @@ +varnishtest "VSL tags backend age & reuse" + +server s1 { + rxreq + txresp + rxreq + txresp +} -start + +varnish v1 -vcl+backend {} -start +varnish v1 -cliok "param.set debug +syncvsl" + +client c1 { + txreq + rxresp + expect resp.status == 200 + txreq -url /2 + rxresp + expect resp.status == 200 +} -run + +logexpect l1 -v v1 -d 1 -g session { + expect * * Begin ^bereq + expect * = BackendOpen "connect$" + expect * = BackendClose "s1 recycle$" + expect * * BackendOpen "reuse \\d+\\.\\d\\d\\d\\d\\d\\d 1$" + expect * = BackendClose "s1 recycle$" +} -run diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h index 9c1aae69d..9954f1494 100644 --- a/include/tbl/vsl_tags.h +++ b/include/tbl/vsl_tags.h @@ -138,15 +138,17 @@ SLTM(SessClose, 0, "Client connection closed", SLTM(BackendOpen, 0, "Backend connection opened", "Logged when a new backend connection is opened.\n\n" "The format is::\n\n" - "\t%d %s %s %s %s %s %s\n" - "\t| | | | | | |\n" - "\t| | | | | | +- \"connect\" or \"reuse\"\n" - "\t| | | | | +---- Local port\n" - "\t| | | | +------- Local address\n" - "\t| | | +---------- Remote port\n" - "\t| | +------------- Remote address\n" - "\t| +---------------- Backend display name\n" - "\t+------------------- Connection file descriptor\n" + "\t%d %s %s %s %s %s %s [ %f %ld ]\n" + "\t| | | | | | | | |\n" + "\t| | | | | | | | +--- Connection reuses\n" + "\t| | | | | | | +------ Connection age\n" + "\t| | | | | | +----------- \"connect\" or \"reuse\"\n" + "\t| | | | | +-------------- Local port\n" + "\t| | | | +----------------- Local address\n" + "\t| | | +-------------------- Remote port\n" + "\t| | +----------------------- Remote address\n" + "\t| +-------------------------- Backend display name\n" + "\t+----------------------------- Connection file descriptor\n" "\n" ) From nils.goroll at uplex.de Tue Nov 25 12:29:04 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Tue, 25 Nov 2025 12:29:04 +0000 (UTC) Subject: [master] 5843b6bd8 polish previous Message-ID: <20251125122905.1869B106078@lists.vinyl-cache.org> commit 5843b6bd8be92d626a4fc88d72d20097f555b238 Author: Nils Goroll Date: Tue Nov 25 13:27:37 2025 +0100 polish previous format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat] diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 4af19052b..fa768c1be 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -341,7 +341,7 @@ vbe_dir_getfd(VRT_CTX, struct worker *wrk, VCL_BACKEND dir, struct backend *bp, VSLb(bo->vsl, SLT_BackendOpen, "%d %s %s %s %s %s reuse %.6f %ju", *fdp, VRT_BACKEND_string(dir), abuf2, pbuf2, abuf1, pbuf1, - PFD_Age(pfd), PFD_Reused(pfd)); + PFD_Age(pfd), (uintmax_t)PFD_Reused(pfd)); } INIT_OBJ(bo->htc, HTTP_CONN_MAGIC); From nils.goroll at uplex.de Tue Nov 25 12:29:05 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Tue, 25 Nov 2025 12:29:05 +0000 (UTC) Subject: [master] 7ee64e2a5 flexelinting Message-ID: <20251125122905.2BFDC106081@lists.vinyl-cache.org> commit 7ee64e2a51be0805b2a2ea4ff8a025fb6db5f149 Author: Nils Goroll Date: Tue Nov 25 13:25:42 2025 +0100 flexelinting match = strchr(key, ':'); Error 158: Assignment to variable 'match' (line 604) increases capability diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c index 488dee711..68c96f947 100644 --- a/bin/varnishncsa/varnishncsa.c +++ b/bin/varnishncsa/varnishncsa.c @@ -597,7 +597,7 @@ addf_vcl_log(const char *key) } static void -addf_hdr(struct watch_head *head, const char *key) +addf_hdr(struct watch_head *head, char *key) { struct watch *w; struct format *f; From nils.goroll at uplex.de Tue Nov 25 12:39:04 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Tue, 25 Nov 2025 12:39:04 +0000 (UTC) Subject: [master] 379e6c95c Update vtest2 Message-ID: <20251125123904.B165910689C@lists.vinyl-cache.org> commit 379e6c95c818f58bc4df4068359a212c5440f44a Author: Nils Goroll Date: Tue Nov 25 13:38:15 2025 +0100 Update vtest2 diff --git a/bin/varnishtest/vtest2 b/bin/varnishtest/vtest2 index 8c1ad41e4..ac4f5ad05 160000 --- a/bin/varnishtest/vtest2 +++ b/bin/varnishtest/vtest2 @@ -1 +1 @@ -Subproject commit 8c1ad41e4c8844d7862d88f973732349ccfac8c0 +Subproject commit ac4f5ad0595686f64fb5d8ed43ce0011b460a14b From phk at FreeBSD.org Wed Nov 26 12:32:05 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 26 Nov 2025 12:32:05 +0000 (UTC) Subject: [master] 7b78cd3c4 Update VTest2 Message-ID: <20251126123205.6EB22112FE6@lists.vinyl-cache.org> commit 7b78cd3c41bf8f11f114a18770867b58ff45feaa Author: Poul-Henning Kamp Date: Wed Nov 26 12:30:33 2025 +0000 Update VTest2 diff --git a/bin/varnishtest/vtest2 b/bin/varnishtest/vtest2 index ac4f5ad05..23849ce94 160000 --- a/bin/varnishtest/vtest2 +++ b/bin/varnishtest/vtest2 @@ -1 +1 @@ -Subproject commit ac4f5ad0595686f64fb5d8ed43ce0011b460a14b +Subproject commit 23849ce94a9c85309bcaabde1ea49b3e9e8bbbbd From phk at FreeBSD.org Wed Nov 26 13:24:04 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 26 Nov 2025 13:24:04 +0000 (UTC) Subject: [master] 95b14baaf Update vtest2 Message-ID: <20251126132404.99F5F114EE3@lists.vinyl-cache.org> commit 95b14baaff776f639495dae5dd60df53ef83ab9e Author: Poul-Henning Kamp Date: Wed Nov 26 12:59:11 2025 +0000 Update vtest2 diff --git a/bin/varnishtest/vtest2 b/bin/varnishtest/vtest2 index 23849ce94..931baeb3c 160000 --- a/bin/varnishtest/vtest2 +++ b/bin/varnishtest/vtest2 @@ -1 +1 @@ -Subproject commit 23849ce94a9c85309bcaabde1ea49b3e9e8bbbbd +Subproject commit 931baeb3cd2c2f57e165285218d4cb22789c9d2b From nils.goroll at uplex.de Wed Nov 26 14:51:05 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Wed, 26 Nov 2025 14:51:05 +0000 (UTC) Subject: [master] 58d43d2df mgt: Lower termination loadness Message-ID: <20251126145105.50D7D1181F8@lists.vinyl-cache.org> commit 58d43d2dffc6fb3dbfc927746509d1d39f48cb78 Author: Dridi Boukelmoune Date: Mon Nov 3 16:08:16 2025 +0100 mgt: Lower termination loadness It is not necessarily an error to receive a signal asking MGT to terminate. Fixes #4409 (Committer edit: Reworded after removal of SIGHUP change) diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c index 3aab45395..28ca03e19 100644 --- a/bin/varnishd/mgt/mgt_main.c +++ b/bin/varnishd/mgt/mgt_main.c @@ -449,7 +449,8 @@ mgt_sigint(const struct vev *e, int what) { (void)what; - MGT_Complain(C_ERR, "Manager got %s from PID %jd", e->name, (intmax_t)e->siginfo->si_pid); + MGT_Complain(C_INFO, "Manager got %s from PID %jd", + e->name, (intmax_t)e->siginfo->si_pid); (void)fflush(stdout); if (MCH_Running()) MCH_Stop_Child(); From phk at FreeBSD.org Wed Nov 26 16:09:05 2025 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 26 Nov 2025 16:09:05 +0000 (UTC) Subject: [master] 5697dd8ff Give VCL_PROBE a vcl_name member and a _tostring() function. Message-ID: <20251126160905.835AC11AEBD@lists.vinyl-cache.org> commit 5697dd8ff4cd3b88758ef1d732b63f23abcd56d5 Author: Poul-Henning Kamp Date: Wed Nov 26 16:07:52 2025 +0000 Give VCL_PROBE a vcl_name member and a _tostring() function. Fixes: #4417 diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c index 2847e8b87..fe6c8bd96 100644 --- a/bin/varnishd/cache/cache_vrt.c +++ b/bin/varnishd/cache/cache_vrt.c @@ -824,6 +824,15 @@ VRT_BACKEND_string(VCL_BACKEND d) return (d->vcl_name); } +VCL_STRING v_matchproto_() +VRT_PROBE_string(VCL_PROBE p) +{ + if (p == NULL) + return (NULL); + CHECK_OBJ_NOTNULL(p, VRT_BACKEND_PROBE_MAGIC); + return (p->vcl_name); +} + VCL_STRING v_matchproto_() VRT_BOOL_string(VCL_BOOL val) { diff --git a/bin/varnishtest/tests/r04417.vtc b/bin/varnishtest/tests/r04417.vtc new file mode 100644 index 000000000..2fc299279 --- /dev/null +++ b/bin/varnishtest/tests/r04417.vtc @@ -0,0 +1,31 @@ +vtest "Test VCL_PROBE type handling in VCC" + +# To truly test this we would have to inspect the generated +# C-source code. + +varnish v1 -vcl { + vcl 4.1; + + backend be none; + + probe p1 { } + probe p2 { } + + sub vcl_recv { + return (synth(200)); + } + + sub vcl_synth { + set resp.http.self-cmp = (p1 == p1); + set resp.http.cmp = (p1 == p2); + set resp.http.name = p1 + "/" + p2; + } +} -start + +client c1 { + txreq + rxresp + expect resp.http.cmp == false + expect resp.http.self-cmp == true + expect resp.http.name == p1/p2 +} -run diff --git a/include/vrt.h b/include/vrt.h index c21a5232f..3d09735b3 100644 --- a/include/vrt.h +++ b/include/vrt.h @@ -57,6 +57,9 @@ * Whenever something is deleted or changed in a way which is not * binary/load-time compatible, increment MAJOR version * + * 22.1 (trunk) + * "vcl_name" member added to vrt_backend_probe{} + * VRT_PROBE_string() added * 22.0 (2025-09-15) * VRT_r_obj_stale_age() added * VRT_r_obj_stale_can_esi() added @@ -623,6 +626,7 @@ VCL_STRING VRT_BOOL_string(VCL_BOOL); VCL_STRING VRT_BLOB_string(VRT_CTX, VCL_BLOB); VCL_STRING VRT_INT_string(VRT_CTX, VCL_INT); VCL_STRING VRT_IP_string(VRT_CTX, VCL_IP); +VCL_STRING VRT_PROBE_string(VCL_PROBE); VCL_STRING VRT_REAL_string(VRT_CTX, VCL_REAL); VCL_STRING VRT_STEVEDORE_string(VCL_STEVEDORE); VCL_STRING VRT_STRANDS_string(VRT_CTX, VCL_STRANDS); @@ -720,6 +724,7 @@ struct vrt_backend_probe { const char *url; const char *request; VRT_BACKEND_PROBE_FIELDS(const) + const char *vcl_name; }; /* Backend related */ diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c index 3d4a1779f..90d0f6bad 100644 --- a/lib/libvcc/vcc_backend.c +++ b/lib/libvcc/vcc_backend.c @@ -216,8 +216,14 @@ vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **namep) } Fh(tl, 0, "static const struct vrt_backend_probe %s[] = {{\n", name); Fh(tl, 0, "\t.magic = VRT_BACKEND_PROBE_MAGIC,\n"); - if (namep != NULL) + if (sym != NULL) { + Fh(tl, 0, "\t.vcl_name = \"%s\",\n", sym->name); + } else { + Fh(tl, 0, "\t.vcl_name = \"%s\",\n", name); + } + if (namep != NULL) { *namep = TlDup(tl, name); + } window = 0; threshold = 0; diff --git a/lib/libvcc/vcc_types.c b/lib/libvcc/vcc_types.c index 3a3c1dd21..abb75a72f 100644 --- a/lib/libvcc/vcc_types.c +++ b/lib/libvcc/vcc_types.c @@ -174,6 +174,7 @@ const struct type PROBE[1] = {{ .magic = TYPE_MAGIC, .name = "PROBE", .global_pfx = "vgc_probe", + .tostring = "VRT_PROBE_string(\v1)", .default_sym = default_probe, }}; From nils.goroll at uplex.de Thu Nov 27 12:37:05 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Thu, 27 Nov 2025 12:37:05 +0000 (UTC) Subject: [master] 996503b61 Update vtest2 Message-ID: <20251127123705.6025211CF91@lists.vinyl-cache.org> commit 996503b6175db52a82a1a43eed923e6b75e6a214 Author: Nils Goroll Date: Thu Nov 27 13:35:35 2025 +0100 Update vtest2 diff --git a/bin/varnishtest/vtest2 b/bin/varnishtest/vtest2 index 931baeb3c..9038ec694 160000 --- a/bin/varnishtest/vtest2 +++ b/bin/varnishtest/vtest2 @@ -1 +1 @@ -Subproject commit 931baeb3cd2c2f57e165285218d4cb22789c9d2b +Subproject commit 9038ec69478866fa318b20c64aa89be8a75ba6a6 From nils.goroll at uplex.de Fri Nov 28 17:52:05 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Fri, 28 Nov 2025 17:52:05 +0000 (UTC) Subject: [master] abce4bf9d doc: Add detail to the alpine install steps Message-ID: <20251128175205.1C48A10729D@lists.vinyl-cache.org> commit abce4bf9d96d34111414d7b932d2b2b286872140 Author: Nils Goroll Date: Fri Nov 28 18:27:32 2025 +0100 doc: Add detail to the alpine install steps diff --git a/doc/sphinx/installation/install_source.rst b/doc/sphinx/installation/install_source.rst index f0f09635b..23ca0fcb4 100644 --- a/doc/sphinx/installation/install_source.rst +++ b/doc/sphinx/installation/install_source.rst @@ -185,7 +185,9 @@ Build dependencies on Alpine Linux As of Alpine 3, these steps should install the required dependencies: -* Add the `Alpine Community Repository`_ +* Add the `Alpine Community Repository`_:: + + setup-apkrepos -c * Install dependencies:: From nils.goroll at uplex.de Fri Nov 28 17:52:05 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Fri, 28 Nov 2025 17:52:05 +0000 (UTC) Subject: [master] 7a88cab9f vcc: make vgc probes actual pointers to compound literals Message-ID: <20251128175205.2DECA1072A0@lists.vinyl-cache.org> commit 7a88cab9fe0ea567e3ceac9fa9a9cd7108e85504 Author: Nils Goroll Date: Fri Nov 28 18:47:25 2025 +0100 vcc: make vgc probes actual pointers to compound literals This is one of the cases where arrays do not behave like pointers, but besides the slightly more elaborate syntax I think a compound literal is what we intended all along, just using the array syntax as a convenience. Fixes #4410 Ref #4418 diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c index 90d0f6bad..8feb20df4 100644 --- a/lib/libvcc/vcc_backend.c +++ b/lib/libvcc/vcc_backend.c @@ -214,7 +214,8 @@ vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **namep) bprintf(buf, "vgc_probe__%d", tl->nprobe++); name = buf; } - Fh(tl, 0, "static const struct vrt_backend_probe %s[] = {{\n", name); + Fh(tl, 0, "static const struct vrt_backend_probe * const %s =\n", name); + Fh(tl, 0, " &(const struct vrt_backend_probe){\n"); Fh(tl, 0, "\t.magic = VRT_BACKEND_PROBE_MAGIC,\n"); if (sym != NULL) { Fh(tl, 0, "\t.vcl_name = \"%s\",\n", sym->name); @@ -339,7 +340,7 @@ vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **namep) if (status > 0) Fh(tl, 0, "\t.exp_status = %u,\n", status); Fh(tl, 0, "\t.exp_close = %u,\n", exp_close); - Fh(tl, 0, "}};\n"); + Fh(tl, 0, "};\n"); SkipToken(tl, '}'); } From nils.goroll at uplex.de Sun Nov 30 16:18:04 2025 From: nils.goroll at uplex.de (Nils Goroll) Date: Sun, 30 Nov 2025 16:18:04 +0000 (UTC) Subject: [master] b09229f3b ban: Disable auto capturing for regexen Message-ID: <20251130161804.99E39119A99@lists.vinyl-cache.org> commit b09229f3b7b96911e8877a5de35437211dd473f5 Author: Nils Goroll Date: Sun Nov 30 16:36:03 2025 +0100 ban: Disable auto capturing for regexen For bans, we never use back references, so disable them when compiling. This brings down ban execution time for complex bans substantially, a factor on the order of 30 has been observed for a regular expression with 921 open parentheses and 920 alternatives ('|'). diff --git a/bin/varnishd/cache/cache_ban_build.c b/bin/varnishd/cache/cache_ban_build.c index b370c563d..f634d6424 100644 --- a/bin/varnishd/cache/cache_ban_build.c +++ b/bin/varnishd/cache/cache_ban_build.c @@ -193,7 +193,7 @@ ban_parse_regexp(struct ban_proto *bp, const char *a3) size_t sz; vre_t *re, *rex; - re = VRE_compile(a3, 0, &errorcode, &erroroffset, 0); + re = VRE_compile(a3, VRE_NO_AUTO_CAPTURE, &errorcode, &erroroffset, 0); if (re == NULL) { AN(VSB_init(vsb, errbuf, sizeof errbuf)); AZ(VRE_error(vsb, errorcode)); diff --git a/include/vre.h b/include/vre.h index 854e96058..fc58c234b 100644 --- a/include/vre.h +++ b/include/vre.h @@ -54,6 +54,7 @@ extern const int VRE_ERROR_NOMATCH; /* And those to PCRE2 compilation options */ extern const unsigned VRE_CASELESS; +extern const unsigned VRE_NO_AUTO_CAPTURE; vre_t *VRE_compile(const char *, unsigned, int *, int *, unsigned); vre_t *VRE_export(const vre_t *, size_t *); diff --git a/lib/libvarnish/vre.c b/lib/libvarnish/vre.c index 6d9b58bc1..02f4b91aa 100644 --- a/lib/libvarnish/vre.c +++ b/lib/libvarnish/vre.c @@ -66,6 +66,7 @@ struct vre { const int VRE_ERROR_NOMATCH = PCRE2_ERROR_NOMATCH; const unsigned VRE_CASELESS = PCRE2_CASELESS; +const unsigned VRE_NO_AUTO_CAPTURE = PCRE2_NO_AUTO_CAPTURE; vre_t * VRE_compile(const char *pattern, unsigned options,