Skip to content

Commit 55e7e80

Browse files
committed
remove unused features, uncomment actual mtu configuration
1 parent bcc2124 commit 55e7e80

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ windows = { version = "0.62", features = [
3838
"Win32_NetworkManagement_Ndis",
3939
"Win32_Networking_WinSock",
4040
"Win32_System_Com",
41-
"Win32_System_Com_StructuredStorage",
42-
"Win32_System_Rpc",
43-
"Win32_System_Variant",
44-
"Win32_System_Ole",
45-
"Win32_System_Wmi",
46-
"Win32_Foundation",
4741
]}
4842
wireguard-nt = "0.5.0"
4943

src/wgapi_windows.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
270270
"Configuring interface {} with config: {config:?}",
271271
self.ifname
272272
);
273+
273274
// Retrieve the adapter - should be created by calling `Self::create_interface` first.
274275
let Some(ref adapter) = self.adapter else {
275276
Err(WindowsError::AdapterNotFound(self.ifname.clone()))?
@@ -328,19 +329,17 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
328329
.set_default_route(&addresses, &interface)
329330
.map_err(WindowsError::from)?;
330331

331-
// Bring the adapter up
332-
debug!("Bringing up adapter {}", self.ifname);
333-
334332
// Set MTU
335-
set_interface_mtu(&self.ifname, 1300)?;
336-
adapter.down().map_err(WindowsError::from)?;
337-
// if let Some(mtu) = config.mtu {
338-
// set_interface_mtu(&self.ifname, mtu)?;
339-
// // Turn it off and on again
340-
// adapter.down().map_err(WindowsError::from)?;
341-
// }
333+
if let Some(mtu) = config.mtu {
334+
set_interface_mtu(&self.ifname, mtu)?;
335+
// Turn it off and on again.
336+
adapter.down().map_err(WindowsError::from)?;
337+
}
342338

339+
// Bring the adapter up.
340+
debug!("Bringing up adapter {}", self.ifname);
343341
adapter.up().map_err(WindowsError::from)?;
342+
344343
info!(
345344
"Interface {} has been successfully configured.",
346345
self.ifname

0 commit comments

Comments
 (0)