1. 04 Apr, 2020 12 commits
    • Nils Goroll's avatar
      add back a local variable which makes flexelint grok the code · 03463abf
      Nils Goroll authored
      I did not understand when I committed
      119b4174 that the local variable was
      required for flexelint to unterstand that this is not an out-of-bounds
      access.
      
      This quote of phk from the top level rant sais it all:
      
       * Do I need to tell you that static code analysis tools have a
       * really hard time coping with this, and that they give a lot of
       * false negatives which confuse people ?
      
      So true. Sorry for going a smaller but almost full circle here, I
      started with good intentions and now all that's left is the desire to
      leave the code at least a little cleaner as I found it.
      03463abf
    • Nils Goroll's avatar
      another concession to flexelint · 4a69e1ae
      Nils Goroll authored
      I would have preferred avoiding the duplication of the suckaddr member
      types, but flexelint spits "Warning 550: Symbol 'sua' (line 229) not
      accessed"
      4a69e1ae
    • Nils Goroll's avatar
      relex expect window even more · 95162cf4
      Nils Goroll authored
      vtest has seen a case where other workspace debug messages interfered.
      
      FTR, it would be nice if we could backref a prior expect in order to
      expect the same workspace address
      95162cf4
    • Nils Goroll's avatar
      stabilize test: do not expect exact byte counts · 49b40743
      Nils Goroll authored
      Across the platforms we support, the overhead of stevedore allocations
      varies slightly due to different sizes of our structs.
      49b40743
    • Nils Goroll's avatar
      flexelinting · 87d003e6
      Nils Goroll authored
      const char *const bindings_help[] = {
      varnishstat_curses_help.c  9  Note 9075: external symbol 'bindings_help'
          defined without a prior declaration
                                  _
      const int bindings_help_len = 65;
      varnishstat_curses_help.c  78  Note 9075: external symbol
      'bindings_help_len'
          defined without a prior declaration
      87d003e6
    • Nils Goroll's avatar
      stabilize varnishstat curses mode test · 41317786
      Nils Goroll authored
      Could be that there is the bereq # printed right next to the client |
      as in this vtest result:
      
      **   top  === process p1 -expect-text 22 0 { | }
      **** dT   3.593
      **** v1   vsl|          0 CLI             - Rd ping
      **** v1   vsl|          0 CLI             - Wr 200 19 PONG 1585796425 1.0
      **** dT   3.806
      **** p1   stdout|\x1b[1;10H2\x1b[22;24H|#
      41317786
    • Nils Goroll's avatar
      make test less timing sensitive · 548a4e6e
      Nils Goroll authored
      when the second request did not happen within the default
      backend_remote_error_holddown == 0.25s, we would see two ECONNREFUSED
      instead of one and a holddown.
      
      Seen in vtest:
      
      **   top  === varnish v1 -expect VBE.vcl1.foo.fail_econnrefused > 0
      **** dT   6.132
      **   v1   as expected: VBE.vcl1.foo.fail_econnrefused (2) > 0
      **   top  === varnish v1 -expect VBE.vcl1.foo.helddown > 0
      548a4e6e
    • Nils Goroll's avatar
      flexelinting · 2baf7c0b
      Nils Goroll authored
      2baf7c0b
    • Nils Goroll's avatar
      help flexelint understand what happens with memory · 9168ee5e
      Nils Goroll authored
      Flexelint sput warning 429 that the malloc() return value was neither
      freed not returned.
      
      This simplification makes it clear. The assertion on malloc() having
      succeeded is in VSA_Build()
      
      Ref #3275
      9168ee5e
    • Nils Goroll's avatar
      Assert on malloc to succeed · e5341414
      Nils Goroll authored
      This ticks off an XXX comment: We basically assert on malloc to succeed
      everywhere, so we should stick with it here, too.
      e5341414
    • Nils Goroll's avatar
      Avoid flexelint 419 warning for memcpy to a union · 39a03ec6
      Nils Goroll authored
      Closes #3275
      39a03ec6
    • Nils Goroll's avatar
      polish: remove a superfluous variable · 119b4174
      Nils Goroll authored
      119b4174
  2. 03 Apr, 2020 4 commits
  3. 02 Apr, 2020 2 commits
  4. 01 Apr, 2020 22 commits
    • Nils Goroll's avatar
    • Nils Goroll's avatar
      add vcc_acl_pedantic parameter · 6c8f25e7
      Nils Goroll authored
      See also previous commit:
      
      With this parameter set to on, any ACL entries in non-canonical form
      cause a VCL compilation error rather than only a warning.
      6c8f25e7
    • Nils Goroll's avatar
      Warn about ACL entries with non-zero host bits · b9756475
      Nils Goroll authored
      Summary:
      
      ACL entries with netmasks shorter than the maximum for the respective
      protocol represent network addresses and as such, by convention,
      should be written with all zero bits in the host part to avoid
      confusion.
      
      This patch adds VCL compile warnings and improved logging if they are
      not.
      
      Discussion:
      
      For example, while 1.2.3.0/24 and 1.2.3.255/24, in CIDR notation, both
      specify all addresses with the first three octets matching 1, 2 and 3,
      using the latter can be a source of subtle confusion.
      
      This becomes particularly apparent with netmasks outside byte
      boundaries: 1.2.6.0/22 specifies addresses 1.2.4.0 - 1.2.7.255, but
      not so experienced administrators might be tempted to think that it
      specified 1.2.6.0 - 1.2.9.255.
      
      To summarize, denoting network addresses in non-canonical form is
      confusing, a possible source of error and additionally complicates
      analyses.
      
      This patch makes sure that such mishaps do not remain unnoticed by
      
      - issuing warnings during VCL compilation about non-canonical network
        addresses
      
      - Logging ACL matches together with the canonical address
      
      The actual matching code is not touched, but a minor simplification
      can be applied later.
      b9756475
    • Nils Goroll's avatar
      4e5fcfeb
    • Nils Goroll's avatar
      VSA_BuildFAP: Build a suckaddr from Family, Address and Port · 358f7331
      Nils Goroll authored
      Follow the spirit of the vsa.c top level rant and spare callers the
      hassle of creating sockaddrs specific to ip4/ip6 just to build a VSA,
      which is intended to avoid having to special-case the protocols in the
      first place.
      358f7331
    • Nils Goroll's avatar
      Appease Solaris gcc 64bit · 544f62bd
      Nils Goroll authored
      544f62bd
    • Nils Goroll's avatar
      VSA_Build: Assign (struct sockaddr).sa_len where present · 105be6a6
      Nils Goroll authored
      In #3154 we said we would add this to the upcoming VSA_BuildFAP(),
      but actually VSA_Build() is the right place.
      105be6a6
    • Nils Goroll's avatar
      Deflate VSA_* code a bit · 50970bc9
      Nils Goroll authored
      - Centralize duplicated code in sua_len()
      - Have VSA_Malloc call VSA_Build
      - Use INIT_OBJ instead of memset + magic assignment
      
      April sales extra exclusively to customers in Paris: Now with free
      capitalized letters!
      50970bc9
    • Dridi Boukelmoune's avatar
      New HAVE_STRUCT_SOCKADDR_SA_LEN macro · 98b38e9f
      Dridi Boukelmoune authored
      Only present if struct sockaddr.sa_len exists, to be checked with
      preprocessor's #ifdef.
      
      Refs #3154
      98b38e9f
    • Dridi Boukelmoune's avatar
      9d53b1f6
    • Guillaume Quintard's avatar
      add test · 5aede725
      Guillaume Quintard authored
      5aede725
    • Guillaume Quintard's avatar
      [vstat] new json schema · 4b4411d2
      Guillaume Quintard authored
      4b4411d2
    • Guillaume Quintard's avatar
      [vstat] save a pair of lines · ff8caf99
      Guillaume Quintard authored
      ff8caf99
    • Guillaume Quintard's avatar
      [vstat] remove useless if · d1c87cc1
      Guillaume Quintard authored
      d1c87cc1
    • Nils Goroll's avatar
      Error handling for out-of-workspace VDP_Push during ESI processing · f1392d0f
      Nils Goroll authored
      As with any other out-of-workspace condition during ESI processing, we
      do not have any better way than to deliver an incomplete response
      (missing ESI include).
      
      Or do we?
      
      Fixes #3241
      f1392d0f
    • Nils Goroll's avatar
      add pthread_self() to panic output · 410354f1
      Nils Goroll authored
      This should help locating the panicking thread in a core dump when when
      the principle thread as determined by the debugger is a different one.
      410354f1
    • Nils Goroll's avatar
      9427a610
    • Nils Goroll's avatar
      support concurrent access to PRIV_TOP · 27349a30
      Nils Goroll authored
      in varnish-cache, access to all ESI sub-requests happens in a single
      thread, but vmods (VDPs) may add concurrency.
      
      We thus protect access to PRIV_TOP with the session mutex.
      
      Any vmods using this facility will likely need to add additional locking for
      the actual data structures referenced through the PRIV_TOP and any other
      access to the top request.
      
      For alternatives previously considered, see #3139
      27349a30
    • Nils Goroll's avatar
      assert for VGZ_NewGzip() failures · d1bd80e8
      Nils Goroll authored
      VGZ_NewGzip will either assert or succeed.
      d1bd80e8
    • Nils Goroll's avatar
      Handle workspace allocation errors in VEP_Init() · 0f3af407
      Nils Goroll authored
      Turn assertion into VFP error
      
      The vtc is based upon r02645.vtc and reliably reproduces the panic
      without the patch by sweeping through possible amounts of free workspace
      ranging from 4 to 400 bytes.
      
      Fixes #3253
      0f3af407
    • Dridi Boukelmoune's avatar
      Defer the illegal write check a bit · ed36b638
      Dridi Boukelmoune authored
      After the initial discussion from #3163, and looking more closely at how
      variable access is handled in subroutines I noticed a discrepancy.
      
      Setting a read only variable like obj.ttl in vcl_recv would result in
      a misleading error message explaining that it is read only, instead of
      simply not available.
      
      This change defers the illegal write check, registering unconditionally
      that the symbol was used in a set action. As a result we always get the
      correct error message but depending on whether this is happening in a
      vcl_ or custom subroutine we may either get "in subroutine" or "from
      subroutine" in the error message. A minor discrepancy probably worth
      getting rid of the prior inconsistency.
      
      This is covered by the v21 test case.
      ed36b638
    • Dridi Boukelmoune's avatar
      Manage symbol references with higher-level types · df4804b9
      Dridi Boukelmoune authored
      That would be the symbol itself instead of only the relevant mask, and a
      XREF constants wrapping the error message as well. The `struct xrefuse`
      pun was definitely intended.
      df4804b9