mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #2211] should proto::rr::resource::Record.rdata really be an Option? #924
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#924
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @japaric on GitHub (May 14, 2024).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2211
take for example the concrete type
Record<RRSIG>, under what circumstances would itsrdatafield beNone? To me that seems like a malformed / invalid value. if the type of therdatais known then that.rdatafield ought to be populatedIn my mind, the representation of
Recordshould be:The
record_typegetter should defer the work toself.rdata.record_typeThe
set_record_typemethod should not exist.The
set_datamethod should take anRvalue instead of anOption<R>. itsdebug_assertionbecomes unnecessary becauseset_record_typedoes not exist.All this works fine in presence of the
RDataenum. Replacing therdatawith a different record-type data causes the output of therecord_typegetter to be automatically updated:For unknown / unsupported record types the
rdatacan be represented as a buffer of bytes as they appear on the wire. the wire-level representation of a record contains aRDLENGTHfield that indicates how long the followingRDATAfield is. the existingRData::Unknownvariant already does that.am I missing something? is
Record.rdata = Nonebeing used in practice?@djc commented on GitHub (May 14, 2024):
This sounds reasonable to me. This might be an oversight from when we migrated to the generically-typed
RDatasetup, or it might be necessary in some contexts to take out therdatavalue without having ownership of theRecord? I think staging an attempt at simplifying here would be helpful. (@bluejekyll might have more context, but might also take longer to respond...)@bluejekyll commented on GitHub (May 14, 2024):
There are some cases where the RDATA is unspecified yet the record-type is. This happens in the dns update sections of the code. That’s mostly why it ended up being Option.
I couldn’t figure out an elegant way to deal with that case.
@japaric commented on GitHub (May 15, 2024):
by "unspecified" do you mean that the RDATA contents do not match what's specified in the record-type header field or may even be completely absent? can that unspecified state be serialized / deserialized into wire format (bytes)? or is it a state that's limited to e.g. the construction / build stage of a resource record?
if the state is limited to a section of the code, we could have two
Recordtypes, a specified one and an unspecified one, that share a lot of code save for the RDATA getter / setter.if you could point out where in code the unspecified state happens, that would help me better understand how it's being used
@japaric commented on GitHub (May 15, 2024):
I found the relevant code in
crates/proto/op/update_message.rswhich implements RFC2136 (DNS update). After some initial sketching I think I'm leaning towards creating a separateUpdateRecord, which accepts anOption-al.rdatafield, and a separateUpdateMessage, which better aligns with the DNS message structure described in RFC2136 (section 2); and then dedicating the existingRecord, tweaked to have a non-Option-al.rdatafield, andMessageto QUERY-like logic (RFC1035).Furthermore, RFC4033 states that "The DNS security extensions provide data and origin authentication for DNS data. The mechanisms outlined above are not designed to protect operations such as zone transfers and dynamic update (RFC2136, RFC3007)" so I think it makes sense to not overload the
Messagestruct, which can include DNSSEC signatures, with DNS update functionality, which is unrelated to DNSSEC.@djc commented on GitHub (May 15, 2024):
Strong 👍 from me!
@bluejekyll commented on GitHub (May 15, 2024):
I’ve tried to go down this route in the past. I’m open to see where your investigation leads. There are a lot of areas of the code that rely on Message and Record, so it might end up being a large change.