77use alloc:: vec;
88use alloc:: vec:: Vec ;
99use core:: ffi:: c_void;
10+ use core:: net:: Ipv4Addr ;
1011use core:: time:: Duration ;
1112
1213use uefi:: boot:: ScopedProtocol ;
1314use uefi:: prelude:: * ;
1415use uefi:: proto:: unsafe_protocol;
1516use uefi:: { print, println} ;
16- use uefi_raw:: Ipv4Address ;
1717use uefi_raw:: protocol:: network:: ip4_config2:: {
1818 Ip4Config2DataType , Ip4Config2InterfaceInfo , Ip4Config2Policy , Ip4Config2Protocol ,
1919} ;
@@ -102,29 +102,19 @@ impl Ip4Config2 {
102102 } )
103103 }
104104
105- fn print_info ( info : & Ip4Config2InterfaceInfo ) {
106- println ! (
107- "addr v4: {}.{}.{}.{}" ,
108- info. station_addr. 0 [ 0 ] ,
109- info. station_addr. 0 [ 1 ] ,
110- info. station_addr. 0 [ 2 ] ,
111- info. station_addr. 0 [ 3 ] ,
112- ) ;
113- }
114-
115105 /// Bring up network interface. Does nothing in case the network
116106 /// is already set up. Otherwise turns on DHCP and waits until an
117107 /// IPv4 address has been assigned. Reports progress on the
118108 /// console if verbose is set to true. Returns TIMEOUT error in
119109 /// case DHCP configuration does not finish within 30 seconds.
120110 pub fn ifup ( & mut self , verbose : bool ) -> uefi:: Result < ( ) > {
121- let no_address = Ipv4Address :: default ( ) ;
111+ let no_address = Ipv4Addr :: from_bits ( 0 ) ;
122112
123113 let info = self . get_interface_info ( ) ?;
124- if info. station_addr != no_address {
114+ if info. station_addr != no_address. into ( ) {
125115 if verbose {
126116 print ! ( "Network is already up: " ) ;
127- Self :: print_info ( & info) ;
117+ println ! ( "addr v4: {}" , info. station_addr ) ;
128118 }
129119 return Ok ( ( ) ) ;
130120 }
@@ -140,10 +130,10 @@ impl Ip4Config2 {
140130 }
141131 boot:: stall ( Duration :: from_secs ( 1 ) ) ;
142132 let info = self . get_interface_info ( ) ?;
143- if info. station_addr != no_address {
133+ if info. station_addr != no_address. into ( ) {
144134 if verbose {
145135 print ! ( " OK: " ) ;
146- Self :: print_info ( & info) ;
136+ println ! ( "addr v4: {}" , info. station_addr ) ;
147137 }
148138 return Ok ( ( ) ) ;
149139 }
0 commit comments