]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/ConnMark.cc
2 * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 /* DEBUG: section 28 Access Control */
12 #include "acl/ConnMark.h"
13 #include "acl/FilledChecklist.h"
14 #include "client_side.h"
16 #include "http/Stream.h"
17 #include "sbuf/Stream.h"
20 Acl::ConnMark::empty() const
26 Acl::ConnMark::parse()
28 while (const char *t
= ConfigParser::strtokFile()) {
30 Parser::Tokenizer
tokenizer(token
);
31 const auto mc
= Ip::NfMarkConfig::Parse(token
);
33 debugs(28, 7, "added " << mc
);
37 throw TexcHere(ToSBuf("acl ", typeString(), " requires at least one mark"));
42 Acl::ConnMark::match(ACLChecklist
*cl
)
44 const auto *checklist
= Filled(cl
);
45 const auto conn
= checklist
->conn();
47 if (conn
&& conn
->clientConnection
) {
48 const auto connmark
= conn
->clientConnection
->nfConnmark
;
50 for (const auto &m
: marks
) {
51 if (m
.matches(connmark
)) {
52 debugs(28, 5, "found " << m
<< " matching " << asHex(connmark
));
55 debugs(28, 7, "skipped " << m
<< " mismatching " << asHex(connmark
));
58 debugs(28, 7, "fails: no client connection");
65 Acl::ConnMark::dump() const
68 for (const auto &m
: marks
) {
69 sl
.push_back(ToSBuf(m
));
75 Acl::ConnMark::typeString() const
77 return "client_connection_mark";