File tree 2 files changed +7
-5
lines changed
crates/lib-dhcp/src/client
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ pub enum ClientError {
19
19
#[ error( "Failed to retrieve interfaces: {0}" ) ]
20
20
InterfaceError ( #[ from] InterfaceError ) ,
21
21
22
- #[ error( "Failed to select a network interface" ) ]
23
- NoInterfaceFound ,
22
+ #[ error( "Failed to select a network interface: {0} " ) ]
23
+ NoInterfaceFound ( String ) ,
24
24
25
25
#[ error( "Parse hardware address error: {0}" ) ]
26
26
ParseHardwareAddrError ( #[ from] ParseHardwareAddrError ) ,
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ impl ClientBuilder {
70
70
let interface =
71
71
match utils:: select_network_interface ( & self . interface , self . interface_fallback ) ? {
72
72
Some ( ifa) => ifa,
73
- None => return Err ( ClientError :: NoInterfaceFound ) ,
73
+ None => return Err ( ClientError :: NoInterfaceFound ( self . interface ) ) ,
74
74
} ;
75
75
76
76
let hardware_address = match & interface. mac_addr {
@@ -132,6 +132,8 @@ impl ClientBuilder {
132
132
}
133
133
}
134
134
135
+ // TODO (Techassi): The T1 and T2 timers a implemented slightly wrong. See 4.4.5
136
+
135
137
pub struct Client {
136
138
/// Duration before the binding process of the socket times out.
137
139
bind_timeout : time:: Duration ,
@@ -231,7 +233,7 @@ impl Client {
231
233
println ! ( "Sending DHCPDISCOVER message" ) ;
232
234
let discover_message = self . builder . make_discover_message (
233
235
self . get_xid ( ) ,
234
- Some ( self . destination_addr ( ) ) ,
236
+ self . destination_addr ( ) ,
235
237
None ,
236
238
None ,
237
239
) ?;
@@ -601,7 +603,7 @@ impl Client {
601
603
& self . interface . name ,
602
604
) ?;
603
605
604
- Ok ( ( ) )
606
+ Ok ( self . transition_to ( DhcpState :: Bound ) ? )
605
607
}
606
608
607
609
/// Returns the current transaction ID.
You can’t perform that action at this time.
0 commit comments