From patchwork Thu Dec 19 02:29:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 946 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 2Cu+Lqt7+109aAAAIUCqbw for ; Thu, 19 Dec 2019 08:31:23 -0500 Received: from proxy6.mail.ord1d.rsapps.net ([172.30.191.6]) by director10.mail.ord1d.rsapps.net with LMTP id eN2jLqt7+13PDgAApN4f7A ; Thu, 19 Dec 2019 08:31:23 -0500 Received: from smtp17.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy6.mail.ord1d.rsapps.net with LMTP id mBxoLqt7+11NQwAAQyIf0w ; Thu, 19 Dec 2019 08:31:23 -0500 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: smtp17.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=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: d92f55a8-2263-11ea-a671-5254008de1cb-1-1 Received: from [216.105.38.7] ([216.105.38.7:57446] helo=lists.sourceforge.net) by smtp17.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 75/CF-17130-BAB7BFD5; Thu, 19 Dec 2019 08:31:23 -0500 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1ihvsk-0001Uj-2G; Thu, 19 Dec 2019 13:30:22 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ihvsj-0001UX-5t for openvpn-devel@lists.sourceforge.net; Thu, 19 Dec 2019 13:30:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding: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=/kCWjDs5IRYvMYKmXu9eXKEtedcJ8S4IS72YpIvm7xM=; b=cnckJaq3znSntd/QvdH9rZ+1oJ JHthWkbX30Cfy6diccyFtWSqZDlnQGSqV2ZsvfPKYx23X3zz6trSELrDReZ6z2jcN19vSdvJDkBU7 XU6GJuuVbuM3yG9NS0iE70CSEWDrnVpoBUf7hm/9G6t21CqNtJNGRyebeLwtw+mdwgG4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type:Content-Transfer-Encoding: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=/kCWjDs5IRYvMYKmXu9eXKEtedcJ8S4IS72YpIvm7xM=; b=HPZhYZSJjOx4IIwtzVEu+Thj2S /cBj2iVWNS4XzmRS455qebTJBJFeUcu//9VYGYg2VE9l2P/Lr4jNQ9nD1NLGs3YWcJerXgiF2T770 ISPdUe9nEvGtvhIsQn78EzyrPHLeHG5IFccJEdockIdUSKBRAPGBjN72GUXcgvLNDGeY=; Received: from mail-wr1-f68.google.com ([209.85.221.68]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.2) id 1ihvsf-009vhp-7v for openvpn-devel@lists.sourceforge.net; Thu, 19 Dec 2019 13:30:21 +0000 Received: by mail-wr1-f68.google.com with SMTP id c14so5978761wrn.7 for ; Thu, 19 Dec 2019 05:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/kCWjDs5IRYvMYKmXu9eXKEtedcJ8S4IS72YpIvm7xM=; b=pgxbIB9xjGxgv7mJ3y1Ko6AkROECXYUu1cvpjoWA1bkPcsxCEx1bTrDT5NzonfTZVA sZesxy5JYPN+fufwDaGtIPJzH/rIpPEWvf1me+bXrEXip8xsYHW9p0+fsQ+LRGg8FZZ3 eHsB2yZ/3OkdPm+QG45Ef/N+yvrgDlJmgqTZboHHoT2DsYNcDSKWN+BeBwHXYwYR5uAe fOK/bY5UwZjUS7vW+rdWo/T6ojrRIuQGVCN38s5+3VAzMau7bY/JCXuwQsUWejM2rwKT 6KfDSaiyVhEWXGaelTVIu79XYg2hm1CgdHzgFx8HdJjuHdA/OBtllgXtljDv98g+V4yM ccLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/kCWjDs5IRYvMYKmXu9eXKEtedcJ8S4IS72YpIvm7xM=; b=gLdSQxHOiAKZs4wPpzy4sarmH1+69KhVRQzOSSpSfXrTRB0jjgNQqR0T8Z6dnhGyzc Ven6k0ZHN9fDL+mE+CVb0WePBZBgoTKtiWrmu6GWJ5mVaw8OFShXscYN035LEE3xCot1 hyBcgia8rKAJWHmIW5r1KO7JUMNat9K2Qb2gnl7xP+fPelPbkdEBew/4kyBSwk891+5v x95AC0lG4BCZpf1ANXUg8c1GApSZBwVTHEvgn0GZK83yIvalfJD9B3IpF0ZSq3TF+L7i 8S0twf26w95vQz1TDE2FJinoeLa69rYfv6UajwEVtzxAGyMNSHeMoMEbJddp6kUHlgGU r6Og== X-Gm-Message-State: APjAAAVrV/1S3SQKVv7RV2hPN2RNjWn22SBpVt+zunUGUj1f9nZcQ4ng ykbRQG2iRkW83Z1TzPasCI2U3w9bUgQ= X-Google-Smtp-Source: APXvYqxTAgApZ5Zqf9yliqx9DJxW7m1BbOUWuGzaERRPNFkD0JZRdp/eMcKOqCx69IpdeK7oOGkwvQ== X-Received: by 2002:adf:df03:: with SMTP id y3mr10214162wrl.260.1576762210183; Thu, 19 Dec 2019 05:30:10 -0800 (PST) Received: from LAPTOP-4L3N7KFS.panoulu.local ([94.177.167.83]) by smtp.gmail.com with ESMTPSA id p7sm6152197wmp.31.2019.12.19.05.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 05:30:09 -0800 (PST) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Thu, 19 Dec 2019 15:29:53 +0200 Message-Id: <20191219132953.375-1-lstipakov@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.68 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (lstipakov[at]gmail.com) 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: openvpn.net] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.68 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an 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: 1ihvsf-009vhp-7v Subject: [Openvpn-devel] [PATCH] options.c: do not force route delay when not using DHCP 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: Lev Stipakov MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Lev Stipakov Route delay may be only necessary when we perform DHCP handshake. When we use IPAPI / netsh / manual, no delay needed. Signed-off-by: Lev Stipakov Acked-by: Simon Rozman --- src/openvpn/options.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/openvpn/options.c b/src/openvpn/options.c index cebcbb07..a6f40e10 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3001,9 +3001,18 @@ options_postprocess_mutate_invariant(struct options *options) } #ifdef _WIN32 + /* when using wintun, kernel doesn't send DHCP requests, so use netsh to set IP address and netmask */ + if (options->wintun) + { + options->tuntap_options.ip_win32_type = IPW32_SET_NETSH; + } + if ((dev == DEV_TYPE_TUN || dev == DEV_TYPE_TAP) && !options->route_delay_defined) { - if (options->mode == MODE_POINT_TO_POINT) + /* delay may only be necessary when we perform DHCP handshake */ + const bool dhcp = (options->tuntap_options.ip_win32_type == IPW32_SET_DHCP_MASQ) + || (options->tuntap_options.ip_win32_type == IPW32_SET_ADAPTIVE); + if ((options->mode == MODE_POINT_TO_POINT) && dhcp) { options->route_delay_defined = true; options->route_delay = 5; /* Vista sometimes has a race without this */ @@ -3016,14 +3025,8 @@ options_postprocess_mutate_invariant(struct options *options) options->ifconfig_noexec = false; } - /* for wintun kernel doesn't send DHCP requests, so use netsh to set IP address and netmask */ - if (options->wintun) - { - options->tuntap_options.ip_win32_type = IPW32_SET_NETSH; - } - remap_redirect_gateway_flags(options); -#endif +#endif /* ifdef _WIN32 */ #if P2MP_SERVER /*