Skip to content

Commit

Permalink
fix missed ntpv5 logic
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev authored and squell committed Dec 7, 2023
1 parent a5a590f commit fcade28
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ntp-proto/src/nts_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,9 @@ pub struct ClientToPoolDecoder {

records: Vec<NtsRecord>,
denied_servers: Vec<String>,

#[cfg(feature = "ntpv5")]
allow_v5: bool,
}

#[derive(Debug)]
Expand Down Expand Up @@ -1564,6 +1567,13 @@ impl ClientToPoolDecoder {
state.records.push(record);
Continue(state)
}
#[cfg(feature = "ntpv5")]
DraftId { data } => {
if data == crate::packet::v5::DRAFT_VERSION.as_bytes() {
state.allow_v5 = true;
}
Continue(state)
}
NextProtocol { protocol_ids } => {
#[cfg(feature = "ntpv5")]
let selected = if state.allow_v5 {
Expand Down Expand Up @@ -1634,6 +1644,9 @@ pub struct PoolToServerDecoder {

records: Vec<NtsRecord>,
supported_algorithms: Vec<(u16, u16)>,

#[cfg(feature = "ntpv5")]
allow_v5: bool,
}

#[derive(Debug)]
Expand Down Expand Up @@ -1695,6 +1708,13 @@ impl PoolToServerDecoder {
state.records.push(record);
Continue(state)
}
#[cfg(feature = "ntpv5")]
DraftId { data } => {
if data == crate::packet::v5::DRAFT_VERSION.as_bytes() {
state.allow_v5 = true;
}
Continue(state)
}
NextProtocol { protocol_ids } => {
#[cfg(feature = "ntpv5")]
let selected = if state.allow_v5 {
Expand Down

0 comments on commit fcade28

Please sign in to comment.