[GH-ISSUE #745] Return an error instead of silently discarding non-parsable EDNS Options #286

Open
opened 2026-03-07 23:16:31 +03:00 by kerem · 1 comment
Owner

Originally created by @jonasbb on GitHub (Apr 9, 2019).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/745

Describe the bug
If parsing EDNS Option records fails in the code no error is returned. Instead you receive an empty list of options. The log message in the error path is not visible enough.

To Reproduce
Parse a record which triggers the codepath below, like the example in https://github.com/bluejekyll/trust-dns/pull/744

Expected behavior
I would expect the parsing to fail and return an error. Silently discarding the parsing error and returning an empty result is very confusing.

System:

  • OS: Fedora
  • Architecture: x86_64
  • Version 29
  • rustc version: rustc 1.35.0-nightly (bc44841ad 2019-03-14)

Version:
Crate: trust-dns-proto
Version: 0.7.1

Additional context
This is the problematic code. Instead of just logging the warning, I think it should return an error such that parsing fails.
github.com/bluejekyll/trust-dns@43632d54fd/crates/proto/src/rr/rdata/opt.rs (L251-L256)

Originally created by @jonasbb on GitHub (Apr 9, 2019). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/745 **Describe the bug** If parsing EDNS Option records fails in the code no error is returned. Instead you receive an empty list of options. The log message in the error path is not visible enough. **To Reproduce** Parse a record which triggers the codepath below, like the example in https://github.com/bluejekyll/trust-dns/pull/744 **Expected behavior** I would expect the parsing to fail and return an error. Silently discarding the parsing error and returning an empty result is very confusing. **System:** - OS: Fedora - Architecture: x86_64 - Version 29 - rustc version: rustc 1.35.0-nightly (bc44841ad 2019-03-14) **Version:** Crate: trust-dns-proto Version: 0.7.1 **Additional context** This is the problematic code. Instead of just logging the warning, I think it should return an error such that parsing fails. https://github.com/bluejekyll/trust-dns/blob/43632d54fda3b92abef8e374a519cc4ff34deea1/crates/proto/src/rr/rdata/opt.rs#L251-L256
Author
Owner

@bluejekyll commented on GitHub (Apr 9, 2019):

Hm, I can't remember why I wouldn't have returned an error in this case. I agree that it seems like it should return an error.

<!-- gh-comment-id:481226747 --> @bluejekyll commented on GitHub (Apr 9, 2019): Hm, I can't remember why I wouldn't have returned an error in this case. I agree that it seems like it should return an error.
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#286
No description provided.