[GH-ISSUE #1142] Support mDNS cache-flush bit #613

Closed
opened 2026-03-15 23:27:42 +03:00 by kerem · 2 comments
Owner

Originally created by @fluxxu on GitHub (Jun 20, 2020).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1142

I am trying to use trust-dns's types to manually deserialize some mDNS messages. It seems that currently, the BinDecodable of Record doesn't handle cache-flush bit(https://tools.ietf.org/html/rfc6762#section-10.2). It this bit is set, the deserialize will fail with DNS class value unknown: 32769 (DNSClass::IN with cache-flush bit set).

I tried to make a PR for this. But I'm not sure what is the correct way to do it. I can detect this bit in impl BinDecodable of Record but this bit only relevant to mDNS record. Or maybe I can change DNSClass::from_u16 to decode all unknown value as DNSClass::OPT. 😵

Originally created by @fluxxu on GitHub (Jun 20, 2020). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1142 I am trying to use trust-dns's types to manually deserialize some mDNS messages. It seems that currently, the BinDecodable of Record doesn't handle cache-flush bit(https://tools.ietf.org/html/rfc6762#section-10.2). It this bit is set, the deserialize will fail with DNS class value unknown: 32769 (DNSClass::IN with cache-flush bit set). I tried to make a PR for this. But I'm not sure what is the correct way to do it. I can detect this bit in `impl BinDecodable` of `Record` but this bit only relevant to mDNS record. Or maybe I can change `DNSClass::from_u16` to decode all unknown value as `DNSClass::OPT`. 😵
kerem 2026-03-15 23:27:42 +03:00
Author
Owner

@bluejekyll commented on GitHub (Jun 21, 2020):

I can't find the value 32769 referenced anywhere in the documentation. Not sure why I'm missing it.

In terms of support we should add the DNSClass enum, CacheFlush (open to other names, like MdnsCacheFlush), and document that this should only be used in the context of an mDNS request.

I think that seems like the correct thing to do, based on the docs.

The feature flag #cfg(feature = "mdns") is available in the proto crate, and this can be used to enable/disable the enum field, only allowing it with mDNS enabled.

<!-- gh-comment-id:647072518 --> @bluejekyll commented on GitHub (Jun 21, 2020): I can't find the value `32769` referenced anywhere in the documentation. Not sure why I'm missing it. In terms of support we should add the `DNSClass` enum, `CacheFlush` (open to other names, like `MdnsCacheFlush`), and document that this should only be used in the context of an mDNS request. I think that seems like the correct thing to do, based on the docs. The feature flag `#cfg(feature = "mdns")` is available in the proto crate, and this can be used to enable/disable the enum field, only allowing it with mDNS enabled.
Author
Owner

@fluxxu commented on GitHub (Jun 21, 2020):

I can't find the value 32769 referenced anywhere in the documentation. Not sure why I'm missing it.

You can search 0x8001 then there is a paragraph about this value:

   Note that the cache-flush bit is NOT part of the resource record
   class.  The cache-flush bit is the most significant bit of the second
   16-bit word of a resource record in a Resource Record Section of a
   Multicast DNS message (the field conventionally referred to as the
   rrclass field), and the actual resource record class is the least
   significant fifteen bits of this field.  There is no Multicast DNS
   resource record class 0x8001.  The value 0x8001 in the rrclass field
   of a resource record in a Multicast DNS response message indicates a
   resource record with class 1, with the cache-flush bit set.  When
   receiving a resource record with the cache-flush bit set,
   implementations should take care to mask off that bit before storing
   the resource record in memory, or otherwise ensure that it is given
   the correct semantic interpretation.

PR submitted
https://github.com/bluejekyll/trust-dns/pull/1144
Thanks!

<!-- gh-comment-id:647083839 --> @fluxxu commented on GitHub (Jun 21, 2020): >I can't find the value 32769 referenced anywhere in the documentation. Not sure why I'm missing it. You can search `0x8001` then there is a paragraph about this value: ``` Note that the cache-flush bit is NOT part of the resource record class. The cache-flush bit is the most significant bit of the second 16-bit word of a resource record in a Resource Record Section of a Multicast DNS message (the field conventionally referred to as the rrclass field), and the actual resource record class is the least significant fifteen bits of this field. There is no Multicast DNS resource record class 0x8001. The value 0x8001 in the rrclass field of a resource record in a Multicast DNS response message indicates a resource record with class 1, with the cache-flush bit set. When receiving a resource record with the cache-flush bit set, implementations should take care to mask off that bit before storing the resource record in memory, or otherwise ensure that it is given the correct semantic interpretation. ``` PR submitted https://github.com/bluejekyll/trust-dns/pull/1144 Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#613
No description provided.