* If the DLZ only operates on 'live' data, then version
* wouldn't necessarily be needed.
*/
- if (clientinfo != NULL && clientinfo->version >= DNS_CLIENTINFO_VERSION)
- {
+ if (clientinfo != NULL && clientinfo->version >= 2) {
dbversion = clientinfo->dbversion;
if (dbversion != NULL && *(bool *)dbversion) {
loginfo("dlz_example: lookup against live transaction");
* If the DLZ only operates on 'live' data, then version
* wouldn't necessarily be needed.
*/
- if (clientinfo != NULL && clientinfo->version >= DNS_CLIENTINFO_VERSION)
- {
+ if (clientinfo != NULL && clientinfo->version >= 2) {
dbversion = clientinfo->dbversion;
if (dbversion != NULL && *(bool *)dbversion) {
state->log(ISC_LOG_INFO, "dlz_example: lookup against "
}
if (strcmp(name, "source-addr") == 0) {
+ char ecsbuf[100] = "not supported";
strcpy(buf, "unknown");
if (methods != NULL && methods->sourceip != NULL &&
(methods->version - methods->age <=
methods->sourceip(clientinfo, &src);
fmt_address(src, buf, sizeof(buf));
}
+ if (clientinfo != NULL && clientinfo->version >= 3) {
+ if (clientinfo->ecs.addr.family != AF_UNSPEC) {
+ dns_ecs_format(&clientinfo->ecs, ecsbuf,
+ sizeof(ecsbuf));
+ } else {
+ strcpy(ecsbuf, "not present");
+ }
+ }
+ i = strlen(buf);
+ snprintf(buf + i, sizeof(buf) - i - 1, " ECS %s", ecsbuf);
state->log(ISC_LOG_INFO,
"dlz_example: lookup connection from: %s", buf);
found = true;
result = state->putrr(lookup, "TXT", 0, buf);
+ /* We could also generate a CNAME RR:
+ snprintf(buf, sizeof(buf), "%s.redirect.example.", ecsbuf);
+ result = state->putrr(lookup, "CNAME", 0, buf); */
if (result != ISC_R_SUCCESS) {
return (result);
}
void *link;
} isc_sockaddr_t;
-#define DNS_CLIENTINFO_VERSION 2
+typedef struct isc_netaddr {
+ unsigned int family;
+ union {
+ struct in_addr in;
+ struct in6_addr in6;
+#ifdef ISC_PLATFORM_HAVESYSUNH
+ char un[sizeof(((struct sockaddr_un *)0)->sun_path)];
+#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */
+ } type;
+ uint32_t zone;
+} isc_netaddr_t;
+
+typedef struct dns_ecs {
+ isc_netaddr_t addr;
+ uint8_t source;
+ uint8_t scope;
+} dns_ecs_t;
+
+#define DNS_CLIENTINFO_VERSION 3
typedef struct dns_clientinfo {
- uint16_t version;
- void *data;
- void *dbversion;
+ uint16_t version;
+ void *data;
+ void *dbversion;
+ dns_ecs_t ecs;
} dns_clientinfo_t;
typedef isc_result_t (*dns_clientinfo_sourceip_t)(dns_clientinfo_t *client,
uint16_t version;
uint16_t age;
dns_clientinfo_sourceip_t sourceip;
- dns_clientinfo_version_t dbversion;
} dns_clientinfomethods_t;
#endif /* DLZ_DLOPEN_VERSION > 1 */
}
/* Are we okay to try to find the txn version? */
- if (clientinfo != NULL && clientinfo->version >= DNS_CLIENTINFO_VERSION)
- {
+ if (clientinfo != NULL && clientinfo->version >= 2) {
txn = (mysql_transaction_t *)clientinfo->dbversion;
if (txn != NULL && validate_txn(state, txn) == ISC_R_SUCCESS) {
dbi = txn->dbi;
*****/
#define DNS_CLIENTINFO_VERSION 3
+/*
+ * Any updates to this structure should also be applied in
+ * contrib/modules/dlz/dlz_minmal.h.
+ */
typedef struct dns_clientinfo {
uint16_t version;
void *data;
#define DNS_CLIENTINFOMETHODS_VERSION 2
#define DNS_CLIENTINFOMETHODS_AGE 1
+/*
+ * Any updates to this structure should also be applied in
+ * contrib/modules/dlz/dlz_minmal.h.
+ */
typedef struct dns_clientinfomethods {
uint16_t version;
uint16_t age;
#define ECS_MAX_V6_SCOPE 56
#endif
+/*
+ * Any updates to this structure should also be applied in
+ * contrib/modules/dlz/dlz_minmal.h.
+ */
struct dns_ecs {
isc_netaddr_t addr;
uint8_t source;
dns_dyndb_destroyctx
dns_ecdb_register
dns_ecdb_unregister
+dns_ecs_equals
dns_ecs_init
dns_ecs_format
dns_fixedname_init
ISC_LANG_BEGINDECLS
+/*
+ * Any updates to this structure should also be applied in
+ * contrib/modules/dlz/dlz_minmal.h.
+ */
struct isc_netaddr {
unsigned int family;
union {
#include <sys/un.h>
#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */
+/*
+ * Any updates to this structure should also be applied in
+ * contrib/modules/dlz/dlz_minmal.h.
+ */
struct isc_sockaddr {
union {
struct sockaddr sa;