Skip to content
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
4 changes: 4 additions & 0 deletions changelog.d/25495_dnstap_parser_doq_support.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Added support for DOQ socket protocol in dnstap source. This will prevent error messages when DOQ
traffic is encountered.

authors: esensar Quad9DNS
23 changes: 5 additions & 18 deletions lib/vector-vrl/dnstap-parser/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1009,23 +1009,9 @@ fn to_socket_family_name(socket_family: i32) -> Result<&'static str> {
}

fn to_socket_protocol_name(socket_protocol: i32) -> Result<&'static str> {
if socket_protocol == SocketProtocol::Udp as i32 {
Ok("UDP")
} else if socket_protocol == SocketProtocol::Tcp as i32 {
Ok("TCP")
} else if socket_protocol == SocketProtocol::Dot as i32 {
Ok("DOT")
} else if socket_protocol == SocketProtocol::Doh as i32 {
Ok("DOH")
} else if socket_protocol == SocketProtocol::DnsCryptUdp as i32 {
Ok("DNSCryptUDP")
} else if socket_protocol == SocketProtocol::DnsCryptTcp as i32 {
Ok("DNSCryptTCP")
} else {
Err(Error::from(format!(
"Unknown socket protocol: {socket_protocol}"
)))
}
SocketProtocol::try_from(socket_protocol)
.map_err(|_| Error::from(format!("Unknown socket protocol: {socket_protocol}")))
.map(|sp| sp.as_str_name())
}

fn to_dnstap_data_type(data_type_id: i32) -> Option<String> {
Expand Down Expand Up @@ -1449,6 +1435,7 @@ mod tests {
assert_eq!("DOH", to_socket_protocol_name(4).unwrap());
assert_eq!("DNSCryptUDP", to_socket_protocol_name(5).unwrap());
assert_eq!("DNSCryptTCP", to_socket_protocol_name(6).unwrap());
assert!(to_socket_protocol_name(7).is_err());
assert_eq!("DOQ", to_socket_protocol_name(7).unwrap());
assert!(to_socket_protocol_name(8).is_err());
}
}
Loading