Skip to content

Commit a252eda

Browse files
chore(deps): Bump trust-dns-proto from 0.22.0 to 0.23.0 (vectordotdev#18349)
* chore(deps): Bump trust-dns-proto from 0.22.0 to 0.23.0 Bumps [trust-dns-proto](https://github.com/bluejekyll/trust-dns) from 0.22.0 to 0.23.0. - [Release notes](https://github.com/bluejekyll/trust-dns/releases) - [Changelog](https://github.com/bluejekyll/trust-dns/blob/main/CHANGELOG.md) - [Commits](bluejekyll/trust-dns@v0.22.0...v0.23.0) --- updated-dependencies: - dependency-name: trust-dns-proto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Handle breaking changes Signed-off-by: Jesse Szwedko <[email protected]> * clippy Signed-off-by: Jesse Szwedko <[email protected]> * clippy Signed-off-by: Jesse Szwedko <[email protected]> * regenerate licenses Signed-off-by: Jesse Szwedko <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Jesse Szwedko <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jesse Szwedko <[email protected]>
1 parent 02c1b4c commit a252eda

File tree

6 files changed

+51
-57
lines changed

6 files changed

+51
-57
lines changed

Cargo.lock

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ tokio-postgres = { version = "0.7.10", default-features = false, features = ["ru
324324
tokio-tungstenite = {version = "0.20.0", default-features = false, features = ["connect"], optional = true}
325325
toml = { version = "0.7.6", default-features = false, features = ["parse", "display"] }
326326
tonic = { version = "0.9", optional = true, default-features = false, features = ["transport", "codegen", "prost", "tls", "tls-roots", "gzip"] }
327-
trust-dns-proto = { version = "0.22.0", default-features = false, features = ["dnssec"], optional = true }
327+
trust-dns-proto = { version = "0.23.0", default-features = false, features = ["dnssec"], optional = true }
328328
typetag = { version = "0.2.13", default-features = false }
329329
url = { version = "2.4.0", default-features = false, features = ["serde"] }
330330
uuid = { version = "1", default-features = false, features = ["serde", "v4"] }

LICENSE-3rdparty.csv

+1
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ tracing-subscriber,https://github.com/tokio-rs/tracing,MIT,"Eliza Weisman <eliza
569569
tracing-tower,https://github.com/tokio-rs/tracing,MIT,Eliza Weisman <[email protected]>
570570
treediff,https://github.com/Byron/treediff-rs,MIT OR Apache-2.0,Sebastian Thiel <[email protected]>
571571
trust-dns-proto,https://github.com/bluejekyll/trust-dns,MIT OR Apache-2.0,Benjamin Fry <[email protected]>
572+
trust-dns-proto,https://github.com/bluejekyll/trust-dns,MIT OR Apache-2.0,The contributors to Trust-DNS
572573
trust-dns-resolver,https://github.com/bluejekyll/trust-dns,MIT OR Apache-2.0,Benjamin Fry <[email protected]>
573574
try-lock,https://github.com/seanmonstar/try-lock,MIT,Sean McArthur <[email protected]>
574575
tungstenite,https://github.com/snapview/tungstenite-rs,MIT OR Apache-2.0,"Alexey Galakhov, Daniel Abramov"

lib/dnsmsg-parser/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "MIT"
99
[dependencies]
1010
data-encoding = "2.4"
1111
thiserror = "1.0"
12-
trust-dns-proto = { version = "0.22", features = ["dnssec"] }
12+
trust-dns-proto = { version = "0.23", features = ["dnssec"] }
1313

1414
[dev-dependencies]
1515
criterion = "0.5"

lib/dnsmsg-parser/benches/benches.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
use criterion::{criterion_group, criterion_main, BatchSize, Criterion, Throughput};
22
use data_encoding::BASE64;
33
use dnsmsg_parser::dns_message_parser::DnsMessageParser;
4-
use trust_dns_proto::{
5-
rr::rdata::null,
6-
serialize::binary::{BinDecoder, Restrict},
7-
};
4+
use trust_dns_proto::rr::rdata::NULL;
85

96
fn benchmark_parse_as_query_message(c: &mut Criterion) {
107
let raw_dns_message = "szgAAAABAAAAAAAAAmg1B2V4YW1wbGUDY29tAAAGAAE=";
@@ -64,8 +61,7 @@ fn benchmark_parse_apl_rdata(c: &mut Criterion) {
6461
fn benchmark_parse_rdata(c: &mut Criterion, data: &str, code: u16, id: &str) {
6562
let raw_rdata = BASE64.decode(data.as_bytes()).unwrap();
6663

67-
let mut decoder = BinDecoder::new(&raw_rdata);
68-
let record_rdata = null::read(&mut decoder, Restrict::new(raw_rdata.len() as u16)).unwrap();
64+
let record_rdata = NULL::with(raw_rdata.clone());
6965

7066
let mut group = c.benchmark_group("dnstap");
7167
group.throughput(Throughput::Bytes(raw_rdata.len() as u64));

lib/dnsmsg-parser/src/dns_message_parser.rs

+36-39
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ use trust_dns_proto::{
99
rr::{
1010
dnssec::{rdata::DNSSECRData, Algorithm, SupportedAlgorithms},
1111
rdata::{
12-
a, aaaa,
1312
caa::Value,
1413
opt::{EdnsCode, EdnsOption},
15-
NULL,
14+
A, AAAA, NULL,
1615
},
1716
record_data::RData,
1817
resource::Record,
@@ -69,7 +68,7 @@ impl DnsMessageParser {
6968
let msg = TrustDnsMessage::from_vec(&self.raw_message)
7069
.map_err(|source| DnsMessageParserError::TrustDnsError { source })?;
7170
let header = parse_dns_query_message_header(&msg);
72-
let edns_section = parse_edns(&msg);
71+
let edns_section = parse_edns(&msg).transpose()?;
7372
let rcode_high = edns_section.as_ref().map_or(0, |edns| edns.extended_rcode);
7473
let response_code = (u16::from(rcode_high) << 4) | ((u16::from(header.rcode)) & 0x000F);
7574

@@ -822,29 +821,32 @@ fn parse_dns_update_message_header(dns_message: &TrustDnsMessage) -> UpdateHeade
822821
}
823822
}
824823

825-
fn parse_edns(dns_message: &TrustDnsMessage) -> Option<OptPseudoSection> {
826-
dns_message
827-
.extensions()
828-
.as_ref()
829-
.map(|edns| OptPseudoSection {
824+
fn parse_edns(dns_message: &TrustDnsMessage) -> Option<DnsParserResult<OptPseudoSection>> {
825+
dns_message.extensions().as_ref().map(|edns| {
826+
parse_edns_options(edns).map(|options| OptPseudoSection {
830827
extended_rcode: edns.rcode_high(),
831828
version: edns.version(),
832829
dnssec_ok: edns.dnssec_ok(),
833830
udp_max_payload_size: edns.max_payload(),
834-
options: parse_edns_options(edns),
831+
options,
835832
})
833+
})
836834
}
837835

838-
fn parse_edns_options(edns: &Edns) -> Vec<EdnsOptionEntry> {
836+
fn parse_edns_options(edns: &Edns) -> DnsParserResult<Vec<EdnsOptionEntry>> {
839837
edns.options()
840838
.as_ref()
841839
.iter()
842840
.map(|(code, option)| match option {
843841
EdnsOption::DAU(algorithms)
844842
| EdnsOption::DHU(algorithms)
845-
| EdnsOption::N3U(algorithms) => parse_edns_opt_dnssec_algorithms(*code, *algorithms),
846-
EdnsOption::Unknown(_, opt_data) => parse_edns_opt(*code, opt_data),
847-
option => parse_edns_opt(*code, &Vec::<u8>::from(option)),
843+
| EdnsOption::N3U(algorithms) => {
844+
Ok(parse_edns_opt_dnssec_algorithms(*code, *algorithms))
845+
}
846+
EdnsOption::Unknown(_, opt_data) => Ok(parse_edns_opt(*code, opt_data)),
847+
option => Vec::<u8>::try_from(option)
848+
.map(|bytes| parse_edns_opt(*code, &bytes))
849+
.map_err(|source| DnsMessageParserError::TrustDnsError { source }),
848850
})
849851
.collect()
850852
}
@@ -983,13 +985,13 @@ fn parse_vec_with_u16_len(
983985
}
984986

985987
fn parse_ipv6_address(decoder: &mut BinDecoder<'_>) -> DnsParserResult<String> {
986-
Ok(aaaa::read(decoder)
988+
Ok(<AAAA as BinDecodable>::read(decoder)
987989
.map_err(|source| DnsMessageParserError::TrustDnsError { source })?
988990
.to_string())
989991
}
990992

991993
fn parse_ipv4_address(decoder: &mut BinDecoder<'_>) -> DnsParserResult<String> {
992-
Ok(a::read(decoder)
994+
Ok(<A as BinDecodable>::read(decoder)
993995
.map_err(|source| DnsMessageParserError::TrustDnsError { source })?
994996
.to_string())
995997
}
@@ -1111,25 +1113,21 @@ mod tests {
11111113
str::FromStr,
11121114
};
11131115

1114-
use trust_dns_proto::{
1115-
rr::{
1116-
dnssec::{
1117-
rdata::{
1118-
dnskey::DNSKEY, ds::DS, nsec::NSEC, nsec3::NSEC3, nsec3param::NSEC3PARAM,
1119-
sig::SIG, DNSSECRData,
1120-
},
1121-
Algorithm as DNSSEC_Algorithm, DigestType, Nsec3HashAlgorithm,
1122-
},
1123-
domain::Name,
1116+
use trust_dns_proto::rr::{
1117+
dnssec::{
11241118
rdata::{
1125-
caa::KeyValue,
1126-
null,
1127-
sshfp::{Algorithm, FingerprintType},
1128-
tlsa::{CertUsage, Matching, Selector},
1129-
CAA, NAPTR, SSHFP, TLSA, TXT,
1119+
dnskey::DNSKEY, ds::DS, nsec::NSEC, nsec3::NSEC3, nsec3param::NSEC3PARAM, sig::SIG,
1120+
DNSSECRData,
11301121
},
1122+
Algorithm as DNSSEC_Algorithm, DigestType, Nsec3HashAlgorithm,
1123+
},
1124+
domain::Name,
1125+
rdata::{
1126+
caa::KeyValue,
1127+
sshfp::{Algorithm, FingerprintType},
1128+
tlsa::{CertUsage, Matching, Selector},
1129+
CAA, NAPTR, SSHFP, TLSA, TXT,
11311130
},
1132-
serialize::binary::Restrict,
11331131
};
11341132

11351133
use super::*;
@@ -1284,7 +1282,7 @@ mod tests {
12841282

12851283
#[test]
12861284
fn test_format_rdata_for_a_type() {
1287-
let rdata = RData::A(Ipv4Addr::from_str("1.2.3.4").unwrap());
1285+
let rdata = RData::A(Ipv4Addr::from_str("1.2.3.4").unwrap().into());
12881286
let rdata_text = format_rdata(&rdata);
12891287
assert!(rdata_text.is_ok());
12901288
if let Ok((parsed, raw_rdata)) = rdata_text {
@@ -1295,7 +1293,7 @@ mod tests {
12951293

12961294
#[test]
12971295
fn test_format_rdata_for_aaaa_type() {
1298-
let rdata = RData::AAAA(Ipv6Addr::from_str("2001::1234").unwrap());
1296+
let rdata = RData::AAAA(Ipv6Addr::from_str("2001::1234").unwrap().into());
12991297
let rdata_text = format_rdata(&rdata);
13001298
assert!(rdata_text.is_ok());
13011299
if let Ok((parsed, raw_rdata)) = rdata_text {
@@ -1306,7 +1304,9 @@ mod tests {
13061304

13071305
#[test]
13081306
fn test_format_rdata_for_cname_type() {
1309-
let rdata = RData::CNAME(Name::from_str("www.example.com.").unwrap());
1307+
let rdata = RData::CNAME(trust_dns_proto::rr::rdata::CNAME(
1308+
Name::from_str("www.example.com.").unwrap(),
1309+
));
13101310
let rdata_text = format_rdata(&rdata);
13111311
assert!(rdata_text.is_ok());
13121312
if let Ok((parsed, raw_rdata)) = rdata_text {
@@ -1778,8 +1778,7 @@ mod tests {
17781778
let raw_rdata = BASE64
17791779
.decode(raw_data.as_bytes())
17801780
.expect("Invalid base64 encoded rdata.");
1781-
let mut decoder = BinDecoder::new(&raw_rdata);
1782-
let record_rdata = null::read(&mut decoder, Restrict::new(raw_rdata.len() as u16)).unwrap();
1781+
let record_rdata = NULL::with(raw_rdata);
17831782
let rdata_text =
17841783
DnsMessageParser::new(Vec::<u8>::new()).format_unknown_rdata(code, &record_rdata);
17851784
assert!(rdata_text.is_ok());
@@ -1801,9 +1800,7 @@ mod tests {
18011800
.decode(raw_data_encoded.as_bytes())
18021801
.expect("Invalid base64 encoded raw rdata.");
18031802
for i in 1..=2 {
1804-
let mut decoder = BinDecoder::new(&raw_rdata);
1805-
let record_rdata =
1806-
null::read(&mut decoder, Restrict::new(raw_rdata.len() as u16)).unwrap();
1803+
let record_rdata = NULL::with(raw_rdata.clone());
18071804
let rdata_text = message_parser.format_unknown_rdata(code, &record_rdata);
18081805
assert!(rdata_text.is_ok());
18091806
assert_eq!(expected_output, rdata_text.unwrap().0.unwrap());

0 commit comments

Comments
 (0)