2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-30 22:05:23 +00:00

Primarly fix the trace code. This was broken during the modfictions of the

DDNS code to use the bind libraries.  This patch fixes that breakage and
includes support for the new DDNS code.  This patch also deletes some dead
code and neatens up some log messages.
This commit is contained in:
Shawn Routhier
2010-02-11 23:55:36 +00:00
parent fdfebedf3e
commit 7aa153b882
12 changed files with 380 additions and 828 deletions

View File

@@ -1208,254 +1208,10 @@ void indent_spaces (FILE *file, int indent)
}
#if defined (NSUPDATE)
#if 0
void print_dns_status (int status, ns_updque *uq)
{
char obuf [1024];
char *s = &obuf [0], *end = &obuf [1022];
ns_updrec *u;
int position;
int ttlp;
const char *predicate = "if", *en, *op;
int errorp;
for (u = ISC_LIST_HEAD (*uq); u; u = ISC_LIST_NEXT (u, r_link)) {
ttlp = 0;
switch (u -> r_opcode)
{
case NXRRSET:
op = "rrset doesn't exist";
position = 1;
break;
case YXRRSET:
op = "rrset exists";
position = 1;
break;
case NXDOMAIN:
op = "domain doesn't exist";
position = 1;
break;
case YXDOMAIN:
op = "domain exists";
position = 1;
break;
case ADD:
op = "add";
position = 0;
ttlp = 1;
break;
case DELETE:
op = "delete";
position = 0;
break;
default:
op = "unknown";
position = 0;
break;
}
if (!position) {
if (s != &obuf [0] && s + 1 < end)
*s++ = ' ';
if (s + strlen (op) < end) {
strcpy (s, op);
s += strlen (s);
}
} else {
if (s != &obuf [0] && s + 1 < end)
*s++ = ' ';
if (s + strlen (predicate) < end) {
strcpy (s, predicate);
s += strlen (s);
}
predicate = "and";
}
if (u -> r_dname) {
if (s + 1 < end)
*s++ = ' ';
if (s + strlen (u -> r_dname) < end) {
strcpy (s, u -> r_dname);
s += strlen (s);
}
}
if (ttlp) {
if (s + 1 < end)
*s++ = ' ';
/* 27 is as big as a ttl can get. */
if (s + 27 < end) {
sprintf (s, "%lu",
(unsigned long)(u -> r_ttl));
s += strlen (s);
}
}
switch (u -> r_class) {
case C_IN:
en = "IN";
break;
case C_CHAOS:
en = "CHAOS";
break;
case C_HS:
en = "HS";
break;
default:
en = "UNKNOWN";
break;
}
if (s + strlen (en) < end) {
if (s + 1 < end)
*s++ = ' ';
strcpy (s, en);
s += strlen (en);
}
switch (u -> r_type) {
case T_A:
en = "A";
break;
case T_AAAA:
en = "AAAA";
break;
case T_PTR:
en = "PTR";
break;
case T_MX:
en = "MX";
break;
case T_TXT:
en = "TXT";
break;
case T_KEY:
en = "KEY";
break;
case T_CNAME:
en = "CNAME";
break;
default:
en = "UNKNOWN";
break;
}
if (s + strlen (en) < end) {
if (s + 1 < end)
*s++ = ' ';
strcpy (s, en);
s += strlen (en);
}
if (u -> r_data) {
if (s + 1 < end)
*s++ = ' ';
if (u -> r_type == T_TXT) {
if (s + 1 < end)
*s++ = '"';
}
if(u->r_type == T_KEY) {
strcat(s, "<keydata>");
s+=strlen("<keydata>");
}
else {
if (s + u -> r_size < end) {
memcpy (s, u -> r_data, u -> r_size);
s += u -> r_size;
if (u -> r_type == T_TXT) {
if (s + 1 < end)
*s++ = '"';
}
}
}
}
if (position) {
if (s + 1 < end)
*s++ = ' ';
if (s + strlen (op) < end) {
strcpy (s, op);
s += strlen (s);
}
}
if (u == ISC_LIST_TAIL (*uq))
break;
}
if (s == &obuf [0]) {
strcpy (s, "empty update");
s += strlen (s);
}
if (status == NOERROR)
errorp = 0;
else
errorp = 1;
en = isc_result_totext (status);
#if 0
switch (status) {
case -1:
en = "resolver failed";
break;
case FORMERR:
en = "format error";
break;
case NOERROR:
en = "succeeded";
errorp = 0;
break;
case NOTAUTH:
en = "not authorized";
break;
case NOTIMP:
en = "not implemented";
break;
case NOTZONE:
en = "not a single valid zone";
break;
case NXDOMAIN:
en = "no such domain";
break;
case NXRRSET:
en = "no such record";
break;
case REFUSED:
en = "refused";
break;
case SERVFAIL:
en = "server failed";
break;
case YXDOMAIN:
en = "domain exists";
break;
case YXRRSET:
en = "record exists";
break;
default:
en = "unknown error";
break;
}
#endif
if (s + 2 < end) {
*s++ = ':';
*s++ = ' ';
}
if (s + strlen (en) < end) {
strcpy (s, en);
s += strlen (en);
}
if (s + 1 < end)
*s++ = '.';
*s++ = 0;
if (errorp)
log_error ("%s", obuf);
else
log_info ("%s", obuf);
}
#endif
/*
* Place holder for debug information for ddns.
*
*/
#endif /* NSUPDATE */
/* Format the given time as "A; # B", where A is the format