From patchwork Mon Oct 29 21:53:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 579 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.28.255.1]) by backend30.mail.ord1d.rsapps.net with LMTP id QDzGNQYd2FuLawAAIUCqbw for ; Tue, 30 Oct 2018 04:57:42 -0400 Received: from director7.mail.ord1c.rsapps.net ([172.28.255.1]) by director9.mail.ord1d.rsapps.net with LMTP id kIqbNQYd2Ft8dAAAalYnBA ; Tue, 30 Oct 2018 04:57:42 -0400 Received: from smtp15.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by director7.mail.ord1c.rsapps.net with LMTP id APlONQYd2FuzGAAAqdfm7w ; Tue, 30 Oct 2018 04:57:42 -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: smtp15.gate.ord1c.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: db913034-dc21-11e8-8aee-bc305bf03694-1-1 Received: from [216.105.38.7] ([216.105.38.7:14958] helo=lists.sourceforge.net) by smtp15.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 0C/EB-00896-50D18DB5; Tue, 30 Oct 2018 04:57:41 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1gHPpZ-0006QC-F5; Tue, 30 Oct 2018 08:56:57 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gHPpY-0006Q5-NS for openvpn-devel@lists.sourceforge.net; Tue, 30 Oct 2018 08:56:56 +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:To: From:Sender:Reply-To:Cc: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=772n1EjJQYc6Y5SC6QxaG4tG31FlkhUPNivMaSVt9TI=; b=SdktlLBbJRB0JKJia4K5xByX+y 2GRsqZh3Q1slMKTYBXtokVl5XU00eg2ON8kqh94rY8Rv0ruAXt/beGlQPqxFOmdo9tyGARfAzdLve Do70qsF/p927Sax5HlPUCuf1+xvWjJ5b1SdJDWvoWHuW9UeCZZprIT5/YHY1FWr+ZbfY=; 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:To:From:Sender:Reply-To:Cc :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=772n1EjJQYc6Y5SC6QxaG4tG31FlkhUPNivMaSVt9TI=; b=WergxCcooC+8hywwCB9dOOkbAU pL+Of86ToBFvHCeS7Bzqs2uj0atj+aoiTtaWsS8pKPuDjMGwwJNIUGN9EuQmSUJ8FDDwTGvDaPHks 4UiLEDZFzWxAKI48r3QuVDfmOyne4iIRCD5gkMFzdxoefIqZAu1Wg/+UuFHXQ13IBnIs=; Received: from mail-ed1-f53.google.com ([209.85.208.53]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) id 1gHPpM-00EqZx-3L for openvpn-devel@lists.sourceforge.net; Tue, 30 Oct 2018 08:56:56 +0000 Received: by mail-ed1-f53.google.com with SMTP id d6-v6so1668805edi.2 for ; Tue, 30 Oct 2018 01:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=772n1EjJQYc6Y5SC6QxaG4tG31FlkhUPNivMaSVt9TI=; b=MQlrZThdNxbGuAPRP0eXle0uFQoPXb1ST2BIj8ZgTab+0otd2EqL2Mp+pYNm+HD7LY trGK7fqbOPz+G3fta/NJU4BnaJ+1IxikpFKkgO+3r0g/WxaEfIHo8QOVaYt6ogTxeFD8 NZNoOhnPrToUTb/Cg1HBbT4cPfQJUQTTgZtb6AEDlAKj6HhQ/Sd/Ek7MutCP9fpbUVrD WucwxIloQVP3NkTXnZn5puXGT8+eTePbg/AbXJhkmO7NgKla95OFVju1E4xBDHRyiu4p S2IwKG7Xctie+MHYeaow/5oBF6wwKzlWiQT4HnN8WI7wsSOWsPfUgj+H4JisxX5831ib 7//A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=772n1EjJQYc6Y5SC6QxaG4tG31FlkhUPNivMaSVt9TI=; b=JauNox0FlffqO+LbV0gFGjKXQPGpQ41Hs6UKNvl2M3RB2OGHcfzmXgCoa0yQgutFz2 QpaIdJKknOe7LgoyUCWBGKS+MV9ytmrMf6LcnWjTPlNuNI4hrFBCnmNvekyy4CtzqMj5 heDFtPLnYH3Z1lU8xfQyVlNrsF4TvQZ9fTvzECNWwuoMxukNGjN5ZfzeqAc14xyNtIRe 0sGeLsMPRAlzk7CUQbPx555i+4rewt/P83C4uVaoKecLJiKrBLneMZxgFOxXbaCa9TQN qgAjn38DCCbDlFehi77CqbF6KPwvloEDt79kbJnXTmcm4/j6BCDaRwGG7uH84jBKHz3x J6AQ== X-Gm-Message-State: AGRZ1gJyrqr8rhSCvxqDUoWYsAPYASd9KBY7xFaIA4dMxjYZxSRyQX3G JHltq6UK8zK9mbu8a5SQ3LoSbUQ8/uQ= X-Google-Smtp-Source: AJdET5eR5eYF5CFbuhfOPVpR/6NIu7onwwLFNWrWCBOPRiDHK6U/HOC1YEGVwX0doepgia43bysTGA== X-Received: by 2002:a50:e602:: with SMTP id y2-v6mr16653902edm.278.1540889796978; Tue, 30 Oct 2018 01:56:36 -0700 (PDT) Received: from stipakov.fi (stipakov.fi. [128.199.52.117]) by smtp.gmail.com with ESMTPSA id r55-v6sm8336694edd.80.2018.10.30.01.56.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Oct 2018 01:56:36 -0700 (PDT) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Tue, 30 Oct 2018 10:53:35 +0200 Message-Id: <1540889615-24868-1-git-send-email-lstipakov@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <5abb34c1-22c7-ffd8-80eb-06250175ccff@sf.lists.topphemmelig.net> References: <5abb34c1-22c7-ffd8-80eb-06250175ccff@sf.lists.topphemmelig.net> 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 http://www.dnswl.org/, no trust [209.85.208.53 listed in list.dnswl.org] -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: 1gHPpM-00EqZx-3L Subject: [Openvpn-devel] [PATCH v2] Fix various compiler 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Lev Stipakov This patch fixes "unused variable/unreferenced format parameter" warnings in different places, kudos to Visual Studio compiler for discoveing some of those. This also also removes unneeded uninit_management_callback_multi() wrapper. Signed-off-by: Lev Stipakov Acked-by: Arne Schwabe --- v2: remove unneeded uninit_management_callback_multi() wrapper src/openvpn/forward.c | 2 +- src/openvpn/init.c | 2 +- src/openvpn/init.h | 2 +- src/openvpn/mtcp.c | 2 +- src/openvpn/mudp.c | 2 +- src/openvpn/multi.c | 32 ++++++++++++-------------------- src/openvpn/multi.h | 9 +++------ src/openvpn/openvpn.c | 2 +- src/openvpn/tun.c | 11 ++++------- src/openvpn/tun.h | 2 +- src/openvpn/win32.c | 3 +-- 11 files changed, 27 insertions(+), 42 deletions(-) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index f8faa81..35de490 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1251,7 +1251,7 @@ read_incoming_tun(struct context *c) c->c2.buf = c->c2.buffers->read_tun_buf; #ifdef TUN_PASS_BUFFER - read_tun_buffered(c->c1.tuntap, &c->c2.buf, MAX_RW_SIZE_TUN(&c->c2.frame)); + read_tun_buffered(c->c1.tuntap, &c->c2.buf); #else ASSERT(buf_init(&c->c2.buf, FRAME_HEADROOM(&c->c2.frame))); ASSERT(buf_safe(&c->c2.buf, MAX_RW_SIZE_TUN(&c->c2.frame))); diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 882337b..979a20b 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -3919,7 +3919,7 @@ init_management_callback_p2p(struct context *c) #ifdef ENABLE_MANAGEMENT void -init_management(struct context *c) +init_management(void) { if (!management) { diff --git a/src/openvpn/init.h b/src/openvpn/init.h index 085ac53..d4bacf4 100644 --- a/src/openvpn/init.h +++ b/src/openvpn/init.h @@ -119,7 +119,7 @@ void initialization_sequence_completed(struct context *c, const unsigned int fla #ifdef ENABLE_MANAGEMENT -void init_management(struct context *c); +void init_management(void); bool open_management(struct context *c); diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c index a53efad..abe2059 100644 --- a/src/openvpn/mtcp.c +++ b/src/openvpn/mtcp.c @@ -834,7 +834,7 @@ tunnel_server_tcp(struct context *top) #endif /* shut down management interface */ - uninit_management_callback_multi(&multi); + uninit_management_callback(); /* save ifconfig-pool */ multi_ifconfig_pool_persist(&multi, true); diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index a604d21..b7f061a 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -362,7 +362,7 @@ tunnel_server_udp_single_threaded(struct context *top) #endif /* shut down management interface */ - uninit_management_callback_multi(&multi); + uninit_management_callback(); /* save ifconfig-pool */ multi_ifconfig_pool_persist(&multi, true); diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 8440f31..54f867f 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -557,8 +557,7 @@ setenv_stats(struct context *c) } static void -multi_client_disconnect_setenv(struct multi_context *m, - struct multi_instance *mi) +multi_client_disconnect_setenv(struct multi_instance *mi) { /* setenv client real IP address */ setenv_trusted(mi->context.c2.es, get_link_socket_info(&mi->context)); @@ -571,13 +570,12 @@ multi_client_disconnect_setenv(struct multi_context *m, } static void -multi_client_disconnect_script(struct multi_context *m, - struct multi_instance *mi) +multi_client_disconnect_script(struct multi_instance *mi) { if ((mi->context.c2.context_auth == CAS_SUCCEEDED && mi->connection_established_flag) || mi->context.c2.context_auth == CAS_PARTIAL) { - multi_client_disconnect_setenv(m, mi); + multi_client_disconnect_setenv(mi); if (plugin_defined(mi->context.plugins, OPENVPN_PLUGIN_CLIENT_DISCONNECT)) { @@ -684,7 +682,7 @@ multi_close_instance(struct multi_context *m, set_cc_config(mi, NULL); #endif - multi_client_disconnect_script(m, mi); + multi_client_disconnect_script(mi); if (mi->did_open_context) { @@ -1112,7 +1110,7 @@ multi_learn_addr(struct multi_context *m, if (oldroute) /* route already exists? */ { - if (route_quota_test(m, mi) && learn_address_script(m, mi, "update", &newroute->addr)) + if (route_quota_test(mi) && learn_address_script(m, mi, "update", &newroute->addr)) { learn_succeeded = true; owner = mi; @@ -1129,7 +1127,7 @@ multi_learn_addr(struct multi_context *m, } else { - if (route_quota_test(m, mi) && learn_address_script(m, mi, "add", &newroute->addr)) + if (route_quota_test(mi) && learn_address_script(m, mi, "add", &newroute->addr)) { learn_succeeded = true; owner = mi; @@ -1579,7 +1577,7 @@ multi_select_virtual_addr(struct multi_context *m, struct multi_instance *mi) * Set virtual address environmental variables. */ static void -multi_set_virtual_addr_env(struct multi_context *m, struct multi_instance *mi) +multi_set_virtual_addr_env(struct multi_instance *mi) { setenv_del(mi->context.c2.es, "ifconfig_pool_local_ip"); setenv_del(mi->context.c2.es, "ifconfig_pool_remote_ip"); @@ -1658,7 +1656,7 @@ multi_client_connect_post(struct multi_context *m, * directory or any --ifconfig-pool dynamic address. */ multi_select_virtual_addr(m, mi); - multi_set_virtual_addr_env(m, mi); + multi_set_virtual_addr_env(mi); } } @@ -1702,7 +1700,7 @@ multi_client_connect_post_plugin(struct multi_context *m, * directory or any --ifconfig-pool dynamic address. */ multi_select_virtual_addr(m, mi); - multi_set_virtual_addr_env(m, mi); + multi_set_virtual_addr_env(mi); } } @@ -1742,7 +1740,7 @@ multi_client_connect_mda(struct multi_context *m, * directory or any --ifconfig-pool dynamic address. */ multi_select_virtual_addr(m, mi); - multi_set_virtual_addr_env(m, mi); + multi_set_virtual_addr_env(mi); } } @@ -1761,7 +1759,7 @@ multi_client_connect_setenv(struct multi_context *m, setenv_trusted(mi->context.c2.es, get_link_socket_info(&mi->context)); /* setenv client virtual IP address */ - multi_set_virtual_addr_env(m, mi); + multi_set_virtual_addr_env(mi); /* setenv connection time */ { @@ -2936,7 +2934,7 @@ multi_process_drop_outgoing_tun(struct multi_context *m, const unsigned int mpp_ */ void -route_quota_exceeded(const struct multi_context *m, const struct multi_instance *mi) +route_quota_exceeded(const struct multi_instance *mi) { struct gc_arena gc = gc_new(); msg(D_ROUTE_QUOTA, "MULTI ROUTE: route quota (%d) exceeded for %s (see --max-routes-per-client option)", @@ -3372,12 +3370,6 @@ init_management_callback_multi(struct multi_context *m) #endif /* ifdef ENABLE_MANAGEMENT */ } -void -uninit_management_callback_multi(struct multi_context *m) -{ - uninit_management_callback(); -} - /* * Top level event loop. */ diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h index 3d3d687..0e5872c 100644 --- a/src/openvpn/multi.h +++ b/src/openvpn/multi.h @@ -346,9 +346,6 @@ void multi_close_instance_on_signal(struct multi_context *m, struct multi_instan void init_management_callback_multi(struct multi_context *m); -void uninit_management_callback_multi(struct multi_context *m); - - #ifdef ENABLE_ASYNC_PUSH /** * Called when inotify event is fired, which happens when acf file is closed or deleted. @@ -403,7 +400,7 @@ multi_process_outgoing_link_pre(struct multi_context *m) * Per-client route quota management */ -void route_quota_exceeded(const struct multi_context *m, const struct multi_instance *mi); +void route_quota_exceeded(const struct multi_instance *mi); static inline void route_quota_inc(struct multi_instance *mi) @@ -419,11 +416,11 @@ route_quota_dec(struct multi_instance *mi) /* can we add a new route? */ static inline bool -route_quota_test(const struct multi_context *m, const struct multi_instance *mi) +route_quota_test(const struct multi_instance *mi) { if (mi->route_count >= mi->context.options.max_routes_per_client) { - route_quota_exceeded(m, mi); + route_quota_exceeded(mi); return false; } else diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c index 5d6a41c..ad73af5 100644 --- a/src/openvpn/openvpn.c +++ b/src/openvpn/openvpn.c @@ -199,7 +199,7 @@ openvpn_main(int argc, char *argv[]) #ifdef ENABLE_MANAGEMENT /* initialize management subsystem */ - init_management(&c); + init_management(); #endif /* initialize options to default state */ diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index c091401..5fc33f0 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -4866,7 +4866,6 @@ void ipconfig_register_dns(const struct env_set *es) { struct argv argv = argv_new(); - bool status; const char err[] = "ERROR: Windows ipconfig command failed"; msg(D_TUNTAP_INFO, "Start ipconfig commands for register-dns..."); @@ -4876,14 +4875,14 @@ ipconfig_register_dns(const struct env_set *es) get_win_sys_path(), WIN_IPCONFIG_PATH_SUFFIX); argv_msg(D_TUNTAP_INFO, &argv); - status = openvpn_execve_check(&argv, es, 0, err); + openvpn_execve_check(&argv, es, 0, err); argv_reset(&argv); argv_printf(&argv, "%s%sc /registerdns", get_win_sys_path(), WIN_IPCONFIG_PATH_SUFFIX); argv_msg(D_TUNTAP_INFO, &argv); - status = openvpn_execve_check(&argv, es, 0, err); + openvpn_execve_check(&argv, es, 0, err); argv_reset(&argv); netcmd_semaphore_release(); @@ -5177,8 +5176,7 @@ netsh_ifconfig(const struct tuntap_options *to, } static void -netsh_enable_dhcp(const struct tuntap_options *to, - const char *actual_name) +netsh_enable_dhcp(const char *actual_name) { struct argv argv = argv_new(); @@ -5198,7 +5196,6 @@ netsh_enable_dhcp(const struct tuntap_options *to, static bool service_enable_dhcp(const struct tuntap *tt) { - DWORD len; bool ret = false; ack_message_t ack; struct gc_arena gc = gc_new(); @@ -5719,7 +5716,7 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun } else { - netsh_enable_dhcp(&tt->options, tt->actual_name); + netsh_enable_dhcp(tt->actual_name); } } dhcp_masq = true; diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h index cb1ab1c..9ed8ef0 100644 --- a/src/openvpn/tun.h +++ b/src/openvpn/tun.h @@ -457,7 +457,7 @@ tun_write_win32(struct tuntap *tt, struct buffer *buf) } static inline int -read_tun_buffered(struct tuntap *tt, struct buffer *buf, int maxsize) +read_tun_buffered(struct tuntap *tt, struct buffer *buf) { return tun_finalize(tt->hand, &tt->reads, buf); } diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c index e43296e..2e8a4b0 100644 --- a/src/openvpn/win32.c +++ b/src/openvpn/win32.c @@ -685,11 +685,10 @@ win32_pause(struct win32_signal *ws) { if (ws->mode == WSO_MODE_CONSOLE && HANDLE_DEFINED(ws->in.read)) { - int status; msg(M_INFO|M_NOPREFIX, "Press any key to continue..."); do { - status = WaitForSingleObject(ws->in.read, INFINITE); + WaitForSingleObject(ws->in.read, INFINITE); } while (!win32_keyboard_get(ws)); } }