]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/ConnMark.cc
2 * Copyright (C) 1996-2023 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 "base/IoManip.h"
15 #include "client_side.h"
16 #include "debug/Stream.h"
17 #include "http/Stream.h"
18 #include "sbuf/Stream.h"
21 Acl::ConnMark::empty() const
27 Acl::ConnMark::parse()
29 while (const char *t
= ConfigParser::strtokFile()) {
31 Parser::Tokenizer
tokenizer(token
);
32 const auto mc
= Ip::NfMarkConfig::Parse(token
);
34 debugs(28, 7, "added " << mc
);
38 throw TexcHere(ToSBuf("acl ", typeString(), " requires at least one mark"));
43 Acl::ConnMark::match(ACLChecklist
*cl
)
45 const auto *checklist
= Filled(cl
);
46 const auto conn
= checklist
->conn();
48 if (conn
&& conn
->clientConnection
) {
49 const auto connmark
= conn
->clientConnection
->nfConnmark
;
51 for (const auto &m
: marks
) {
52 if (m
.matches(connmark
)) {
53 debugs(28, 5, "found " << m
<< " matching 0x" << asHex(connmark
));
56 debugs(28, 7, "skipped " << m
<< " mismatching 0x" << asHex(connmark
));
59 debugs(28, 7, "fails: no client connection");
66 Acl::ConnMark::dump() const
69 for (const auto &m
: marks
) {
70 sl
.push_back(ToSBuf(m
));
76 Acl::ConnMark::typeString() const
78 return "client_connection_mark";