]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix client_connection_mark handling of clientless transactions (#312)
authorAlexander Gozman <goal81@gmail.com>
Wed, 24 Oct 2018 15:28:13 +0000 (15:28 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Wed, 26 Dec 2018 20:00:53 +0000 (09:00 +1300)
Also affects the deprecated clientside_mark ACL.

Broken since CONNMARK matching was added in commit 653d992.

src/acl/ConnMark.cc

index 5a62e6f36a6b7a156965cf1028c8b94eccb46e5d..d5b0b3449b511b71d8b2873ea4c82852e1611d6d 100644 (file)
@@ -74,15 +74,22 @@ int
 Acl::ConnMark::match(ACLChecklist *cl)
 {
     const auto *checklist = Filled(cl);
-    const auto connmark = checklist->conn()->clientConnection->nfmark;
+    const auto conn = checklist->conn();
 
-    for (const auto &m : marks) {
-        if ((connmark & m.second) == m.first) {
-            debugs(28, 5, "found " << m << " matching " << asHex(connmark));
-            return 1;
+    if (conn && conn->clientConnection) {
+        const auto connmark = conn->clientConnection->nfmark;
+
+        for (const auto &m : marks) {
+            if ((connmark & m.second) == m.first) {
+                debugs(28, 5, "found " << m << " matching " << asHex(connmark));
+                return 1;
+            }
+            debugs(28, 7, "skipped " << m << " mismatching " << asHex(connmark));
         }
-        debugs(28, 7, "skipped " << m << " mismatching " << asHex(connmark));
+    } else {
+        debugs(28, 7, "fails: no client connection");
     }
+
     return 0;
 }