RFC4035: test EDNS support
This commit is contained in:
parent
438af31340
commit
156e005ff2
|
@ -1,3 +1,4 @@
|
|||
//! DNSSEC functionality
|
||||
|
||||
mod rfc4035;
|
||||
mod scenarios;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
mod section_4;
|
|
@ -0,0 +1 @@
|
|||
mod section_4_1;
|
|
@ -0,0 +1,54 @@
|
|||
use dns_test::client::{Client, Dnssec, Recurse};
|
||||
use dns_test::name_server::NameServer;
|
||||
use dns_test::record::RecordType;
|
||||
use dns_test::tshark::{Capture, Direction};
|
||||
use dns_test::zone_file::Root;
|
||||
use dns_test::{Network, Resolver, Result, TrustAnchor, FQDN};
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn edns_support() -> Result<()> {
|
||||
let network = &Network::new()?;
|
||||
let ns = NameServer::new(FQDN::ROOT, network)?.start()?;
|
||||
let resolver = Resolver::start(
|
||||
dns_test::subject(),
|
||||
&[Root::new(ns.fqdn().clone(), ns.ipv4_addr())],
|
||||
&TrustAnchor::empty(),
|
||||
network,
|
||||
)?;
|
||||
|
||||
let mut tshark = resolver.eavesdrop()?;
|
||||
|
||||
let client = Client::new(network)?;
|
||||
let ans = client.dig(
|
||||
Recurse::Yes,
|
||||
Dnssec::Yes,
|
||||
resolver.ipv4_addr(),
|
||||
RecordType::SOA,
|
||||
&FQDN::ROOT,
|
||||
)?;
|
||||
assert!(ans.status.is_servfail());
|
||||
|
||||
tshark.wait_for_capture()?;
|
||||
|
||||
let captures = tshark.terminate()?;
|
||||
|
||||
let ns_addr = ns.ipv4_addr();
|
||||
for Capture { message, direction } in captures {
|
||||
if let Direction::Outgoing { destination } = direction {
|
||||
if destination == client.ipv4_addr() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// sanity check
|
||||
assert_eq!(ns_addr, destination);
|
||||
|
||||
if destination == ns_addr {
|
||||
assert_eq!(Some(true), message.is_do_bit_set());
|
||||
assert!(message.udp_payload_size().unwrap() >= 1220);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -237,6 +237,11 @@ impl DigStatus {
|
|||
pub fn is_nxdomain(&self) -> bool {
|
||||
matches!(self, Self::NXDOMAIN)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn is_servfail(&self) -> bool {
|
||||
matches!(self, Self::SERVFAIL)
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for DigStatus {
|
||||
|
|
Loading…
Reference in New Issue
Block a user