1
- use std:: { net:: IpAddr , str :: FromStr } ;
1
+ use std:: net:: IpAddr ;
2
2
3
3
use crate :: {
4
4
bsd,
@@ -14,7 +14,7 @@ use crate::{
14
14
impl WireguardInterfaceApi for WGApi < Kernel > {
15
15
/// Creates a WireGuard network interface.
16
16
fn create_interface ( & self ) -> Result < ( ) , WireguardInterfaceError > {
17
- bsd:: load_wireguard_kernel_module ( ) ;
17
+ let _ = bsd:: load_wireguard_kernel_module ( ) ;
18
18
debug ! ( "Creating interface {}" , & self . ifname) ;
19
19
bsd:: create_interface ( & self . ifname ) ?;
20
20
debug ! ( "Interface {} created successfully" , & self . ifname) ;
@@ -64,17 +64,11 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
64
64
self . ifname
65
65
) ;
66
66
67
- // assign IP address to interface
68
- debug ! (
69
- "Parsing address {} for interface {}" ,
70
- config. address, self . ifname
71
- ) ;
72
- let address = IpAddrMask :: from_str ( & config. address ) ?;
73
- debug ! (
74
- "Address {} parsed successfully for interface {}" ,
75
- config. address, self . ifname
76
- ) ;
77
- self . assign_address ( & address) ?;
67
+ // Assign IP address to the interface.
68
+ for address in & config. addresses {
69
+ self . assign_address ( address) ?;
70
+ }
71
+
78
72
// configure interface
79
73
debug ! (
80
74
"Applying the WireGuard host configuration for interface {}" ,
@@ -99,13 +93,15 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
99
93
}
100
94
101
95
info ! (
102
- "Interface {} has been successfully configured. It has been assigned the following address: {}" ,
103
- self . ifname, address
96
+ "Interface {} has been successfully configured. \
97
+ It has been assigned the following addresses: {:?}",
98
+ self . ifname, config. addresses
104
99
) ;
105
100
debug ! (
106
101
"Interface {} configured with config: {config:?}" ,
107
102
self . ifname
108
103
) ;
104
+
109
105
Ok ( ( ) )
110
106
}
111
107
0 commit comments