Skip to main content

asterust_junos/system/services/dhcp_local_server/
options.rs

1//! The statements shared by every level of a DHCP local server: the server itself, `dhcpv6`, a group,
2//! an interface and a dual-stack group.
3//!
4//! # See also
5//!
6//! - [authentication (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/authentication-edit-system-services.html)
7//! - [username-include (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/username-include-edit-system-services.html)
8//! - [password (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/password-edit-system-services.html)
9//! - [allow-leasequery (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/allow-leasequery-edit-system-services-dhcp-.html)
10//! - [allow-bulk-leasequery (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/allow-bulk-leasequery-edit-system-services-dhcp-.html)
11//! - [allow-active-leasequery (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/allow-active-leasequery-edit-system-services-dhcp.html)
12//! - [active-leasequery (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/dhcp-local-server-active-leasequery.html)
13//! - [active-fingerprint-server-group (DHCP Local Server and DHCP Relay Groups)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/active-fingerprint-server-group-edit-system-services-dhcp-local-server-group.html)
14//! - [fingerprint-server-group (DHCPv4)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/fingerprint-server-group-edit-system-services-dhcp-local-server.html)
15//! - [fingerprint-server-group (DHCPv6)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/fingerprint-server-group-edit-system-services-dhcp-local-server-dhcpv6.html)
16//! - [dynamic-profile (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/dynamic-profile-edit-system-services.html)
17//! - [service-profile (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/service-profile-edit-system-services.html)
18//! - [duplicate-clients (DHCPv6 Local Server and Relay Agent)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/duplicate-clients-edit-dhcp.html)
19//! - [duplicate-clients-in-subnet](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/duplicate-clients-in-subnet-edit-forwarding-options.html)
20//! - [forward-snooped-clients (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/forward-snooped-clients-edit-system-services.html)
21//! - [lease-time-validation](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/lease-time-validation-edit-dhcp.html)
22//! - [liveness-detection](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/liveness-detection-edit-dhcp.html)
23//! - [bfd (DHCP liveness detection)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/bfd-edit-dhcp-liveness-detection-method.html)
24//! - [layer2-liveness-detection (Send)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/layer2-liveness-detection-edit-dhcp.html)
25//! - [no-snoop](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/no-snoop-edit-dhcp.html)
26//! - [pool-match-order](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/pool-match-order-edit-system-services.html)
27//! - [reauthenticate (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/system-services-dhcp-local-server-reauthenticate.html)
28//! - [reconfigure (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/reconfigure-edit-dhcp-local-server.html)
29//! - [remote-id-mismatch](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/remote-id-mismatch-edit-dhcp.html)
30//! - [requested-ip-network-match (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/requested-ip-network-match-edit-system-services.html)
31//! - [route-suppression](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/route-suppression-edit-dhcp.html)
32//! - [short-cycle-protection](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/short-cycle-protection-edit-dhcp-local-server-relay-agent.html)
33//! - [server-duid-type (DHCP Local Server)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/server-duid-type-edit-system-services.html)
34//! - [dynamic-server](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/dynamic-server.html)
35//! - [interface-traceoptions (System Services DHCP)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/system-edit-interface-traceoptions-dhcp-local-server.html)
36
37use super::overrides::{parse_overrides, DhcpOverrides};
38use crate::protocols::traceoptions::{parse_named_traceoptions, Traceoptions};
39use crate::{
40    active_children, arg_of, args_of, child_block, has_leaf, list_values, named_children, secret_value,
41    statement_words, statements, value_after, Secret,
42};
43use asterust::config::ConfigLine;
44
45/// The `username-include` block of a DHCP `authentication`: what is concatenated into the username.
46#[derive(Clone, Debug, Default, PartialEq, Eq)]
47#[non_exhaustive]
48pub struct DhcpUsernameInclude {
49    pub circuit_type: bool,
50    pub client_id: bool,
51    pub client_id_exclude_headers: bool,
52    pub client_id_use_automatic_ascii_hex_encoding: bool,
53    pub delimiter: Option<String>,
54    pub domain_name: Option<String>,
55    /// `device-interface` or `logical-interface`.
56    pub interface_description: Option<String>,
57    pub interface_name: bool,
58    pub logical_system_name: bool,
59    pub mac_address: bool,
60    pub option_60: bool,
61    pub option_82: bool,
62    pub option_82_circuit_id: bool,
63    pub option_82_remote_id: bool,
64    pub relay_agent_interface_id: bool,
65    pub relay_agent_remote_id: bool,
66    pub relay_agent_subscriber_id: bool,
67    pub routing_instance_name: bool,
68    pub user_prefix: Option<String>,
69    pub vlan_tags: bool,
70}
71
72/// The `authentication` block. The `password` is read only with the `secrets` feature.
73#[derive(Clone, Debug, PartialEq, Eq)]
74#[non_exhaustive]
75pub struct DhcpAuthentication {
76    /// `None` unless the `secrets` feature is enabled.
77    pub password: Option<Secret>,
78    pub username_include: Option<DhcpUsernameInclude>,
79}
80
81/// `allow-active-leasequery`.
82#[derive(Clone, Debug, PartialEq, Eq)]
83#[non_exhaustive]
84pub struct DhcpActiveLeasequeryLimits {
85    pub idle_timeout: Option<String>,
86    pub timeout: Option<String>,
87}
88
89/// `allow-bulk-leasequery`.
90#[derive(Clone, Debug, PartialEq, Eq)]
91#[non_exhaustive]
92pub struct DhcpBulkLeasequery {
93    pub max_connections: Option<String>,
94    pub max_empty_replies: Option<String>,
95    pub restricted_requestor: bool,
96    pub timeout: Option<String>,
97}
98
99/// `active-leasequery`.
100#[derive(Clone, Debug, PartialEq, Eq)]
101#[non_exhaustive]
102pub struct DhcpActiveLeasequery {
103    pub peer_addresses: Vec<String>,
104    pub timeout: Option<String>,
105    pub idle_timeout: Option<String>,
106    pub exclude_interfaces: Vec<String>,
107}
108
109/// An `address` of a fingerprint server group.
110#[derive(Clone, Debug, PartialEq, Eq)]
111#[non_exhaustive]
112pub struct DhcpFingerprintServer {
113    pub address: String,
114    pub logical_system: Option<String>,
115    pub routing_instance: Option<String>,
116}
117
118/// A group of `fingerprint-server-group`.
119#[derive(Clone, Debug, PartialEq, Eq)]
120#[non_exhaustive]
121pub struct DhcpFingerprintServerGroup {
122    pub name: String,
123    pub servers: Vec<DhcpFingerprintServer>,
124}
125
126/// A `dynamic-profile <name>`.
127#[derive(Clone, Debug, PartialEq, Eq)]
128#[non_exhaustive]
129pub struct DhcpDynamicProfile {
130    pub name: String,
131    /// `merge` or `replace`.
132    pub aggregate_clients: Option<String>,
133    pub use_primary: Option<String>,
134}
135
136/// `lease-time-validation`.
137#[derive(Clone, Debug, PartialEq, Eq)]
138#[non_exhaustive]
139pub struct DhcpLeaseTimeValidation {
140    pub lease_time_threshold: Option<String>,
141    pub violation_action: Option<String>,
142}
143
144/// The `bfd` method of `liveness-detection`.
145#[derive(Clone, Debug, Default, PartialEq, Eq)]
146#[non_exhaustive]
147pub struct DhcpBfd {
148    /// `0`, `1` or `automatic`.
149    pub version: Option<String>,
150    pub minimum_interval: Option<String>,
151    pub minimum_receive_interval: Option<String>,
152    pub multiplier: Option<String>,
153    pub no_adaptation: bool,
154    pub transmit_interval_minimum_interval: Option<String>,
155    pub transmit_interval_threshold: Option<String>,
156    pub detection_time_threshold: Option<String>,
157    /// `automatic`, `multihop` or `singlehop`.
158    pub session_mode: Option<String>,
159    pub holddown_interval: Option<String>,
160}
161
162/// `liveness-detection`.
163#[derive(Clone, Debug, PartialEq, Eq)]
164#[non_exhaustive]
165pub struct DhcpLivenessDetection {
166    /// `clear-binding`, `clear-binding-if-interface-up` or `log-only`.
167    pub failure_action: Option<String>,
168    pub bfd: Option<DhcpBfd>,
169    /// From `layer2-liveness-detection { max-consecutive-retries }`.
170    pub layer2_max_consecutive_retries: Option<String>,
171    /// From `layer2-liveness-detection { transmit-interval }`.
172    pub layer2_transmit_interval: Option<String>,
173    /// `layer2-liveness-detection` is configured.
174    pub layer2: bool,
175}
176
177/// `reconfigure`.
178#[derive(Clone, Debug, PartialEq, Eq)]
179#[non_exhaustive]
180pub struct DhcpReconfigure {
181    pub attempts: Option<String>,
182    pub clear_on_abort: bool,
183    pub clear_on_terminate: bool,
184    pub strict: bool,
185    pub support_option_pd_exclude: bool,
186    pub timeout: Option<String>,
187    pub token: Option<String>,
188    /// `trigger { radius-disconnect; }`.
189    pub trigger_radius_disconnect: bool,
190}
191
192/// `short-cycle-protection`.
193#[derive(Clone, Debug, PartialEq, Eq)]
194#[non_exhaustive]
195pub struct DhcpShortCycleProtection {
196    pub lockout_min_time: Option<String>,
197    pub lockout_max_time: Option<String>,
198}
199
200/// An `interface <name>` of a `dynamic-server` group.
201#[derive(Clone, Debug, PartialEq, Eq)]
202#[non_exhaustive]
203pub struct DhcpDynamicServerInterface {
204    pub name: String,
205    pub overrides: Option<DhcpOverrides>,
206}
207
208/// A `group <name>` of the DHCPv6 `dynamic-server`.
209#[derive(Clone, Debug, PartialEq, Eq)]
210#[non_exhaustive]
211pub struct DhcpDynamicServerGroup {
212    pub name: String,
213    /// The pool of `neighbor-discovery-router-advertisement`.
214    pub ndra_pool: Option<String>,
215    pub interfaces: Vec<DhcpDynamicServerInterface>,
216}
217
218/// The statements shared by every level of a DHCP local server. The ones a level does not allow are
219/// unset.
220#[derive(Clone, Debug, Default, PartialEq, Eq)]
221#[non_exhaustive]
222pub struct DhcpOptions {
223    pub active_fingerprint_server_group: Option<String>,
224    pub active_leasequery: Option<DhcpActiveLeasequery>,
225    pub allow_active_leasequery: Option<DhcpActiveLeasequeryLimits>,
226    pub allow_bulk_leasequery: Option<DhcpBulkLeasequery>,
227    /// `allow-leasequery`: whether it is configured.
228    pub allow_leasequery: bool,
229    /// `allow-leasequery { restricted-requestor; }`.
230    pub allow_leasequery_restricted_requestor: bool,
231    pub authentication: Option<DhcpAuthentication>,
232    pub dynamic_profiles: Vec<DhcpDynamicProfile>,
233    /// DHCPv6 `duplicate-clients incoming-interface`.
234    pub duplicate_clients: Option<String>,
235    /// `incoming-interface` or `option-82`.
236    pub duplicate_clients_in_subnet: Option<String>,
237    pub dynamic_server: Vec<DhcpDynamicServerGroup>,
238    pub fingerprint_server_groups: Vec<DhcpFingerprintServerGroup>,
239    /// `all-interfaces`, `configured-interfaces` or `non-configured-interfaces`.
240    pub forward_snooped_clients: Option<String>,
241    pub interface_traceoptions: Option<Traceoptions>,
242    pub lease_time_validation: Option<DhcpLeaseTimeValidation>,
243    pub liveness_detection: Option<DhcpLivenessDetection>,
244    pub no_snoop: bool,
245    pub overrides: Option<DhcpOverrides>,
246    /// e.g. `ip-address-first`, `option-82`, `external-authority`.
247    pub pool_match_order: Vec<String>,
248    /// e.g. `lease-renewal`, `remote-id-mismatch`, `actual-data-rate-change`.
249    pub reauthenticate: Vec<String>,
250    pub reconfigure: Option<DhcpReconfigure>,
251    /// `remote-id-mismatch disconnect`.
252    pub remote_id_mismatch_disconnect: bool,
253    pub requested_ip_network_match: Option<String>,
254    /// `access`, `access-internal` or `destination`.
255    pub route_suppression: Option<String>,
256    pub server_duid_type: Option<String>,
257    pub service_profile: Option<String>,
258    pub short_cycle_protection: Option<DhcpShortCycleProtection>,
259}
260
261fn flag(block: &ConfigLine, name: &str) -> bool {
262    has_leaf(block, name)
263}
264
265fn parse_username_include(include: &ConfigLine) -> DhcpUsernameInclude {
266    let client_id = statement_words(include, "client-id");
267    let option_82 = statement_words(include, "option-82");
268    let option_82_flag = |name: &str| option_82.as_ref().is_some_and(|words| words.contains(&name));
269    let field = |keyword: &str| arg_of(include, keyword).map(str::to_string);
270    // `client-id` and `option-82` carry options on the line or in a block.
271    DhcpUsernameInclude {
272        circuit_type: flag(include, "circuit-type"),
273        client_id: client_id.is_some(),
274        client_id_exclude_headers: client_id.as_ref().is_some_and(|w| w.contains(&"exclude-headers")),
275        client_id_use_automatic_ascii_hex_encoding: client_id
276            .as_ref()
277            .is_some_and(|w| w.contains(&"use-automatic-ascii-hex-encoding")),
278        delimiter: field("delimiter"),
279        domain_name: field("domain-name"),
280        interface_description: field("interface-description").or_else(|| field("interfaces-description")),
281        interface_name: flag(include, "interface-name"),
282        logical_system_name: flag(include, "logical-system-name"),
283        mac_address: flag(include, "mac-address"),
284        option_60: flag(include, "option-60"),
285        option_82: option_82.is_some(),
286        option_82_circuit_id: option_82_flag("circuit-id"),
287        option_82_remote_id: option_82_flag("remote-id"),
288        relay_agent_interface_id: flag(include, "relay-agent-interface-id"),
289        relay_agent_remote_id: flag(include, "relay-agent-remote-id"),
290        relay_agent_subscriber_id: flag(include, "relay-agent-subscriber-id"),
291        routing_instance_name: flag(include, "routing-instance-name"),
292        user_prefix: field("user-prefix"),
293        vlan_tags: flag(include, "vlan-tags"),
294    }
295}
296
297fn parse_bfd(bfd: &ConfigLine) -> DhcpBfd {
298    let field = |keyword: &str| arg_of(bfd, keyword).map(str::to_string);
299    let transmit = child_block(bfd, "transmit-interval");
300    DhcpBfd {
301        version: field("version"),
302        minimum_interval: field("minimum-interval"),
303        minimum_receive_interval: field("minimum-receive-interval"),
304        multiplier: field("multiplier"),
305        no_adaptation: flag(bfd, "no-adaptation"),
306        transmit_interval_minimum_interval: transmit.and_then(|t| arg_of(t, "minimum-interval")).map(str::to_string),
307        transmit_interval_threshold: transmit.and_then(|t| arg_of(t, "threshold")).map(str::to_string),
308        detection_time_threshold: child_block(bfd, "detection-time")
309            .and_then(|d| arg_of(d, "threshold"))
310            .map(str::to_string),
311        session_mode: field("session-mode"),
312        holddown_interval: field("holddown-interval"),
313    }
314}
315
316fn parse_liveness(liveness: &ConfigLine) -> DhcpLivenessDetection {
317    let method = child_block(liveness, "method");
318    let layer2 = method.and_then(|m| child_block(m, "layer2-liveness-detection"));
319    DhcpLivenessDetection {
320        failure_action: arg_of(liveness, "failure-action").map(str::to_string),
321        bfd: method.and_then(|m| child_block(m, "bfd")).map(parse_bfd),
322        layer2_max_consecutive_retries: layer2
323            .and_then(|l| arg_of(l, "max-consecutive-retries"))
324            .map(str::to_string),
325        layer2_transmit_interval: layer2.and_then(|l| arg_of(l, "transmit-interval")).map(str::to_string),
326        layer2: layer2.is_some(),
327    }
328}
329
330fn parse_dynamic_profiles(parent: &ConfigLine) -> Vec<DhcpDynamicProfile> {
331    named_children(parent, "dynamic-profile")
332        .map(|(name, profile)| DhcpDynamicProfile {
333            name: name.to_string(),
334            aggregate_clients: arg_of(profile, "aggregate-clients").map(str::to_string),
335            use_primary: arg_of(profile, "use-primary").map(str::to_string),
336        })
337        .collect()
338}
339
340fn parse_fingerprint_groups(parent: &ConfigLine) -> Vec<DhcpFingerprintServerGroup> {
341    let Some(outer) = child_block(parent, "fingerprint-server-group") else {
342        return Vec::new();
343    };
344    named_children(outer, "fingerprint-server-group")
345        .map(|(name, group)| DhcpFingerprintServerGroup {
346            name: name.to_string(),
347            servers: named_children(group, "address")
348                .map(|(address, server)| DhcpFingerprintServer {
349                    address: address.to_string(),
350                    logical_system: arg_of(server, "logical-system").map(str::to_string),
351                    routing_instance: arg_of(server, "routing-instance").map(str::to_string),
352                })
353                .collect(),
354        })
355        .collect()
356}
357
358fn parse_dynamic_server(parent: &ConfigLine) -> Vec<DhcpDynamicServerGroup> {
359    let Some(server) = child_block(parent, "dynamic-server") else {
360        return Vec::new();
361    };
362    named_children(server, "group")
363        .map(|(name, group)| DhcpDynamicServerGroup {
364            name: name.to_string(),
365            ndra_pool: arg_of(group, "neighbor-discovery-router-advertisement").map(str::to_string),
366            interfaces: named_children(group, "interface")
367                .map(|(name, interface)| DhcpDynamicServerInterface {
368                    name: name.to_string(),
369                    overrides: child_block(interface, "overrides").map(parse_overrides),
370                })
371                .collect(),
372        })
373        .collect()
374}
375
376/// The statements of `parent` that every DHCP local server level shares.
377pub(super) fn parse_options(parent: &ConfigLine) -> DhcpOptions {
378    let field = |keyword: &str| arg_of(parent, keyword).map(str::to_string);
379    let first = |keyword: &str| statements(parent, keyword).first().map(|s| s.to_string());
380    let leasequery = child_block(parent, "allow-leasequery");
381    let reauthenticate = statement_words(parent, "reauthenticate");
382    DhcpOptions {
383        active_fingerprint_server_group: field("active-fingerprint-server-group"),
384        active_leasequery: child_block(parent, "active-leasequery").map(|query| DhcpActiveLeasequery {
385            peer_addresses: child_block(query, "peer-address")
386                .map(|peers| active_children(peers).map(|a| a.text.clone()).collect())
387                .unwrap_or_default(),
388            timeout: arg_of(query, "timeout").map(str::to_string),
389            idle_timeout: arg_of(query, "idle-timeout").map(str::to_string),
390            exclude_interfaces: args_of(query, "exclude-interface")
391                .into_iter()
392                .flat_map(list_values)
393                .collect(),
394        }),
395        allow_active_leasequery: child_block(parent, "allow-active-leasequery").map(|query| {
396            DhcpActiveLeasequeryLimits {
397                idle_timeout: arg_of(query, "idle-timeout").map(str::to_string),
398                timeout: arg_of(query, "timeout").map(str::to_string),
399            }
400        }),
401        allow_bulk_leasequery: child_block(parent, "allow-bulk-leasequery").map(|query| DhcpBulkLeasequery {
402            max_connections: arg_of(query, "max-connections").map(str::to_string),
403            max_empty_replies: arg_of(query, "max-empty-replies").map(str::to_string),
404            restricted_requestor: flag(query, "restricted-requestor"),
405            timeout: arg_of(query, "timeout").map(str::to_string),
406        }),
407        allow_leasequery: leasequery.is_some(),
408        allow_leasequery_restricted_requestor: leasequery.is_some_and(|q| flag(q, "restricted-requestor")),
409        authentication: child_block(parent, "authentication").map(|auth| DhcpAuthentication {
410            password: secret_value(arg_of(auth, "password")),
411            username_include: child_block(auth, "username-include").map(parse_username_include),
412        }),
413        dynamic_profiles: parse_dynamic_profiles(parent),
414        duplicate_clients: field("duplicate-clients"),
415        duplicate_clients_in_subnet: field("duplicate-clients-in-subnet"),
416        dynamic_server: parse_dynamic_server(parent),
417        fingerprint_server_groups: parse_fingerprint_groups(parent),
418        forward_snooped_clients: field("forward-snooped-clients"),
419        interface_traceoptions: parse_named_traceoptions(parent, "interface-traceoptions"),
420        lease_time_validation: child_block(parent, "lease-time-validation").map(|validation| DhcpLeaseTimeValidation {
421            lease_time_threshold: arg_of(validation, "lease-time-threshold").map(str::to_string),
422            violation_action: arg_of(validation, "violation-action").map(str::to_string),
423        }),
424        liveness_detection: child_block(parent, "liveness-detection").map(parse_liveness),
425        no_snoop: flag(parent, "no-snoop"),
426        overrides: child_block(parent, "overrides").map(parse_overrides),
427        pool_match_order: child_block(parent, "pool-match-order")
428            .map(|order| active_children(order).map(|c| c.text.clone()).collect())
429            .unwrap_or_default(),
430        reauthenticate: reauthenticate
431            .map(|words| words.into_iter().map(str::to_string).collect())
432            .unwrap_or_default(),
433        reconfigure: child_block(parent, "reconfigure").map(|reconfigure| DhcpReconfigure {
434            attempts: arg_of(reconfigure, "attempts").map(str::to_string),
435            clear_on_abort: flag(reconfigure, "clear-on-abort"),
436            clear_on_terminate: flag(reconfigure, "clear-on-terminate"),
437            strict: flag(reconfigure, "strict"),
438            support_option_pd_exclude: flag(reconfigure, "support-option-pd-exclude"),
439            timeout: arg_of(reconfigure, "timeout").map(str::to_string),
440            token: arg_of(reconfigure, "token").map(str::to_string),
441            trigger_radius_disconnect: child_block(reconfigure, "trigger")
442                .is_some_and(|trigger| flag(trigger, "radius-disconnect")),
443        }),
444        remote_id_mismatch_disconnect: first("remote-id-mismatch").as_deref() == Some("disconnect"),
445        requested_ip_network_match: field("requested-ip-network-match"),
446        route_suppression: field("route-suppression"),
447        server_duid_type: field("server-duid-type"),
448        service_profile: field("service-profile"),
449        short_cycle_protection: statement_words(parent, "short-cycle-protection").map(|words| {
450            DhcpShortCycleProtection {
451                lockout_min_time: value_after(&words, "lockout-min-time"),
452                lockout_max_time: value_after(&words, "lockout-max-time"),
453            }
454        }),
455    }
456}