Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Servers should drop received DNS response messages. #381

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/net/server/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ where

match Message::from_octets(buf) {
Err(err) => {
// TO DO: Count this event?
tracing::warn!(
"Failed while parsing request message: {err}"
);
Expand All @@ -678,6 +679,15 @@ where
));
}

// https://datatracker.ietf.org/doc/html/rfc1035#section-4.1.1
// 4.1.1. Header section format
// "QR A one bit field that specifies whether this
// message is a query (0), or a response (1)."
Ok(msg) if msg.header().qr() => {
// TO DO: Count this event?
trace!("Ignoring received message because it is a reply, not a query.");
}

Ok(msg) => {
let ctx = NonUdpTransportContext::new(Some(
self.config.load().idle_timeout,
Expand Down
13 changes: 12 additions & 1 deletion src/net/server/dgram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,18 @@ where
tokio::spawn(async move {
match Message::from_octets(buf) {
Err(err) => {
tracing::warn!("Failed while parsing request message: {err}");
// TO DO: Count this event?
warn!("Failed while parsing request message: {err}");
}

// https://datatracker.ietf.org/doc/html/rfc1035#section-4.1.1
// 4.1.1. Header section format
// "QR A one bit field that specifies whether
// this message is a query (0), or a
// response (1)."
Ok(msg) if msg.header().qr() => {
// TO DO: Count this event?
trace!("Ignoring received message because it is a reply, not a query.");
}

Ok(msg) => {
Expand Down