From 314741fcd01e76be92c5e3918c6fb72ee9cc9b0a Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Wed, 8 Jan 2025 20:13:34 -0800 Subject: [PATCH] deduplicate result codes ISCCC_R_SYNTAX, ISCCC_R_EXPIRED, and ISCCC_R_CLOCKSKEW have the same usage and text formats as DNS_R_SYNTAX, DNS_R_EXPIRED and DNS_R_CLOCKSCREW respectively. this was originally done because result codes were defined in separate libraries, and some tool might be linked with libisccc but not libdns. as the result codes are now defined in only one place, there's no need to retain the duplicates. --- bin/named/controlconf.c | 4 ++-- lib/isc/include/isc/result.h | 3 --- lib/isc/result.c | 6 ------ lib/isccc/cc.c | 2 +- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/bin/named/controlconf.c b/bin/named/controlconf.c index 1a96565bd9..bdf347157e 100644 --- a/bin/named/controlconf.c +++ b/bin/named/controlconf.c @@ -489,7 +489,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result, if ((sent + CLOCKSKEW) < conn->now || (sent - CLOCKSKEW) > conn->now) { - result = ISCCC_R_CLOCKSKEW; + result = DNS_R_CLOCKSKEW; goto cleanup; } } else { @@ -503,7 +503,7 @@ control_recvmessage(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result, if (isccc_cc_lookupuint32(conn->ctrl, "_exp", &exp) == ISC_R_SUCCESS && conn->now > exp) { - result = ISCCC_R_EXPIRED; + result = DNS_R_EXPIRED; goto cleanup; } diff --git a/lib/isc/include/isc/result.h b/lib/isc/include/isc/result.h index 734f742050..fa281b9549 100644 --- a/lib/isc/include/isc/result.h +++ b/lib/isc/include/isc/result.h @@ -248,10 +248,7 @@ typedef enum isc_result { DNS_R_BADCOOKIE = DNS_R_NOERROR + 23, ISCCC_R_UNKNOWNVERSION, - ISCCC_R_SYNTAX, ISCCC_R_BADAUTH, - ISCCC_R_EXPIRED, - ISCCC_R_CLOCKSKEW, ISCCC_R_DUPLICATE, ISCCC_R_MAXDEPTH, diff --git a/lib/isc/result.c b/lib/isc/result.c index 298689babc..67363786a2 100644 --- a/lib/isc/result.c +++ b/lib/isc/result.c @@ -248,10 +248,7 @@ static const char *description[ISC_R_NRESULTS] = { [DNS_R_BADCOOKIE] = "BADCOOKIE", [ISCCC_R_UNKNOWNVERSION] = "unknown version", - [ISCCC_R_SYNTAX] = "syntax error", [ISCCC_R_BADAUTH] = "bad auth", - [ISCCC_R_EXPIRED] = "expired", - [ISCCC_R_CLOCKSKEW] = "clock skew", [ISCCC_R_DUPLICATE] = "duplicate", [ISCCC_R_MAXDEPTH] = "max depth", }; @@ -482,10 +479,7 @@ static const char *identifier[ISC_R_NRESULTS] = { [DNS_R_BADCOOKIE] = "DNS_R_BADCOOKIE", [ISCCC_R_UNKNOWNVERSION] = "ISCCC_R_UNKNOWNVERSION", - [ISCCC_R_SYNTAX] = "ISCCC_R_SYNTAX", [ISCCC_R_BADAUTH] = "ISCCC_R_BADAUTH", - [ISCCC_R_EXPIRED] = "ISCCC_R_EXPIRED", - [ISCCC_R_CLOCKSKEW] = "ISCCC_R_CLOCKSKEW", [ISCCC_R_DUPLICATE] = "ISCCC_R_DUPLICATE", [ISCCC_R_MAXDEPTH] = "ISCCC_R_MAXDEPTH", }; diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c index 8bb50a616d..4323a54c6b 100644 --- a/lib/isccc/cc.c +++ b/lib/isccc/cc.c @@ -530,7 +530,7 @@ value_fromwire(isccc_region_t *source, unsigned int depth, } else if (msgtype == ISCCC_CCMSGTYPE_LIST) { result = list_fromwire(&active, depth + 1, valuep); } else { - result = ISCCC_R_SYNTAX; + result = DNS_R_SYNTAX; } return result;