]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/Eui64.cc
2 * Copyright (C) 1996-2017 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 "eui/Eui64.h"
20 #include "ip/Address.h"
23 ACLEui64::clone() const
25 return new ACLEui64(*this);
28 ACLEui64::ACLEui64 (char const *theClass
) : class_ (theClass
)
31 ACLEui64::ACLEui64 (ACLEui64
const & old
) : eui64Data(old
.eui64Data
), class_ (old
.class_
)
36 ACLEui64::typeString() const
42 ACLEui64::empty () const
44 return eui64Data
.empty();
48 aclParseEuiData(const char *t
)
51 Eui::Eui64
*q
= new Eui::Eui64
;
52 debugs(28, 5, "aclParseEuiData: " << t
);
54 if (sscanf(t
, "%[0-9a-fA-F:]", buf
) != 1) {
55 debugs(28, DBG_CRITICAL
, "aclParseEuiData: Bad EUI-64 address: '" << t
<< "'");
60 if (!q
->decode(buf
)) {
61 debugs(28, DBG_CRITICAL
, "" << cfg_filename
<< " line " << config_lineno
<< ": " << config_input_line
);
62 debugs(28, DBG_CRITICAL
, "aclParseEuiData: Ignoring invalid EUI-64 acl entry: can't parse '" << buf
<< "'");
76 while (const char * t
= ConfigParser::strtokFile()) {
77 if (Eui::Eui64
* q
= aclParseEuiData(t
)) {
85 ACLEui64::match(ACLChecklist
*cl
)
87 ACLFilledChecklist
*checklist
= Filled(cl
);
89 /* IPv4 does not do EUI-64 (yet) */
90 if (!checklist
->src_addr
.isIPv6()) {
91 debugs(14, 3, "ACLEui64::match: IPv6 Required for EUI-64 Lookups. Skipping " << checklist
->src_addr
);
95 Eui::Eui64 lookingFor
;
96 if (lookingFor
.lookup(checklist
->src_addr
)) {
97 bool found
= (eui64Data
.find(lookingFor
) != eui64Data
.end());
98 debugs(28, 3, checklist
->src_addr
<< "' " << (found
? "found" : "NOT found"));
102 debugs(28, 3, checklist
->src_addr
<< " NOT found");
107 ACLEui64::dump() const
110 for (auto i
= eui64Data
.begin(); i
!= eui64Data
.end(); ++i
) {
113 sl
.push_back(SBuf(buf
));
118 #endif /* USE_SQUID_EUI */