mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-01 21:10:55 -05:00
Collapse common switch cases when emitting EDNS options
The CHAIN and REPORT-CHANNEL EDNS options are both domain names, so they can be combined. THE CLIENT-TAG and SERVER-TAG EDNS options are both 16 bit integers, so they can be combined.
This commit is contained in:
parent
6f3fea837f
commit
e7ef4e41eb
1 changed files with 2 additions and 42 deletions
|
|
@ -3766,6 +3766,7 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section,
|
|||
}
|
||||
break;
|
||||
case DNS_OPT_CHAIN:
|
||||
case DNS_OPT_REPORT_CHANNEL:
|
||||
if (optlen > 0U) {
|
||||
isc_buffer_t sb = optbuf;
|
||||
isc_buffer_setactive(&optbuf, optlen);
|
||||
|
|
@ -3822,14 +3823,6 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section,
|
|||
}
|
||||
break;
|
||||
case DNS_OPT_CLIENT_TAG:
|
||||
if (optlen == 2U) {
|
||||
uint16_t id =
|
||||
isc_buffer_getuint16(&optbuf);
|
||||
snprintf(buf, sizeof(buf), " %u\n", id);
|
||||
ADD_STRING(target, buf);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case DNS_OPT_SERVER_TAG:
|
||||
if (optlen == 2U) {
|
||||
uint16_t id =
|
||||
|
|
@ -3839,19 +3832,6 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section,
|
|||
continue;
|
||||
}
|
||||
break;
|
||||
case DNS_OPT_REPORT_CHANNEL:
|
||||
if (optlen > 0U) {
|
||||
isc_buffer_t sb = optbuf;
|
||||
isc_buffer_setactive(&optbuf, optlen);
|
||||
result = render_nameopt(&optbuf,
|
||||
target);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
ADD_STRING(target, "\n");
|
||||
continue;
|
||||
}
|
||||
optbuf = sb;
|
||||
}
|
||||
break;
|
||||
case DNS_OPT_ZONEVERSION:
|
||||
if (optlen >= 2U) {
|
||||
isc_buffer_t zonebuf = optbuf;
|
||||
|
|
@ -4195,6 +4175,7 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section,
|
|||
ADD_STRING(target, "\n");
|
||||
continue;
|
||||
case DNS_OPT_CHAIN:
|
||||
case DNS_OPT_REPORT_CHANNEL:
|
||||
if (optlen > 0U) {
|
||||
isc_buffer_t sb = optbuf;
|
||||
isc_buffer_setactive(&optbuf, optlen);
|
||||
|
|
@ -4255,14 +4236,6 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section,
|
|||
}
|
||||
break;
|
||||
case DNS_OPT_CLIENT_TAG:
|
||||
if (optlen == 2U) {
|
||||
uint16_t id =
|
||||
isc_buffer_getuint16(&optbuf);
|
||||
snprintf(buf, sizeof(buf), " %u\n", id);
|
||||
ADD_STRING(target, buf);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case DNS_OPT_SERVER_TAG:
|
||||
if (optlen == 2U) {
|
||||
uint16_t id =
|
||||
|
|
@ -4272,19 +4245,6 @@ dns_message_pseudosectiontotext(dns_message_t *msg, dns_pseudosection_t section,
|
|||
continue;
|
||||
}
|
||||
break;
|
||||
case DNS_OPT_REPORT_CHANNEL:
|
||||
if (optlen > 0U) {
|
||||
isc_buffer_t sb = optbuf;
|
||||
isc_buffer_setactive(&optbuf, optlen);
|
||||
result = render_nameopt(&optbuf,
|
||||
target);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
ADD_STRING(target, "\n");
|
||||
continue;
|
||||
}
|
||||
optbuf = sb;
|
||||
}
|
||||
break;
|
||||
case DNS_OPT_ZONEVERSION:
|
||||
if (optlen >= 2U) {
|
||||
isc_buffer_t zonebuf = optbuf;
|
||||
|
|
|
|||
Loading…
Reference in a new issue