]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/Eui64.cc
2 * Copyright (C) 1996-2015 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"
19 #include "eui/Eui64.h"
21 #include "ip/Address.h"
24 ACLEui64::clone() const
26 return new ACLEui64(*this);
29 ACLEui64::ACLEui64 (char const *theClass
) : class_ (theClass
)
32 ACLEui64::ACLEui64 (ACLEui64
const & old
) : eui64Data(old
.eui64Data
), class_ (old
.class_
)
37 ACLEui64::typeString() const
43 ACLEui64::empty () const
45 return eui64Data
.empty();
49 aclParseEuiData(const char *t
)
52 Eui::Eui64
*q
= new Eui::Eui64
;
53 debugs(28, 5, "aclParseEuiData: " << t
);
55 if (sscanf(t
, "%[0-9a-fA-F:]", buf
) != 1) {
56 debugs(28, DBG_CRITICAL
, "aclParseEuiData: Bad EUI-64 address: '" << t
<< "'");
61 if (!q
->decode(buf
)) {
62 debugs(28, DBG_CRITICAL
, "" << cfg_filename
<< " line " << config_lineno
<< ": " << config_input_line
);
63 debugs(28, DBG_CRITICAL
, "aclParseEuiData: Ignoring invalid EUI-64 acl entry: can't parse '" << buf
<< "'");
77 while (const char * t
= strtokFile()) {
78 if (Eui::Eui64
* q
= aclParseEuiData(t
)) {
86 ACLEui64::match(ACLChecklist
*cl
)
88 ACLFilledChecklist
*checklist
= Filled(cl
);
90 /* IPv4 does not do EUI-64 (yet) */
91 if (!checklist
->src_addr
.isIPv6()) {
92 debugs(14, 3, "ACLEui64::match: IPv6 Required for EUI-64 Lookups. Skipping " << checklist
->src_addr
);
96 Eui::Eui64 lookingFor
;
97 if (lookingFor
.lookup(checklist
->src_addr
)) {
98 bool found
= (eui64Data
.find(lookingFor
) != eui64Data
.end());
99 debugs(28, 3, checklist
->src_addr
<< "' " << (found
? "found" : "NOT found"));
103 debugs(28, 3, checklist
->src_addr
<< " NOT found");
108 ACLEui64::dump() const
111 for (auto i
= eui64Data
.cbegin(); i
!= eui64Data
.end(); ++i
) {
114 sl
.push_back(SBuf(buf
));
119 #endif /* USE_SQUID_EUI */