From patchwork Mon Apr 1 00:21:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Schenk X-Patchwork-Id: 711 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.27.255.1]) by backend30.mail.ord1d.rsapps.net with LMTP id +ADVMaP0oVxeDgAAIUCqbw for ; Mon, 01 Apr 2019 07:23:15 -0400 Received: from proxy8.mail.iad3a.rsapps.net ([172.27.255.1]) by director9.mail.ord1d.rsapps.net with LMTP id AGE4L6P0oVxZRQAAalYnBA ; Mon, 01 Apr 2019 07:23:15 -0400 Received: from smtp25.gate.iad3a ([172.27.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy8.mail.iad3a.rsapps.net with LMTP id UEYEKaP0oVwjCgAAsBr/qg ; Mon, 01 Apr 2019 07:23:15 -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: smtp25.gate.iad3a.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: 89733c30-5470-11e9-aa0b-52540086a678-1-1 Received: from [216.105.38.7] ([216.105.38.7:16656] helo=lists.sourceforge.net) by smtp25.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id A2/DC-24938-1A4F1AC5; Mon, 01 Apr 2019 07:23:13 -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 1hAv0x-0008C1-GL; Mon, 01 Apr 2019 11:22:07 +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 1hAv0t-0008Bm-Q0 for openvpn-devel@lists.sourceforge.net; Mon, 01 Apr 2019 11:22:03 +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:References: In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=UgUCAIu2U+TcTI9Dscl6zXJZX8nmKy/MwBMshEDHt8w=; b=bKjfDdmH97cXSdMQ4cK0DUJ/xn UDzjt2ALUCkfaIZH0Zbwf+VARfAq0lhXekIbvKIObAJQsoN5ItplyE7Rzf357xXoHeiIfi1Pf1+8D gxO/CzYK93sBzQ+AM+Y3EZnw2glaLW0bUSTeeKiyyKNRjEtnShfKmAyqLA1obNn/Arh0=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=UgUCAIu2U+TcTI9Dscl6zXJZX8nmKy/MwBMshEDHt8w=; b=mqtiVNxqe8r7d1UidbDCRRR4Qz r2JEByJxttGdx7QiRm1hVrx2hgfNobsCsiZVEZTGRwZrulA/ZX7wAHK5fNUzNSdM3YmM9jo2SX+Jy pGOPSWxOL1WIXjiskfsuwruVA1FAYRmiV1B5Dv8iLdfiNAe3H8FvEXNNMxwNG712rHFk=; Received: from mail.uni-paderborn.de ([131.234.142.9]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1hAv0r-009vxC-Rl for openvpn-devel@lists.sourceforge.net; Mon, 01 Apr 2019 11:22:03 +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 :References:In-Reply-To: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:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UgUCAIu2U+TcTI9Dscl6zXJZX8nmKy/MwBMshEDHt8w=; b=aIWK3U/HqgNL60oYxl5FRWU91X kRbD9VnntuFrR11Os9SOgGvSQq6isPeGGZdixB9jmU560vHXnlNRiR7e1b+oU1nRul15zP3OistJj bEpEgizbKfq41156O5WmhE9x281QO2FRV1YwIv1KrpUb2ig8XrMHHhx4FuNfDgafnNdM=; From: Christopher Schenk To: openvpn-devel@lists.sourceforge.net Date: Mon, 1 Apr 2019 13:21:37 +0200 Message-Id: <20190401112140.13212-1-cschenk@mail.uni-paderborn.de> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190329193805.GQ31008@greenie.muc.de> References: <20190329193805.GQ31008@greenie.muc.de> 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.4.1.111216, 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: 1hAv0r-009vxC-Rl Subject: [Openvpn-devel] [PATCH 1/4] 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. */