@@ -56,8 +56,8 @@ pub struct BaseCode {
56
56
op_flags : UdpOpFlags ,
57
57
dest_ip : * const uefi_raw:: IpAddress ,
58
58
dest_port : & u16 ,
59
- gateway_ip : Option < & IpAddress > ,
60
- src_ip : Option < & IpAddress > ,
59
+ gateway_ip : * const uefi_raw :: IpAddress ,
60
+ src_ip : * const uefi_raw :: IpAddress ,
61
61
src_port : Option < & mut u16 > ,
62
62
header_size : Option < & usize > ,
63
63
header_ptr : * const c_void ,
@@ -92,8 +92,8 @@ pub struct BaseCode {
92
92
) -> Status ,
93
93
set_station_ip : unsafe extern "efiapi" fn (
94
94
this : & Self ,
95
- new_station_ip : Option < & IpAddress > ,
96
- new_subnet_mask : Option < & IpAddress > ,
95
+ new_station_ip : * const uefi_raw :: IpAddress ,
96
+ new_subnet_mask : * const uefi_raw :: IpAddress ,
97
97
) -> Status ,
98
98
set_packets : unsafe extern "efiapi" fn (
99
99
this : & Self ,
@@ -481,8 +481,8 @@ impl BaseCode {
481
481
op_flags,
482
482
dest_ip. as_raw_ptr ( ) ,
483
483
& dest_port,
484
- gateway_ip,
485
- src_ip,
484
+ opt_ip_addr_to_ptr ( gateway_ip) ,
485
+ opt_ip_addr_to_ptr ( src_ip) ,
486
486
src_port,
487
487
header_size,
488
488
header_ptr,
@@ -573,7 +573,14 @@ impl BaseCode {
573
573
new_station_ip : Option < & IpAddress > ,
574
574
new_subnet_mask : Option < & IpAddress > ,
575
575
) -> Result {
576
- unsafe { ( self . set_station_ip ) ( self , new_station_ip, new_subnet_mask) } . to_result ( )
576
+ unsafe {
577
+ ( self . set_station_ip ) (
578
+ self ,
579
+ opt_ip_addr_to_ptr ( new_station_ip) ,
580
+ opt_ip_addr_to_ptr ( new_subnet_mask) ,
581
+ )
582
+ }
583
+ . to_result ( )
577
584
}
578
585
579
586
/// Updates the contents of the cached DHCP and Discover packets.
@@ -629,6 +636,11 @@ fn opt_bool_to_ptr(arg: &Option<bool>) -> *const Boolean {
629
636
. unwrap_or_else ( null)
630
637
}
631
638
639
+ /// Convert an `Option<&IpAddress>` to a `*const uefi_raw::IpAddress`.
640
+ fn opt_ip_addr_to_ptr ( arg : Option < & IpAddress > ) -> * const uefi_raw:: IpAddress {
641
+ arg. map ( |arg| arg. as_raw_ptr ( ) ) . unwrap_or_else ( null)
642
+ }
643
+
632
644
opaque_type ! {
633
645
/// Opaque type that should be used to represent a pointer to a [`DiscoverInfo`] in
634
646
/// foreign function interfaces. This type produces a thin pointer, unlike
0 commit comments