1. 02 Dec, 2019 6 commits
    • Dridi Boukelmoune's avatar
      Teach libvcc how to set STRING += STRING; · ee29af93
      Dridi Boukelmoune authored
      Refs #3100
      ee29af93
    • Dridi Boukelmoune's avatar
      Teach expressions to the set action's arithmetic table · 74298f6a
      Dridi Boukelmoune authored
      It uses a similar trick as VCC expressions to find where the symbol name
      belongs.
      
      Refs #3100
      74298f6a
    • Dridi Boukelmoune's avatar
      Delay the code generation of the set action · b39e9196
      Dridi Boukelmoune authored
      First, gather everything needed, then generate the C code. This avoids a
      bit of code duplication and makes the error handling more natural, right
      after the attempt at generating a matching expression.
      
      Refs #3100
      b39e9196
    • Poul-Henning Kamp's avatar
      Merge from VTEST: · 24455b70
      Poul-Henning Kamp authored
          Avoid VSB_printf for static strings
      
          Done with the following semantic patch for Coccinelle:
      
              @@
              expression vsb, fmt;
              @@
      
              - VSB_printf(vsb, fmt);
              + VSB_cat(vsb, fmt);
      
          This patch is available in the Varnish source tree.
      24455b70
    • Poul-Henning Kamp's avatar
      Merge from VTEST: · 799aaa96
      Poul-Henning Kamp authored
          vtc_haproxy: enable mcli with a separate flag from worker mode
      
          Support for the master cli in worker mode was added with commit 86e65f1
          using the same flag as worker mode (-W). This is a problem with haproxy
          1.8 because it has worker mode but no mcli. This patch adds -S to enable
          mcli for haproxy in a vtc.
      
      and:
      
          The two patches in attachment fix a bug in the haproxy CLI handling and add
          the support for the haproxy master CLI in VTest. Could you merge them? Thanks
          You can also find in attachment a vtc file which use this new feature.
      
          Submitted by:   William Lallemand <wlallemand@haproxy.com>
      799aaa96
    • Poul-Henning Kamp's avatar
      Monday Morning FlexeLinting · 1ba1773f
      Poul-Henning Kamp authored
      1ba1773f
  2. 29 Nov, 2019 2 commits
    • Nils Goroll's avatar
      guard against accidental regressions regarding obj · c8585914
      Nils Goroll authored
      enum gethdr_e and VCL_HTTP have a 1:1 relation except for HDR_OBJ which
      does not have a corresponding VCL_HTTP pointer.
      
      As I am about to use a "reverse VRT_selecthttp()" to get from VCL_HTTP
      to enum gethdr_e, I would want to guard against accidental introduction
      of a regression.
      c8585914
    • Dridi Boukelmoune's avatar
      Polish · 935b6bad
      Dridi Boukelmoune authored
      935b6bad
  3. 28 Nov, 2019 5 commits
  4. 26 Nov, 2019 5 commits
    • Emmanuel Hocdet's avatar
      Simplify WS allocation in tlv_string · e74f9e87
      Emmanuel Hocdet authored
      Patch by @ehocdet, commit message edited by @nigoroll:
      
      The root cause of #3131 was misdiagnosed to the extent that, while this
      change had prevented it, the root cause was a bug in WS_ReserveSize()
      fixed in 505b7bd9
      
      The previous tlv_string() code was correct except for the
      fact that error handling should have checked for WS_ReserveSize(ctx->ws,
      len+1) <= len (also spotted by @ehocdet).
      
      Someone had mentioned at some point that we would not want to VRT_fail(),
      but I think this must have been related to the proxy transport code, not
      the proxy vmod.
      
      Ref #3131
      e74f9e87
    • Nils Goroll's avatar
      Add Session Attribute workspace overflow handling · 287dc4a6
      Nils Goroll authored
      Notes:
      
      * for the acceptor, I think it makes sense to keep AN assertion (pun!)
        because varnish is not viable if the session workspace is too small
        to even hold the attributes initialized in the acceptor.
      
        If this was an issue, we should rather revisit the minimum values for
        the session workspace
      
      * for h1 and h2 session setup, I have used XXXAN() because I am not sure
        how we should best handle allocation failures.
      
      * The relevant bit, for now, is the proxy code which may allocate
        arbitrarily long TLV attributes, so this is the code for which we now
        actually handle errors and test that we do
      
      On the vtc: I added the test to o00005.vtc because there existed a
      previous overflow test from 267504b8,
      but that only tested for the one case of a WS overflow which was already
      handled.
      
      Fixes #3145
      287dc4a6
    • Nils Goroll's avatar
      fix copy-pasta vtc description · 815331b3
      Nils Goroll authored
      815331b3
    • Nils Goroll's avatar
      WS_ReserveSize() must not hold a reservation for zero return value · 505b7bd9
      Nils Goroll authored
      This originates from a3d47c25, but
      was overlooked in 4e333597:
      
      When there is insufficient space to fulfil the reservation request, we
      must not leave the workspace reserved.
      
      Fixes #3131
      505b7bd9
    • Nils Goroll's avatar
      add a facility to test WS_ReserveSize() · ed3b095c
      Nils Goroll authored
      ed3b095c
  5. 25 Nov, 2019 1 commit
  6. 22 Nov, 2019 5 commits
  7. 20 Nov, 2019 1 commit
  8. 19 Nov, 2019 2 commits
    • Dridi Boukelmoune's avatar
      Put some serious red tape on VCL_STRANDS · 11d55148
      Dridi Boukelmoune authored
      I started suspecting that we need this clarification during the review
      of #3123 [1] and was able to verify it with a simple test case. First I
      needed a function I put in vmod_debug:
      
          $Function STRANDS hoard_strands(PRIV_TASK, STRANDS s)
      
          Return the first value of s for the rest of the task.
      
      The implementation is very straightforward:
      
          struct hoarder {
                 VCL_STRANDS     s;
          };
      
          VCL_STRANDS
          xyzzy_hoard_strands(VRT_CTX, struct vmod_priv *priv, VCL_STRANDS s)
          {
                 struct hoarder *h;
      
                 CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
                 AN(priv);
      
                 if (priv->priv == NULL) {
                         h = malloc(sizeof *h);
                         AN(h);
                         h->s = s;
                         priv->priv = h;
                         priv->free = free;
                 }
      
                 return (priv->priv);
          }
      
      And then the following test case results in a panic on my system, but I
      suspect this is generally undefined behavior and other nasty results may
      occur under different circumstances:
      
          varnishtest "Beware of STRANDS"
      
          varnish v1 -vcl {
                  import debug;
                  backend be none;
                  sub vcl_recv {
                          debug.hoard_strands("recv: " + req.url);
                  }
                  sub vcl_miss {
                          debug.hoard_strands("miss: " + req.url);
                          return (synth(200));
                  }
                  sub vcl_synth {
                          set resp.body = debug.hoard_strands("synth: " + req.url);
                          return (deliver);
                  }
          } -start
      
          client c1 {
                  txreq
                  rxresp
                  expect resp.body ~ recv
          } -run
      
      This also begs the following question: can it ever be safe to let a VMOD
      function return a STRANDS? Maybe it should be banned from return types.
      
      [1] https://github.com/varnishcache/varnish-cache/pull/3123#discussion_r345617108
      11d55148
    • Dridi Boukelmoune's avatar
      Why-does-slink-hate-capitalization OCD · 34261afd
      Dridi Boukelmoune authored
      Is it because German capitalizes so many words that his shift keys have
      become hit or miss?
      34261afd
  9. 18 Nov, 2019 10 commits
  10. 17 Nov, 2019 1 commit
  11. 16 Nov, 2019 2 commits