@@ -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