From patchwork Wed Jun 24 22:37:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 1174 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.27.255.54]) by backend30.mail.ord1d.rsapps.net with LMTP id sPmlKNNi9F7LBAAAIUCqbw for ; Thu, 25 Jun 2020 04:39:47 -0400 Received: from proxy17.mail.iad3a.rsapps.net ([172.27.255.54]) by director9.mail.ord1d.rsapps.net with LMTP id QPAIJtNi9F6/IwAAalYnBA ; Thu, 25 Jun 2020 04:39:47 -0400 Received: from smtp34.gate.iad3a ([172.27.255.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy17.mail.iad3a.rsapps.net with LMTP id oB9hINNi9F5hJQAAR4KW9A ; Thu, 25 Jun 2020 04:39:47 -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: smtp34.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=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 6c8937f2-b6bf-11ea-af2c-525400865cc7-1-1 Received: from [216.105.38.7] ([216.105.38.7:44092] helo=lists.sourceforge.net) by smtp34.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 0E/37-13232-2D264FE5; Thu, 25 Jun 2020 04:39:47 -0400 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 1joNPJ-0006X8-NR; Thu, 25 Jun 2020 08:38:53 +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 1joNPI-0006WO-Mi for openvpn-devel@lists.sourceforge.net; Thu, 25 Jun 2020 08:38:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=sHbxHIRuSRHWyiv7BLkYWYxxEgyNH0JdIRzvhcJq7ko=; b=FfBAAXZchTTUrNguXMmDyDx0S2 oQcvgCFoFvTtI3xFphcHeO44tY5IBbXQWfdW+g8qxWY7yHW3D/SWowMaEJvmZlz+O32mmecA6h8TH 7m/TgDes5hKWTjbZn2Gtk05d4v73VHXdiOrWZTV6/XjlucyeOiTcanZF7LHtwtUUekwo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=sHbxHIRuSRHWyiv7BLkYWYxxEgyNH0JdIRzvhcJq7ko=; b=jT9fqhAI4KgzdrukDE4dMcvN26 lv+SZorUWu6CzvVlSVu2mK9j/PtG9/+NtxZJu3vgaNXbetT0x3Hd0/J+yx2xEbP9Cmd0YPEP3SgsP Vtj4H3MNUKqobBE2dOPZIHngV+slWGxw0zFPDAweNbVksS3AwyxIrA2hG8Y9FAuxsAng=; Received: from mail-wr1-f66.google.com ([209.85.221.66]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.2) id 1joNPE-00HaaK-OV for openvpn-devel@lists.sourceforge.net; Thu, 25 Jun 2020 08:38:52 +0000 Received: by mail-wr1-f66.google.com with SMTP id z13so4931395wrw.5 for ; Thu, 25 Jun 2020 01:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sHbxHIRuSRHWyiv7BLkYWYxxEgyNH0JdIRzvhcJq7ko=; b=nOFMwy7Dg0EZYXARtm2cgnW+ovZU+4p2KmPNyYvrlIA6aL1USm0bQQEdY9h81UL5XU iKRkzjlzJIVkCy5hQkYNYFjo82pgsTPcDI7zfrh/4tcOxmuKLxS81qYmyrgnPI7hMNuW g/4HEspbh+pjQQQdAyEt4dvWyEA/2X5YGYctD+FuZr86QuiVWGTnGDDhBa7Mp/Ibexp7 4mMcO7YaC5xnK+kNaTrJCCRSzTkJu7+UCxhYtvQYo5tDj1nu1U4hhAHSuPtxvbdApupw vZFOlB+KzZVMCChHWXkqL8nG/7etvaBzwsud+hG1Y4a6UmpORx8uIORExUFBNsxnSsLv fKJA== 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:in-reply-to :references; bh=sHbxHIRuSRHWyiv7BLkYWYxxEgyNH0JdIRzvhcJq7ko=; b=j6MnTIv2A3RAuwAtmCC9kUsZX1Jjlv/wg1BKbqu3p4hIYpCbn5ycgRWwRHuKLl8VGo SVMhtvbNOeKbITs/cYWaRdNLeYed31Ul0NwC+MaKZIg3TYTQJHFu+5CVRgIqCxvqqye5 +W0J9klDOqCm+GGSWNJGgeE0uBZI99EuH22rF2VPt66X3nj/+OMckQVfMcjNzfCn59KX c3jZnN6BWprrZHGUuUkvivVfVD0MnhAqqzdug0pWygplSrTMpl/jnCGFeh9MQq2IRugZ cX0/1QinjQ+SGyLj7DRrzal8pI0qsPqoFc0sJD7VEByQLAxIbMDDtzaULIjV9NYAHofl 11Kg== X-Gm-Message-State: AOAM530Uo4+uCLdz9m+oyFsMQyZTbqZuiVYqOgxFNOpEE1A48n/F/ClI vhxToNlrZinAiQnRo/jWQwgDpbsP X-Google-Smtp-Source: ABdhPJzgC5xLDRaejyWDVVi05gQp/Z2RtkQAu5F9A08rn3zRvuTwDr66A83xrsZieUU8YXDKSpVvig== X-Received: by 2002:adf:e782:: with SMTP id n2mr35082777wrm.417.1593074314539; Thu, 25 Jun 2020 01:38:34 -0700 (PDT) Received: from LAPTOP-4L3N7KFS.localdomain (nat2.panoulu.net. [185.38.2.2]) by smtp.gmail.com with ESMTPSA id f186sm11177631wmf.29.2020.06.25.01.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 01:38:33 -0700 (PDT) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Thu, 25 Jun 2020 11:37:45 +0300 Message-Id: <20200625083745.211-1-lstipakov@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200401193258.GY1431@greenie.muc.de> References: <20200401193258.GY1431@greenie.muc.de> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (lstipakov[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.66 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.66 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: 1joNPE-00HaaK-OV Subject: [Openvpn-devel] [PATCH v2] msvc: fix various level2 warnings 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 Also set warnings level to level2 and enable "treat warnings as errors" flag. Signed-off-by: Lev Stipakov --- src/compat/Debug.props | 1 - src/openvpn/block_dns.c | 3 --- src/openvpn/crypto_openssl.c | 2 +- src/openvpn/init.c | 2 +- src/openvpn/mtu.c | 4 ++-- src/openvpn/openvpn.vcxproj | 26 +++++++++++++++++--------- src/openvpn/options.c | 2 +- src/openvpn/route.c | 2 +- src/openvpn/ssl_backend.h | 2 +- src/openvpn/tun.c | 5 +++-- 10 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/compat/Debug.props b/src/compat/Debug.props index e5e9f681..31bb9d91 100644 --- a/src/compat/Debug.props +++ b/src/compat/Debug.props @@ -15,7 +15,6 @@ _DEBUG;%(PreprocessorDefinitions) MultiThreadedDebugDLL EditAndContinue - true diff --git a/src/openvpn/block_dns.c b/src/openvpn/block_dns.c index 889d6bb9..f4718fc2 100644 --- a/src/openvpn/block_dns.c +++ b/src/openvpn/block_dns.c @@ -109,9 +109,6 @@ DEFINE_GUID( static WCHAR *FIREWALL_NAME = L"OpenVPN"; -VOID NETIOAPI_API_ -InitializeIpInterfaceEntry(PMIB_IPINTERFACE_ROW Row); - /* * Default msg handler does nothing */ diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c index 2027d8dc..8805e25e 100644 --- a/src/openvpn/crypto_openssl.c +++ b/src/openvpn/crypto_openssl.c @@ -315,7 +315,7 @@ show_available_ciphers(void) } } - qsort(cipher_list, num_ciphers, sizeof(*cipher_list), cipher_name_cmp); + qsort((void *)cipher_list, num_ciphers, sizeof(*cipher_list), cipher_name_cmp); for (i = 0; i < num_ciphers; i++) { diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 2c8db68d..107bb4c9 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -1812,7 +1812,7 @@ do_open_tun(struct context *c) #ifdef _WIN32 /* store (hide) interactive service handle in tuntap_options */ c->c1.tuntap->options.msg_channel = c->options.msg_channel; - msg(D_ROUTE, "interactive service msg_channel=%u", (unsigned int) c->options.msg_channel); + msg(D_ROUTE, "interactive service msg_channel=%u", (unsigned long long) c->options.msg_channel); #endif /* allocate route list structure */ diff --git a/src/openvpn/mtu.c b/src/openvpn/mtu.c index 04868cd6..8178ff06 100644 --- a/src/openvpn/mtu.c +++ b/src/openvpn/mtu.c @@ -175,7 +175,7 @@ set_mtu_discover_type(int sd, int mtu_type, sa_family_t proto_af) #if defined(HAVE_SETSOCKOPT) && defined(IP_MTU_DISCOVER) case AF_INET: if (setsockopt - (sd, IPPROTO_IP, IP_MTU_DISCOVER, &mtu_type, sizeof(mtu_type))) + (sd, IPPROTO_IP, IP_MTU_DISCOVER, (const char *)&mtu_type, sizeof(mtu_type))) { msg(M_ERR, "Error setting IP_MTU_DISCOVER type=%d on TCP/UDP socket", mtu_type); @@ -186,7 +186,7 @@ set_mtu_discover_type(int sd, int mtu_type, sa_family_t proto_af) #if defined(HAVE_SETSOCKOPT) && defined(IPV6_MTU_DISCOVER) case AF_INET6: if (setsockopt - (sd, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &mtu_type, sizeof(mtu_type))) + (sd, IPPROTO_IPV6, IPV6_MTU_DISCOVER, (const char *)&mtu_type, sizeof(mtu_type))) { msg(M_ERR, "Error setting IPV6_MTU_DISCOVER type=%d on TCP6/UDP6 socket", mtu_type); diff --git a/src/openvpn/openvpn.vcxproj b/src/openvpn/openvpn.vcxproj index 53ac5482..c34733ea 100644 --- a/src/openvpn/openvpn.vcxproj +++ b/src/openvpn/openvpn.vcxproj @@ -28,23 +28,23 @@ Application true - Unicode + NotSet v142 Application true - Unicode + NotSet v142 Application - Unicode + NotSet v142 Application - Unicode + NotSet v142 @@ -74,7 +74,9 @@ ..\compat;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) _CONSOLE;%(PreprocessorDefinitions) - UNICODE;%(UndefinePreprocessorDefinitions) + %(UndefinePreprocessorDefinitions) + Level2 + true @@ -87,7 +89,9 @@ ..\compat;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) _CONSOLE;%(PreprocessorDefinitions) - UNICODE;%(UndefinePreprocessorDefinitions) + %(UndefinePreprocessorDefinitions) + Level2 + true @@ -100,7 +104,9 @@ ..\compat;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) _CONSOLE;%(PreprocessorDefinitions) - UNICODE;%(UndefinePreprocessorDefinitions) + %(UndefinePreprocessorDefinitions) + Level2 + true @@ -113,7 +119,9 @@ ..\compat;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) _CONSOLE;%(PreprocessorDefinitions) - UNICODE;%(UndefinePreprocessorDefinitions) + %(UndefinePreprocessorDefinitions) + Level2 + true @@ -307,4 +315,4 @@ - + \ No newline at end of file diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 16f9da6a..3484f7d4 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -7276,7 +7276,7 @@ add_option(struct options *options, #ifdef _WIN32 VERIFY_PERMISSION(OPT_P_GENERAL); HANDLE process = GetCurrentProcess(); - HANDLE handle = (HANDLE) atoi(p[1]); + HANDLE handle = (HANDLE) atoll(p[1]); if (!DuplicateHandle(process, handle, process, &options->msg_channel, 0, FALSE, DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 9ff36359..b57da5dd 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -2833,7 +2833,7 @@ get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6, DestinationAddress.Ipv6.sin6_addr = *dest; } - status = GetBestInterfaceEx( &DestinationAddress, &BestIfIndex ); + status = GetBestInterfaceEx( (struct sockaddr *)&DestinationAddress, &BestIfIndex ); if (status != NO_ERROR) { diff --git a/src/openvpn/ssl_backend.h b/src/openvpn/ssl_backend.h index a1770bd4..5e1055b6 100644 --- a/src/openvpn/ssl_backend.h +++ b/src/openvpn/ssl_backend.h @@ -534,7 +534,7 @@ void print_details(struct key_state_ssl *ks_ssl, const char *prefix); void show_available_tls_ciphers_list(const char *cipher_list, const char *tls_cert_profile, - bool tls13); + const bool tls13); /* * Show the available elliptic curves in the crypto library diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 0e6dfe72..d5ca3ce3 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -233,10 +233,11 @@ do_set_mtu_service(const struct tuntap *tt, const short family, const int mtu) sizeof(set_mtu_message_t), 0 }, - .iface = {.index = tt->adapter_index,.name = tt->actual_name }, + .iface = {.index = tt->adapter_index}, .mtu = mtu, .family = family }; + strncpynt(mtu_msg.iface.name, tt->actual_name, sizeof(mtu_msg.iface.name)); if (!send_msg_iservice(pipe, &mtu_msg, sizeof(mtu_msg), &ack, "Set_mtu")) { @@ -889,7 +890,7 @@ add_route_connected_v6_net(struct tuntap *tt, } void -delete_route_connected_v6_net(struct tuntap *tt, +delete_route_connected_v6_net(const struct tuntap *tt, const struct env_set *es) { struct route_ipv6 r6;