From d431953353f7192f6aa7cae8c4b835ba47dc042f Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Mon, 14 Jun 2021 19:06:35 +0900 Subject: [PATCH] client, server: configurable MTU via --mtu ex: innernet --mtu 1400 up foobarnet Closes #102 --- shared/src/types.rs | 4 ++++ shared/src/wg.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/shared/src/types.rs b/shared/src/types.rs index a1e80b6..fb028a6 100644 --- a/shared/src/types.rs +++ b/shared/src/types.rs @@ -384,6 +384,10 @@ pub struct NetworkOpt { /// Specify a WireGuard backend to use. /// If not set, innernet will auto-select based on availability. pub backend: Backend, + + #[structopt(long, default_value = "1420")] + /// Specify the desired MTU for your interface. + pub mtu: u32, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] diff --git a/shared/src/wg.rs b/shared/src/wg.rs index 4f32722..7a54952 100644 --- a/shared/src/wg.rs +++ b/shared/src/wg.rs @@ -85,7 +85,7 @@ pub fn up( .set_private_key(wgctrl::Key::from_base64(&private_key).unwrap()) .apply(interface, network.backend)?; set_addr(interface, address)?; - set_up(interface, 1420)?; + set_up(interface, network.mtu)?; if !network.no_routing { add_route(interface, address)?; }