瀏覽代碼

dns: Failure if no addresses are received

Emil Fresk 3 年之前
父節點
當前提交
5aff1c257a
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 1 1
      Cargo.toml
  2. 4 0
      src/socket/dns.rs

+ 1 - 1
Cargo.toml

@@ -23,7 +23,7 @@ libc = { version = "0.2.18", optional = true }
 bitflags = { version = "1.0", default-features = false }
 defmt = { version = "0.3", optional = true }
 cfg-if = "1.0.0"
-heapless = "0.7.7"
+heapless = "0.7.8"
 
 [dev-dependencies]
 env_logger = "0.9"

+ 4 - 0
src/socket/dns.rs

@@ -245,6 +245,7 @@ impl<'a> DnsSocket<'a> {
                     net_trace!("question type mismatch");
                     return Err(Error::Malformed);
                 }
+
                 if !eq_names(p.parse_name(question.name), p.parse_name(&pq.name))? {
                     net_trace!("question name mismatch");
                     return Err(Error::Malformed);
@@ -295,7 +296,10 @@ impl<'a> DnsSocket<'a> {
 
                 if !addresses.is_empty() {
                     q.state = State::Completed(CompletedQuery { addresses })
+                } else {
+                    q.state = State::Failure;
                 }
+
                 // If we get here, packet matched the current query, stop processing.
                 return Ok(());
             }