]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check EDNS ZONEVERSION when parsing OPT record
authorMark Andrews <marka@isc.org>
Wed, 12 Jun 2024 06:23:05 +0000 (16:23 +1000)
committerMark Andrews <marka@isc.org>
Mon, 24 Mar 2025 22:16:09 +0000 (22:16 +0000)
lib/dns/include/dns/message.h
lib/dns/rdata/generic/opt_41.c

index a467ea447f45153fb097c89d98ca9982a7145f9a..178a809ef28c6bc1dd158b5734e387d93c6fd584 100644 (file)
 #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 */
  * 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)
index 5c81b1546cb86b3ffb872dc146a0e88fd50095a5..b52288dc9b02dd1c6073c2df7f016d3c37c9804e 100644 (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;