2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Check EDNS ZONEVERSION when parsing OPT record

This commit is contained in:
Mark Andrews
2024-06-12 16:23:05 +10:00
parent 687cbc99f4
commit b2c2b6755e
2 changed files with 16 additions and 2 deletions

View File

@@ -102,7 +102,6 @@
#define DNS_MESSAGEEXTFLAG_DO 0x8000U
/*%< EDNS0 extended OPT codes */
#define DNS_OPT_LLQ 1 /*%< LLQ opt code */
#define DNS_OPT_UL 2 /*%< UL opt code */
#define DNS_OPT_NSID 3 /*%< NSID opt code */
@@ -129,7 +128,7 @@
* options we know about. Extended DNS Errors may occur multiple times, see
* DNS_EDE_MAX_ERRORS.
*/
#define DNS_EDNSOPTIONS 8 + DNS_EDE_MAX_ERRORS
#define DNS_EDNSOPTIONS 9 + DNS_EDE_MAX_ERRORS
#define DNS_MESSAGE_REPLYPRESERVE (DNS_MESSAGEFLAG_RD | DNS_MESSAGEFLAG_CD)
#define DNS_MESSAGEEXTFLAG_REPLYPRESERVE (DNS_MESSAGEEXTFLAG_DO)

View File

@@ -266,6 +266,21 @@ fromwire_opt(ARGS_FROMWIRE) {
}
isc_region_consume(&sregion, length);
break;
case DNS_OPT_ZONEVERSION:
if (length == 0) {
/* Request */
break;
}
/* Labels and Type */
if (length < 2) {
return DNS_R_OPTERR;
}
/* Type 0 (serial), length is 6. */
if (sregion.base[1] == 0 && length != 6) {
return DNS_R_OPTERR;
}
isc_region_consume(&sregion, length);
break;
default:
isc_region_consume(&sregion, length);
break;