From: Steve Hill Date: Tue, 17 May 2016 14:58:50 +0000 (+1200) Subject: Support unified EUI format code in external_acl_type X-Git-Tag: SQUID_3_5_20~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5323dbe20e9475771168d7993617ae6eb2d71c88;p=thirdparty%2Fsquid.git Support unified EUI format code in external_acl_type Squid supports %>eui as a logformat specifier, which produces an EUI-48 for IPv4 clients and an EUI-64 for IPv6 clients. However, This is not allowed as a format specifier for the external ACLs, and you have to use %SRCEUI48 and %SRCEUI64 instead. %SRCEUI48 is only useful for IPv4 clients and %SRCEUI64 is only useful for IPv6 clients, so supporting both v4 and v6 is a bit messy. Adds the %>eui specifier for external ACLs and behaves in the same way as the logformat specifier. --- diff --git a/src/external_acl.cc b/src/external_acl.cc index b67cfceb5a..4eeb160a16 100644 --- a/src/external_acl.cc +++ b/src/external_acl.cc @@ -356,6 +356,8 @@ parse_externalAclHelper(external_acl ** list) else if (strcmp(token, "%SRCPORT") == 0 || strcmp(token, "%>p") == 0) format->type = Format::LFT_CLIENT_PORT; #if USE_SQUID_EUI + else if (strcmp(token, "%>eui") == 0) + format->type = Format::LFT_CLIENT_EUI; else if (strcmp(token, "%SRCEUI48") == 0) format->type = Format::LFT_EXT_ACL_CLIENT_EUI48; else if (strcmp(token, "%SRCEUI64") == 0) @@ -944,6 +946,18 @@ makeExternalAclKey(ACLFilledChecklist * ch, external_acl_data * acl_data) break; #if USE_SQUID_EUI + case Format::LFT_CLIENT_EUI: + // TODO make the ACL checklist have a direct link to any TCP details. + if (request->clientConnectionManager.valid() && request->clientConnectionManager->clientConnection != NULL) + { + if (request->clientConnectionManager->clientConnection->remote.isIPv4()) + request->clientConnectionManager->clientConnection->remoteEui48.encode(buf, sizeof(buf)); + else + request->clientConnectionManager->clientConnection->remoteEui64.encode(buf, sizeof(buf)); + str = buf; + } + break; + case Format::LFT_EXT_ACL_CLIENT_EUI48: if (request->clientConnectionManager.valid() && request->clientConnectionManager->clientConnection != NULL && request->clientConnectionManager->clientConnection->remoteEui48.encode(buf, sizeof(buf)))