Commit f0c00f10 authored by Mark Andrews's avatar Mark Andrews
Browse files

report if sit is good/bad

parent 51d6d7ee
......@@ -3270,7 +3270,9 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
#ifdef ISC_PLATFORM_USESIT
static void
process_sit(dig_lookup_t *l, isc_buffer_t *optbuf, size_t optlen) {
process_sit(dig_lookup_t *l, dns_message_t *msg,
isc_buffer_t *optbuf, size_t optlen)
{
char bb[256];
isc_buffer_t hexbuf;
size_t len;
......@@ -3290,21 +3292,25 @@ process_sit(dig_lookup_t *l, isc_buffer_t *optbuf, size_t optlen) {
if (optlen >= len && optlen >= 8U) {
if (memcmp(isc_buffer_current(optbuf), sit, 8) == 0) {
if (l->comments)
printf(";; SIT client cookie part match\n");
} else
msg->sitok = 1;
} else {
printf(";; Warning: SIT client cookie part mis-match\n");
} else
msg->sitbad = 1;
}
} else {
printf(";; Warning: SIT bad token (too short)\n");
msg->sitbad = 1;
}
isc_buffer_forward(optbuf, (unsigned int)optlen);
}
static void
process_opt(dig_lookup_t *l, dns_rdataset_t *opt) {
process_opt(dig_lookup_t *l, dns_message_t *msg) {
dns_rdata_t rdata;
isc_result_t result;
isc_buffer_t optbuf;
isc_uint16_t optcode, optlen;
dns_rdataset_t *opt = msg->opt;
result = dns_rdataset_first(opt);
if (result == ISC_R_SUCCESS) {
......@@ -3317,7 +3323,7 @@ process_opt(dig_lookup_t *l, dns_rdataset_t *opt) {
optlen = isc_buffer_getuint16(&optbuf);
switch (optcode) {
case DNS_OPT_SIT:
process_sit(l, &optbuf, optlen);
process_sit(l, msg, &optbuf, optlen);
break;
default:
isc_buffer_forward(&optbuf, optlen);
......@@ -3695,9 +3701,9 @@ recv_done(isc_task_t *task, isc_event_t *event) {
if (msg->opt == NULL)
printf(";; expected opt record in response\n");
else
process_opt(l, msg->opt);
process_opt(l, msg);
} else if (l->sit && msg->opt != NULL)
process_opt(l, msg->opt);
process_opt(l, msg);
#endif
if (!l->doing_xfr || l->xfr_q == query) {
......
......@@ -218,6 +218,8 @@ struct dns_message {
unsigned int verify_attempted : 1;
unsigned int free_query : 1;
unsigned int free_saved : 1;
unsigned int sitok : 1;
unsigned int sitbad : 1;
unsigned int opt_reserved;
unsigned int sig_reserved;
......
......@@ -437,6 +437,8 @@ msginit(dns_message_t *m) {
m->saved.base = NULL;
m->saved.length = 0;
m->free_saved = 0;
m->sitok = 0;
m->sitbad = 0;
m->querytsig = NULL;
}
......@@ -485,6 +487,8 @@ msgresetopt(dns_message_t *msg)
dns_rdataset_disassociate(msg->opt);
isc_mempool_put(msg->rdspool, msg->opt);
msg->opt = NULL;
msg->sitok = 0;
msg->sitbad = 0;
}
}
......@@ -3342,6 +3346,10 @@ dns_message_pseudosectiontotext(dns_message_t *msg,
isc_buffer_forward(&optbuf, optlen);
if (optcode == DNS_OPT_SIT) {
if (msg->sitok)
ADD_STRING(target, " (good)");
if (msg->sitbad)
ADD_STRING(target, " (bad)");
ADD_STRING(target, "\n");
continue;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment