pub enum DnsParseError {
TooShort,
QdcountZero,
QdcountUnsupported(u16),
LabelOverflow,
NameOverflow,
CompressionRejected,
UnsupportedClass(u16),
InvalidLabelByte(u8),
}Expand description
Errors the parser can surface. Each maps to a reasonCode on the emitted
dns_query event:
DnsParseError::TooShort,DnsParseError::QdcountZero,DnsParseError::QdcountUnsupported,DnsParseError::LabelOverflow,DnsParseError::NameOverflow,DnsParseError::CompressionRejected,DnsParseError::UnsupportedClass,DnsParseError::InvalidLabelByte→malformed_query(proxy drops the packet — no response — matching common resolver behaviour against malformed input).
Variants§
TooShort
Packet smaller than the 12-byte header or truncated mid-question.
QdcountZero
Header QDCOUNT field was 0. A query with no questions is malformed —
there is nothing to evaluate against the allowlist. The
T2.B multi-question expansion accepts QDCOUNT >= 1; only the
degenerate zero case is now refused at the parser layer.
QdcountUnsupported(u16)
Header QDCOUNT was greater than 1 on the hot-path single-question
API. HIGH-D1 closed the policy-bypass / log-evasion gap that arose
from “parse FIRST question, forward all bytes verbatim”: a hostile
guest could craft a [allowed.example.com, attacker.tld] packet,
pass the allowlist on Q1, and have Q2 silently resolved by the
upstream resolver. The supervisor’s contract is one allow-listed
query in, one logged event out — so the parser now refuses any
QDCOUNT != 1 on the proxy path. Tools that need multi-question
inspection should use parse_query_multi.
LabelOverflow
A QNAME label exceeded the RFC 1035 63-octet maximum.
NameOverflow
Total QNAME length exceeded the RFC 1035 253-octet maximum.
CompressionRejected
Encountered a pointer-compressed label in a query QNAME — the parser rejects these as a defense against adversarial inputs.
UnsupportedClass(u16)
qclass was not IN (1). The parser only forwards Internet-class queries.
InvalidLabelByte(u8)
Label byte fell outside RFC 1035’s preferred ASCII set.
Trait Implementations§
Source§impl Debug for DnsParseError
impl Debug for DnsParseError
Source§impl Display for DnsParseError
impl Display for DnsParseError
Source§impl Error for DnsParseError
impl Error for DnsParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for DnsParseError
impl PartialEq for DnsParseError
Source§fn eq(&self, other: &DnsParseError) -> bool
fn eq(&self, other: &DnsParseError) -> bool
self and other values to be equal, and is used by ==.impl Eq for DnsParseError
impl StructuralPartialEq for DnsParseError
Auto Trait Implementations§
impl Freeze for DnsParseError
impl RefUnwindSafe for DnsParseError
impl Send for DnsParseError
impl Sync for DnsParseError
impl Unpin for DnsParseError
impl UnsafeUnpin for DnsParseError
impl UnwindSafe for DnsParseError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.