2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-03 08:05:21 +00:00

don't use 'typename' as it is reserved in C++

This commit is contained in:
Mark Andrews
2018-11-13 14:12:02 +11:00
committed by Evan Hunt
parent c59f332db2
commit 333f718dd3
4 changed files with 176 additions and 135 deletions

View File

@@ -138,20 +138,20 @@ static const char copyright[] =
static struct cc {
struct cc *next;
int rdclass;
char classname[TYPECLASSBUF];
char classbuf[TYPECLASSBUF];
} *classes;
static struct tt {
struct tt *next;
int rdclass;
int type;
char classname[TYPECLASSBUF];
char typename[TYPECLASSBUF];
char dirname[DIRNAMESIZE-30]; /* XXX Should be max path length */
char classbuf[TYPECLASSBUF];
char typebuf[TYPECLASSBUF];
char dirbuf[DIRNAMESIZE-30]; /* XXX Should be max path length */
} *types;
static struct ttnam {
char typename[TYPECLASSBUF];
char typebuf[TYPECLASSBUF];
char macroname[TYPECLASSBUF];
char attr[ATTRIBUTESIZE];
unsigned int sorted;
@@ -249,13 +249,13 @@ doswitch(const char *name, const char *function, const char *args,
fprintf(stdout,
"\tcase %d:%s %s_%s(%s); break;",
tt->type, result, function,
funname(tt->typename, buf1), args);
funname(tt->typebuf, buf1), args);
else
fprintf(stdout,
"\t\tcase %d:%s %s_%s_%s(%s); break;",
tt->rdclass, result, function,
funname(tt->classname, buf1),
funname(tt->typename, buf2), args);
funname(tt->classbuf, buf1),
funname(tt->typebuf, buf2), args);
fputs(" \\\n", stdout);
lasttype = tt->type;
}
@@ -286,32 +286,36 @@ find_typename(int type) {
int i;
for (i = 0; i < TYPENAMES; i++) {
if (typenames[i].typename[0] != 0 &&
if (typenames[i].typebuf[0] != 0 &&
typenames[i].type == type)
{
return (&typenames[i]);
}
}
return (NULL);
}
static void
insert_into_typenames(int type, const char *typename, const char *attr) {
insert_into_typenames(int type, const char *typebuf, const char *attr) {
struct ttnam *ttn = NULL;
size_t c;
int i, n;
char tmp[256];
INSIST(strlen(typename) < TYPECLASSBUF);
INSIST(strlen(typebuf) < TYPECLASSBUF);
for (i = 0; i < TYPENAMES; i++) {
if (typenames[i].typename[0] != 0 &&
if (typenames[i].typebuf[0] != 0 &&
typenames[i].type == type &&
strcmp(typename, typenames[i].typename) != 0) {
strcmp(typebuf, typenames[i].typebuf) != 0)
{
fprintf(stderr,
"Error: type %d has two names: %s, %s\n",
type, typenames[i].typename, typename);
type, typenames[i].typebuf, typebuf);
exit(1);
}
if (typenames[i].typename[0] == 0 && ttn == NULL)
if (typenames[i].typebuf[0] == 0 && ttn == NULL) {
ttn = &typenames[i];
}
}
if (ttn == NULL) {
fprintf(stderr, "Error: typenames array too small\n");
@@ -319,23 +323,24 @@ insert_into_typenames(int type, const char *typename, const char *attr) {
}
/* XXXMUKS: This is redundant due to the INSIST above. */
if (strlen(typename) > sizeof(ttn->typename) - 1) {
if (strlen(typebuf) > sizeof(ttn->typebuf) - 1) {
fprintf(stderr, "Error: type name %s is too long\n",
typename);
typebuf);
exit(1);
}
strncpy(ttn->typename, typename, sizeof(ttn->typename));
ttn->typename[sizeof(ttn->typename) - 1] = '\0';
strncpy(ttn->typebuf, typebuf, sizeof(ttn->typebuf));
ttn->typebuf[sizeof(ttn->typebuf) - 1] = '\0';
strncpy(ttn->macroname, ttn->typename, sizeof(ttn->macroname));
strncpy(ttn->macroname, ttn->typebuf, sizeof(ttn->macroname));
ttn->macroname[sizeof(ttn->macroname) - 1] = '\0';
ttn->type = type;
c = strlen(ttn->macroname);
while (c > 0) {
if (ttn->macroname[c - 1] == '-')
if (ttn->macroname[c - 1] == '-') {
ttn->macroname[c - 1] = '_';
}
c--;
}
@@ -354,7 +359,7 @@ insert_into_typenames(int type, const char *typename, const char *attr) {
if (strlen(attr) > sizeof(ttn->attr) - 1) {
fprintf(stderr, "Error: attr (%s) [name %s] is too long\n",
attr, typename);
attr, typebuf);
exit(1);
}
@@ -362,24 +367,25 @@ insert_into_typenames(int type, const char *typename, const char *attr) {
ttn->attr[sizeof(ttn->attr) - 1] = '\0';
ttn->sorted = 0;
if (maxtype < type)
if (maxtype < type) {
maxtype = type;
}
}
static void
add(int rdclass, const char *classname, int type, const char *typename,
const char *dirname)
add(int rdclass, const char *classbuf, int type, const char *typebuf,
const char *dirbuf)
{
struct tt *newtt = (struct tt *)malloc(sizeof(*newtt));
struct tt *tt, *oldtt;
struct cc *newcc;
struct cc *cc, *oldcc;
INSIST(strlen(typename) < TYPECLASSBUF);
INSIST(strlen(classname) < TYPECLASSBUF);
INSIST(strlen(dirname) < DIRNAMESIZE);
INSIST(strlen(typebuf) < TYPECLASSBUF);
INSIST(strlen(classbuf) < TYPECLASSBUF);
INSIST(strlen(dirbuf) < DIRNAMESIZE);
insert_into_typenames(type, typename, NULL);
insert_into_typenames(type, typebuf, NULL);
if (newtt == NULL) {
fprintf(stderr, "malloc() failed\n");
@@ -390,16 +396,17 @@ add(int rdclass, const char *classname, int type, const char *typename,
newtt->rdclass = rdclass;
newtt->type = type;
strncpy(newtt->classname, classname, sizeof(newtt->classname));
newtt->classname[sizeof(newtt->classname) - 1] = '\0';
strncpy(newtt->classbuf, classbuf, sizeof(newtt->classbuf));
newtt->classbuf[sizeof(newtt->classbuf) - 1] = '\0';
strncpy(newtt->typename, typename, sizeof(newtt->typename));
newtt->typename[sizeof(newtt->typename) - 1] = '\0';
strncpy(newtt->typebuf, typebuf, sizeof(newtt->typebuf));
newtt->typebuf[sizeof(newtt->typebuf) - 1] = '\0';
if (strncmp(dirname, "./", 2) == 0)
dirname += 2;
strncpy(newtt->dirname, dirname, sizeof(newtt->dirname));
newtt->dirname[sizeof(newtt->dirname) - 1] = '\0';
if (strncmp(dirbuf, "./", 2) == 0) {
dirbuf += 2;
}
strncpy(newtt->dirbuf, dirbuf, sizeof(newtt->dirbuf));
newtt->dirbuf[sizeof(newtt->dirbuf) - 1] = '\0';
tt = types;
oldtt = NULL;
@@ -410,26 +417,30 @@ add(int rdclass, const char *classname, int type, const char *typename,
}
while ((tt != NULL) && (tt->type == type) && (tt->rdclass < rdclass)) {
if (strcmp(tt->typename, typename) != 0)
if (strcmp(tt->typebuf, typebuf) != 0) {
exit(1);
}
oldtt = tt;
tt = tt->next;
}
if ((tt != NULL) && (tt->type == type) && (tt->rdclass == rdclass))
if ((tt != NULL) && (tt->type == type) && (tt->rdclass == rdclass)) {
exit(1);
}
newtt->next = tt;
if (oldtt != NULL)
if (oldtt != NULL) {
oldtt->next = newtt;
else
} else {
types = newtt;
}
/*
* Do a class switch for this type.
*/
if (rdclass == 0)
if (rdclass == 0) {
return;
}
newcc = (struct cc *)malloc(sizeof(*newcc));
if (newcc == NULL) {
@@ -437,8 +448,8 @@ add(int rdclass, const char *classname, int type, const char *typename,
exit(1);
}
newcc->rdclass = rdclass;
strncpy(newcc->classname, classname, sizeof(newcc->classname));
newcc->classname[sizeof(newcc->classname) - 1] = '\0';
strncpy(newcc->classbuf, classbuf, sizeof(newcc->classbuf));
newcc->classbuf[sizeof(newcc->classbuf) - 1] = '\0';
cc = classes;
oldcc = NULL;
@@ -453,34 +464,39 @@ add(int rdclass, const char *classname, int type, const char *typename,
}
newcc->next = cc;
if (oldcc != NULL)
if (oldcc != NULL) {
oldcc->next = newcc;
else
} else {
classes = newcc;
}
}
static void
sd(int rdclass, const char *classname, const char *dirname, char filetype) {
sd(int rdclass, const char *classbuf, const char *dirbuf, char filetype) {
char buf[TYPECLASSLEN + sizeof("_65535.h")];
char typename[TYPECLASSBUF];
char typebuf[TYPECLASSBUF];
int type, n;
isc_dir_t dir;
if (!start_directory(dirname, &dir))
if (!start_directory(dirbuf, &dir)) {
return;
}
while (next_file(&dir)) {
if (sscanf(dir.filename, TYPECLASSFMT, typename, &type) != 2)
if (sscanf(dir.filename, TYPECLASSFMT, typebuf, &type) != 2) {
continue;
if ((type > 65535) || (type < 0))
}
if ((type > 65535) || (type < 0)) {
continue;
}
n = snprintf(buf, sizeof(buf), "%s_%d.%c", typename,
n = snprintf(buf, sizeof(buf), "%s_%d.%c", typebuf,
type, filetype);
INSIST(n > 0 && (unsigned)n < sizeof(buf));
if (strcmp(buf, dir.filename) != 0)
if (strcmp(buf, dir.filename) != 0) {
continue;
add(rdclass, classname, type, typename, dirname);
}
add(rdclass, classbuf, type, typebuf, dirbuf);
}
end_directory(&dir);
@@ -507,7 +523,7 @@ main(int argc, char **argv) {
char buf[DIRNAMESIZE]; /* XXX Should be max path length */
char srcdir[DIRNAMESIZE]; /* XXX Should be max path length */
int rdclass;
char classname[TYPECLASSBUF];
char classbuf[TYPECLASSBUF];
struct tt *tt;
struct cc *cc;
struct ttnam *ttn, *ttn2;
@@ -571,7 +587,8 @@ main(int argc, char **argv) {
case 's':
if (strlen(isc_commandline_argument) >
DIRNAMESIZE - 2 * TYPECLASSLEN -
sizeof("/rdata/_65535_65535")) {
sizeof("/rdata/_65535_65535"))
{
fprintf(stderr, "\"%s\" too long\n",
isc_commandline_argument);
exit(1);
@@ -596,22 +613,27 @@ main(int argc, char **argv) {
n = snprintf(buf, sizeof(buf), "%srdata", srcdir);
INSIST(n > 0 && (unsigned)n < sizeof(srcdir));
if (!start_directory(buf, &dir))
if (!start_directory(buf, &dir)) {
exit(1);
}
while (next_file(&dir)) {
if (sscanf(dir.filename, TYPECLASSFMT, classname,
if (sscanf(dir.filename, TYPECLASSFMT, classbuf,
&rdclass) != 2)
{
continue;
if ((rdclass > 65535) || (rdclass < 0))
}
if ((rdclass > 65535) || (rdclass < 0)) {
continue;
}
n = snprintf(buf, sizeof(buf), "%srdata/%s_%d",
srcdir, classname, rdclass);
srcdir, classbuf, rdclass);
INSIST(n > 0 && (unsigned)n < sizeof(buf));
if (strcmp(buf + 6 + strlen(srcdir), dir.filename) != 0)
if (strcmp(buf + 6 + strlen(srcdir), dir.filename) != 0) {
continue;
sd(rdclass, classname, buf, filetype);
}
sd(rdclass, classbuf, buf, filetype);
}
end_directory(&dir);
n = snprintf(buf, sizeof(buf), "%srdata/generic", srcdir);
@@ -630,8 +652,9 @@ main(int argc, char **argv) {
snprintf(year, sizeof(year), "-2016");
}
if (!depend)
if (!depend) {
fprintf(stdout, copyright, year);
}
if (code) {
fputs("#ifndef DNS_CODE_H\n", stdout);
@@ -641,9 +664,10 @@ main(int argc, char **argv) {
fputs("#include <isc/result.h>\n\n", stdout);
fputs("#include <dns/name.h>\n\n", stdout);
for (tt = types; tt != NULL; tt = tt->next)
for (tt = types; tt != NULL; tt = tt->next) {
fprintf(stdout, "#include \"%s/%s_%d.c\"\n",
tt->dirname, tt->typename, tt->type);
tt->dirbuf, tt->typebuf, tt->type);
}
fputs("\n\n", stdout);
@@ -734,16 +758,18 @@ main(int argc, char **argv) {
fprintf(stdout, "\tswitch (_hash) { \\\n");
for (i = 0; i <= maxtype; i++) {
ttn = find_typename(i);
if (ttn == NULL)
if (ttn == NULL) {
continue;
}
/*
* Skip entries we already processed.
*/
if (ttn->sorted != 0)
if (ttn->sorted != 0) {
continue;
}
hash = HASH(ttn->typename);
hash = HASH(ttn->typebuf);
fprintf(stdout, "\t\tcase %u: \\\n", hash);
/*
@@ -752,13 +778,15 @@ main(int argc, char **argv) {
*/
for (j = 0; j <= maxtype; j++) {
ttn2 = find_typename(j);
if (ttn2 == NULL)
if (ttn2 == NULL) {
continue;
if (hash == HASH(ttn2->typename)) {
fprintf(stdout, "\t\t\tRDATATYPE_COMPARE"
"(\"%s\", %d, "
"_typename, _length, _typep); \\\n",
ttn2->typename, ttn2->type);
}
if (hash == HASH(ttn2->typebuf)) {
fprintf(stdout, "\t\t\t"
"RDATATYPE_COMPARE"
"(\"%s\", %d, _typename, "
" _length, _typep); \\\n",
ttn2->typebuf, ttn2->type);
ttn2->sorted = 1;
}
}
@@ -770,8 +798,9 @@ main(int argc, char **argv) {
fprintf(stdout, "\tswitch (type) { \\\n");
for (i = 0; i <= maxtype; i++) {
ttn = find_typename(i);
if (ttn == NULL)
if (ttn == NULL) {
continue;
}
fprintf(stdout, "\tcase %d: return (%s); \\\n",
i, upper(ttn->attr));
}
@@ -781,19 +810,21 @@ main(int argc, char **argv) {
fprintf(stdout, "\tswitch (type) { \\\n");
for (i = 0; i <= maxtype; i++) {
ttn = find_typename(i);
if (ttn == NULL)
if (ttn == NULL) {
continue;
}
/*
* Remove KEYDATA (65533) from the type to memonic
* translation as it is internal use only. This
* stops the tools from displaying KEYDATA instead
* of TYPE65533.
*/
if (i == 65533U)
if (i == 65533U) {
continue;
}
fprintf(stdout, "\tcase %d: return "
"(str_totext(\"%s\", target)); \\\n",
i, upper(ttn->typename));
i, upper(ttn->typebuf));
}
fprintf(stdout, "\t}\n");
@@ -808,12 +839,14 @@ main(int argc, char **argv) {
fprintf(stdout, "\tdns_rdatatype_none = 0,\n");
lasttype = 0;
for (tt = types; tt != NULL; tt = tt->next)
if (tt->type != lasttype)
for (tt = types; tt != NULL; tt = tt->next) {
if (tt->type != lasttype) {
fprintf(stdout,
"\tdns_rdatatype_%s = %d,\n",
funname(tt->typename, buf1),
funname(tt->typebuf, buf1),
lasttype = tt->type);
}
}
fprintf(stdout, "\tdns_rdatatype_ixfr = 251,\n");
fprintf(stdout, "\tdns_rdatatype_axfr = 252,\n");
@@ -826,9 +859,9 @@ main(int argc, char **argv) {
fprintf(stdout, "#define dns_rdatatype_none\t"
"((dns_rdatatype_t)dns_rdatatype_none)\n");
for (tt = types; tt != NULL; tt = tt->next)
for (tt = types; tt != NULL; tt = tt->next) {
if (tt->type != lasttype) {
s = funname(tt->typename, buf1);
s = funname(tt->typebuf, buf1);
fprintf(stdout,
"#define dns_rdatatype_%s\t%s"
"((dns_rdatatype_t)dns_rdatatype_%s)"
@@ -836,6 +869,7 @@ main(int argc, char **argv) {
s, strlen(s) < 2U ? "\t" : "", s);
lasttype = tt->type;
}
}
fprintf(stdout, "#define dns_rdatatype_ixfr\t"
"((dns_rdatatype_t)dns_rdatatype_ixfr)\n");
@@ -874,11 +908,12 @@ main(int argc, char **argv) {
} while (0)
for (cc = classes; cc != NULL; cc = cc->next) {
if (cc->rdclass == 3)
if (cc->rdclass == 3) {
PRINTCLASS("chaos", 3);
else if (cc->rdclass == 255)
} else if (cc->rdclass == 255) {
PRINTCLASS("none", 254);
PRINTCLASS(cc->classname, cc->rdclass);
}
PRINTCLASS(cc->classbuf, cc->rdclass);
}
#undef PRINTCLASS
@@ -888,35 +923,40 @@ main(int argc, char **argv) {
} else if (structs) {
if (prefix != NULL) {
if ((fd = fopen(prefix,"r")) != NULL) {
while (fgets(buf, sizeof(buf), fd) != NULL)
while (fgets(buf, sizeof(buf), fd) != NULL) {
fputs(buf, stdout);
}
fclose(fd);
}
}
for (tt = types; tt != NULL; tt = tt->next) {
snprintf(buf, sizeof(buf), "%s/%s_%d.h",
tt->dirname, tt->typename, tt->type);
tt->dirbuf, tt->typebuf, tt->type);
if ((fd = fopen(buf,"r")) != NULL) {
while (fgets(buf, sizeof(buf), fd) != NULL)
while (fgets(buf, sizeof(buf), fd) != NULL) {
fputs(buf, stdout);
}
fclose(fd);
}
}
if (suffix != NULL) {
if ((fd = fopen(suffix,"r")) != NULL) {
while (fgets(buf, sizeof(buf), fd) != NULL)
while (fgets(buf, sizeof(buf), fd) != NULL) {
fputs(buf, stdout);
}
fclose(fd);
}
}
} else if (depend) {
for (tt = types; tt != NULL; tt = tt->next)
for (tt = types; tt != NULL; tt = tt->next) {
fprintf(stdout, "%s:\t%s/%s_%d.h\n", file,
tt->dirname, tt->typename, tt->type);
tt->dirbuf, tt->typebuf, tt->type);
}
}
if (ferror(stdout) != 0)
if (ferror(stdout) != 0) {
exit(1);
}
return (0);
}

View File

@@ -1718,15 +1718,15 @@ load_text(dns_loadctx_t *lctx) {
if ((lctx->options & DNS_MASTER_ZONE) != 0 &&
(lctx->options & DNS_MASTER_SLAVE) == 0 &&
(type == dns_rdatatype_md || type == dns_rdatatype_mf)) {
char typename[DNS_RDATATYPE_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE];
result = DNS_R_OBSOLETE;
dns_rdatatype_format(type, typename, sizeof(typename));
dns_rdatatype_format(type, typebuf, sizeof(typebuf));
(*callbacks->error)(callbacks,
"%s:%lu: %s '%s': %s",
source, line,
"type", typename,
"type", typebuf,
dns_result_totext(result));
if (MANYERRS(lctx, result)) {
SETRESULT(lctx, result);
@@ -1742,15 +1742,15 @@ load_text(dns_loadctx_t *lctx) {
(lctx->options & DNS_MASTER_SLAVE) == 0 &&
dns_rdatatype_ismeta(type))
{
char typename[DNS_RDATATYPE_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE];
result = DNS_R_METATYPE;
dns_rdatatype_format(type, typename, sizeof(typename));
dns_rdatatype_format(type, typebuf, sizeof(typebuf));
(*callbacks->error)(callbacks,
"%s:%lu: %s '%s': %s",
source, line,
"type", typename,
"type", typebuf,
dns_result_totext(result));
if (MANYERRS(lctx, result)) {
SETRESULT(lctx, result);

View File

@@ -1305,15 +1305,16 @@ get_key(dns_validator_t *val, dns_rdata_rrsig_t *siginfo) {
* the same name.
*/
if (val->event->rdataset->type == dns_rdatatype_soa ||
val->event->rdataset->type == dns_rdatatype_ns) {
const char *typename;
val->event->rdataset->type == dns_rdatatype_ns)
{
const char *type;
if (val->event->rdataset->type == dns_rdatatype_soa)
typename = "SOA";
type = "SOA";
else
typename = "NS";
type = "NS";
validator_log(val, ISC_LOG_DEBUG(3),
"%s signer mismatch", typename);
"%s signer mismatch", type);
return (DNS_R_CONTINUE);
}
}

View File

@@ -1304,8 +1304,8 @@ rpz_log_rewrite(ns_client_t *client, bool disabled,
char cname_buf[DNS_NAME_FORMATSIZE] = { 0 };
char p_name_buf[DNS_NAME_FORMATSIZE];
char qname_buf[DNS_NAME_FORMATSIZE];
char classname[DNS_RDATACLASS_FORMATSIZE];
char typename[DNS_RDATATYPE_FORMATSIZE];
char classbuf[DNS_RDATACLASS_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE];
const char *s1 = cname_buf, *s2 = cname_buf;
dns_rdataset_t *rdataset;
dns_rpz_st_t *st;
@@ -1347,15 +1347,15 @@ rpz_log_rewrite(ns_client_t *client, bool disabled,
*/
rdataset = ISC_LIST_HEAD(client->query.origqname->list);
INSIST(rdataset != NULL);
dns_rdataclass_format(rdataset->rdclass, classname, sizeof(classname));
dns_rdatatype_format(rdataset->type, typename, sizeof(typename));
dns_rdataclass_format(rdataset->rdclass, classbuf, sizeof(classbuf));
dns_rdatatype_format(rdataset->type, typebuf, sizeof(typebuf));
ns_client_log(client, DNS_LOGCATEGORY_RPZ, NS_LOGMODULE_QUERY,
DNS_RPZ_INFO_LEVEL,
"%srpz %s %s rewrite %s/%s/%s via %s%s%s%s",
disabled ? "disabled " : "",
dns_rpz_type2str(type), dns_rpz_policy2str(policy),
qname_buf, typename, classname,
qname_buf, typebuf, classbuf,
p_name_buf, s1, cname_buf, s2);
}
@@ -5273,18 +5273,18 @@ ns__query_start(query_ctx_t *qctx) {
qctx->qtype, false))
{
char namebuf[DNS_NAME_FORMATSIZE];
char typename[DNS_RDATATYPE_FORMATSIZE];
char classname[DNS_RDATACLASS_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE];
char classbuf[DNS_RDATACLASS_FORMATSIZE];
dns_name_format(qctx->client->query.qname,
namebuf, sizeof(namebuf));
dns_rdatatype_format(qctx->qtype, typename, sizeof(typename));
dns_rdatatype_format(qctx->qtype, typebuf, sizeof(typebuf));
dns_rdataclass_format(qctx->client->message->rdclass,
classname, sizeof(classname));
classbuf, sizeof(classbuf));
ns_client_log(qctx->client, DNS_LOGCATEGORY_SECURITY,
NS_LOGMODULE_QUERY, ISC_LOG_ERROR,
"check-names failure %s/%s/%s", namebuf,
typename, classname);
typebuf, classbuf);
QUERY_ERROR(qctx, DNS_R_REFUSED);
return (query_done(qctx));
}
@@ -6114,18 +6114,18 @@ ns__query_sfcache(query_ctx_t *qctx) {
{
if (isc_log_wouldlog(ns_lctx, ISC_LOG_DEBUG(1))) {
char namebuf[DNS_NAME_FORMATSIZE];
char typename[DNS_RDATATYPE_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE];
dns_name_format(qctx->client->query.qname,
namebuf, sizeof(namebuf));
dns_rdatatype_format(qctx->qtype, typename,
sizeof(typename));
dns_rdatatype_format(qctx->qtype, typebuf,
sizeof(typebuf));
ns_client_log(qctx->client,
NS_LOGCATEGORY_CLIENT,
NS_LOGMODULE_QUERY,
ISC_LOG_DEBUG(1),
"servfail cache hit %s/%s (%s)",
namebuf, typename,
namebuf, typebuf,
((flags & NS_FAILCACHE_CD) != 0)
? "CD=1"
: "CD=0");
@@ -10789,7 +10789,7 @@ static inline void
log_tat(ns_client_t *client) {
char namebuf[DNS_NAME_FORMATSIZE];
char clientbuf[ISC_NETADDR_FORMATSIZE];
char classname[DNS_RDATACLASS_FORMATSIZE];
char classbuf[DNS_RDATACLASS_FORMATSIZE];
isc_netaddr_t netaddr;
char *tags = NULL;
size_t taglen = 0;
@@ -10809,8 +10809,8 @@ log_tat(ns_client_t *client) {
isc_netaddr_fromsockaddr(&netaddr, &client->peeraddr);
dns_name_format(client->query.qname, namebuf, sizeof(namebuf));
isc_netaddr_format(&netaddr, clientbuf, sizeof(clientbuf));
dns_rdataclass_format(client->view->rdclass, classname,
sizeof(classname));
dns_rdataclass_format(client->view->rdclass, classbuf,
sizeof(classbuf));
if (client->query.qtype == dns_rdatatype_dnskey) {
uint16_t keytags = client->keytag_len / 2;
@@ -10839,7 +10839,7 @@ log_tat(ns_client_t *client) {
isc_log_write(ns_lctx, NS_LOGCATEGORY_TAT, NS_LOGMODULE_QUERY,
ISC_LOG_INFO, "trust-anchor-telemetry '%s/%s' from %s%s",
namebuf, classname, clientbuf, tags != NULL? tags : "");
namebuf, classbuf, clientbuf, tags != NULL? tags : "");
if (tags != NULL) {
isc_mem_put(client->mctx, tags, taglen);
}
@@ -10848,8 +10848,8 @@ log_tat(ns_client_t *client) {
static inline void
log_query(ns_client_t *client, unsigned int flags, unsigned int extflags) {
char namebuf[DNS_NAME_FORMATSIZE];
char typename[DNS_RDATATYPE_FORMATSIZE];
char classname[DNS_RDATACLASS_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE];
char classbuf[DNS_RDATACLASS_FORMATSIZE];
char onbuf[ISC_NETADDR_FORMATSIZE];
char ecsbuf[DNS_ECS_FORMATSIZE + sizeof(" [ECS ]") - 1] = { 0 };
char ednsbuf[sizeof("E(65535)")] = { 0 };
@@ -10862,8 +10862,8 @@ log_query(ns_client_t *client, unsigned int flags, unsigned int extflags) {
rdataset = ISC_LIST_HEAD(client->query.qname->list);
INSIST(rdataset != NULL);
dns_name_format(client->query.qname, namebuf, sizeof(namebuf));
dns_rdataclass_format(rdataset->rdclass, classname, sizeof(classname));
dns_rdatatype_format(rdataset->type, typename, sizeof(typename));
dns_rdataclass_format(rdataset->rdclass, classbuf, sizeof(classbuf));
dns_rdatatype_format(rdataset->type, typebuf, sizeof(typebuf));
isc_netaddr_format(&client->destaddr, onbuf, sizeof(onbuf));
if (client->ednsversion >= 0)
@@ -10878,7 +10878,7 @@ log_query(ns_client_t *client, unsigned int flags, unsigned int extflags) {
ns_client_log(client, NS_LOGCATEGORY_QUERIES, NS_LOGMODULE_QUERY,
level, "query: %s %s %s %s%s%s%s%s%s%s (%s)%s",
namebuf, classname, typename,
namebuf, classbuf, typebuf,
WANTRECURSION(client) ? "+" : "-",
(client->signer != NULL) ? "S" : "", ednsbuf,
TCP(client) ? "T" : "",
@@ -10891,8 +10891,8 @@ log_query(ns_client_t *client, unsigned int flags, unsigned int extflags) {
static inline void
log_queryerror(ns_client_t *client, isc_result_t result, int line, int level) {
char namebuf[DNS_NAME_FORMATSIZE];
char typename[DNS_RDATATYPE_FORMATSIZE];
char classname[DNS_RDATACLASS_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE];
char classbuf[DNS_RDATACLASS_FORMATSIZE];
const char *namep, *typep, *classp, *sep1, *sep2;
dns_rdataset_t *rdataset;
@@ -10914,12 +10914,12 @@ log_queryerror(ns_client_t *client, isc_result_t result, int line, int level) {
rdataset = ISC_LIST_HEAD(client->query.origqname->list);
if (rdataset != NULL) {
dns_rdataclass_format(rdataset->rdclass, classname,
sizeof(classname));
classp = classname;
dns_rdatatype_format(rdataset->type, typename,
sizeof(typename));
typep = typename;
dns_rdataclass_format(rdataset->rdclass, classbuf,
sizeof(classbuf));
classp = classbuf;
dns_rdatatype_format(rdataset->type, typebuf,
sizeof(typebuf));
typep = typebuf;
sep2 = "/";
}
}