From patchwork Thu Mar 28 01:27:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Schenk X-Patchwork-Id: 706 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id 4PxIEQzCnFzgbQAAIUCqbw for ; Thu, 28 Mar 2019 08:46:04 -0400 Received: from proxy20.mail.ord1d.rsapps.net ([172.30.191.6]) by director10.mail.ord1d.rsapps.net with LMTP id +CMtEQzCnFz0fwAApN4f7A ; Thu, 28 Mar 2019 08:46:04 -0400 Received: from smtp11.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy20.mail.ord1d.rsapps.net with LMTP id +BCYGAvCnFzKMgAAsk8m8w ; Thu, 28 Mar 2019 08:46:04 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp11.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=mail.uni-paderborn.de; dmarc=fail (p=none; dis=none) header.from=mail.uni-paderborn.de X-Suspicious-Flag: YES X-Classification-ID: 717c9e4e-5157-11e9-898b-5254005f837b-1-1 Received: from [216.105.38.7] ([216.105.38.7:23798] helo=lists.sourceforge.net) by smtp11.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 37/8B-04387-A02CC9C5; Thu, 28 Mar 2019 08:46:02 -0400 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1h9UPA-0006oQ-Tm; Thu, 28 Mar 2019 12:45:12 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1h9UP9-0006oI-DW for openvpn-devel@lists.sourceforge.net; Thu, 28 Mar 2019 12:45:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=UgUCAIu2U+TcTI9Dscl6zXJZX8nmKy/MwBMshEDHt8w=; b=aY5vR6S/yMYPIXuo8nEIEtMM+/ y1HDJSd4herRLfOunbNj1VfyW9CoW7ITOmS2DpYIKtilMUzP7tL1IJEfv6GDQXnK92Y4fFs7iG1cc s8whSGI75utuNfWa+BO1QT8wUJiOdsrY1NOaJxBtnqKddPrMshRKi1RNBvFZ/9tnycYE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=UgUCAIu2U+TcTI9Dscl6zXJZX8nmKy/MwBMshEDHt8w=; b=B PIgOpFY8U+1dhe8/KYK5HuyOjADXgc+pBoZlwUnEz1Qfe0Cou2VVaeJZXobQIEeOac8K1bltmydc7 HLapR61lXLibegzB8jL2iDWHSsJDrjyXjX6XtV1HjvTA+yFgrrpTvemgfgBnYdGezlHJFCo8QCRJm lsVabfl5pIvE5zZY=; Received: from mail.uni-paderborn.de ([131.234.142.9]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1h9UP6-00EpdH-8Y for openvpn-devel@lists.sourceforge.net; Thu, 28 Mar 2019 12:45:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.uni-paderborn.de; s=20170601; h=Content-Transfer-Encoding:MIME-Version :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=UgUCAIu2U+TcTI9Dscl6zXJZX8nmKy/MwBMshEDHt8w=; b=IPzUVuSp79BH1pLbjRh1mvGKR1 P9nzvsDNVgSIKYs5WErTMWujfYw9t8w3NQQeaNPaItNy3yYvcRJjUkKhkrpeG2ex7+51b907ToVlr cGSOXP5oFwHDpaI9FzR6anmJt7sGhltmVR72593tIsljui9xskiZVKpQQGrBK/xspxuE=; From: Christopher Schenk To: openvpn-devel@lists.sourceforge.net Date: Thu, 28 Mar 2019 13:27:01 +0100 Message-Id: <20190328122701.7396-1-cschenk@mail.uni-paderborn.de> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 X-IMT-Spam-Score: 0.0 () X-PMX-Version: 6.4.6.2792898, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2019.3.28.122116, AntiVirus-Engine: 5.58.0, AntiVirus-Data: 2019.2.22.5580002 X-IMT-Authenticated-Sender: uid=cschenk,ou=People,o=upb,c=de X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1h9UP6-00EpdH-8Y Subject: [Openvpn-devel] [PATCH] Setting adapter mtu on windows systems X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christopher Schenk Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Christopher Schenk --- src/openvpn/tun.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 48a8fdf7..93d028c8 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -69,6 +69,12 @@ static void netsh_ifconfig(const struct tuntap_options *to, const in_addr_t netmask, const unsigned int flags); +static void netsh_set_mtu_ipv4(const char *flex_name, + const int mtu); + +static void netsh_set_mtu_ipv6(const char *flex_name, + const int mtu); + static void netsh_set_dns6_servers(const struct in6_addr *addr_list, const int addr_len, const char *flex_name); @@ -1000,6 +1006,7 @@ do_ifconfig_ipv6(struct tuntap *tt, const char *ifname, int tun_mtu, netsh_command(&argv, 4, M_FATAL); /* set ipv6 dns servers if any are specified */ netsh_set_dns6_servers(tt->options.dns6, tt->options.dns6_len, ifname); + netsh_set_mtu_ipv6(ifname, tun_mtu); } /* explicit route needed */ @@ -1391,9 +1398,9 @@ do_ifconfig_ipv4(struct tuntap *tt, const char *ifname, int tun_mtu, case IPW32_SET_NETSH: netsh_ifconfig(&tt->options, ifname, tt->local, tt->adapter_netmask, NI_IP_NETMASK|NI_OPTIONS); - break; } + netsh_set_mtu_ipv4(ifname, tun_mtu); } #else /* if defined(TARGET_LINUX) */ @@ -5236,6 +5243,36 @@ out: return ret; } +static void +netsh_set_mtu_ipv4(const char *flex_name, + const int mtu) +{ + struct argv argv = argv_new(); + argv_printf(&argv, "%s%sc interface ipv4 set subinterface %s mtu = %d store=active", + get_win_sys_path(), + NETSH_PATH_SUFFIX, + flex_name, + mtu); + + netsh_command(&argv, 3, M_WARN); + argv_reset(&argv); +} + +static void +netsh_set_mtu_ipv6(const char *flex_name, + const int mtu) +{ + struct argv argv = argv_new(); + argv_printf(&argv, "%s%sc interface ipv6 set subinterface %s mtu = %d store=active", + get_win_sys_path(), + NETSH_PATH_SUFFIX, + flex_name, + mtu); + + netsh_command(&argv, 3, M_WARN); + argv_reset(&argv); +} + /* * Return a TAP name for netsh commands. */