]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/Eui64.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 */
15 #include "acl/Eui64.h"
16 #include "acl/FilledChecklist.h"
18 #include "debug/Stream.h"
19 #include "eui/Eui64.h"
21 #include "ip/Address.h"
23 ACLEui64::ACLEui64 (char const *theClass
) : class_ (theClass
)
27 ACLEui64::typeString() const
33 ACLEui64::empty () const
35 return eui64Data
.empty();
39 aclParseEuiData(const char *t
)
42 Eui::Eui64
*q
= new Eui::Eui64
;
43 debugs(28, 5, "aclParseEuiData: " << t
);
45 if (sscanf(t
, "%[0-9a-fA-F:]", buf
) != 1) {
46 debugs(28, DBG_CRITICAL
, "ERROR: aclParseEuiData: Bad EUI-64 address: '" << t
<< "'");
51 if (!q
->decode(buf
)) {
52 debugs(28, DBG_CRITICAL
, "" << cfg_filename
<< " line " << config_lineno
<< ": " << config_input_line
);
53 debugs(28, DBG_CRITICAL
, "ERROR: aclParseEuiData: Ignoring invalid EUI-64 acl entry: cannot parse '" << buf
<< "'");
67 while (const char * t
= ConfigParser::strtokFile()) {
68 if (Eui::Eui64
* q
= aclParseEuiData(t
)) {
76 ACLEui64::match(ACLChecklist
*cl
)
78 ACLFilledChecklist
*checklist
= Filled(cl
);
80 /* IPv4 does not do EUI-64 (yet) */
81 if (!checklist
->src_addr
.isIPv6()) {
82 debugs(14, 3, "ACLEui64::match: IPv6 Required for EUI-64 Lookups. Skipping " << checklist
->src_addr
);
86 Eui::Eui64 lookingFor
;
87 if (lookingFor
.lookup(checklist
->src_addr
)) {
88 bool found
= (eui64Data
.find(lookingFor
) != eui64Data
.end());
89 debugs(28, 3, checklist
->src_addr
<< "' " << (found
? "found" : "NOT found"));
93 debugs(28, 3, checklist
->src_addr
<< " NOT found");
98 ACLEui64::dump() const
101 for (auto i
= eui64Data
.begin(); i
!= eui64Data
.end(); ++i
) {
104 sl
.push_back(SBuf(buf
));
109 #endif /* USE_SQUID_EUI */