From patchwork Tue Oct 10 12:11:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Rozman X-Patchwork-Id: 19 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director2.mail.ord1d.rsapps.net ([172.30.157.8]) by backend31.mail.ord1d.rsapps.net (Dovecot) with LMTP id sQ7uEdhT3Vn8EAAAgoeIoA for ; Tue, 10 Oct 2017 19:12:24 -0400 Received: from proxy3.mail.ord1d.rsapps.net ([172.30.157.20]) by director2.mail.ord1d.rsapps.net (Dovecot) with LMTP id uZblEdhT3VkIIgAAgYhSiA ; Tue, 10 Oct 2017 19:12:24 -0400 Received: from smtp11.gate.ord1c ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy3.mail.ord1d.rsapps.net (Dovecot) with LMTP id aGFgAGJT3VkFYAAA7WKfLA ; Tue, 10 Oct 2017 19:12:24 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-MessageSniffer-Scan-Result: 0 X-MessageSniffer-Rules: 0-298-1045-1262-w 0-298-1045-1626-w 0-298-0-13622-f X-CMAE-Scan-Result: 0 X-CNFS-Analysis: v=2.2 cv=PLBNwriC c=1 sm=1 tr=0 a=Q8DxjiC8O3VT/NpP1XjEZQ==:117 a=Q8DxjiC8O3VT/NpP1XjEZQ==:17 a=kj9zAlcOel0A:10 a=02M-m0pO-4AA:10 a=WiVod9pSvdkA:10 a=9sSjY8p1AAAA:8 a=P_JWiMecAAAA:8 a=FP58Ms26AAAA:8 a=mpEHOEdKiDi3SPtJlZkA:9 a=LwAVnjRaDGGQmuPT:21 a=mpjeYKLOz0ShiI-I:21 a=CjuIK1q_8ugA:10 a=-FEs8UIgK8oA:10 a=NWVoK91CQyQA:10 a=ub54wNWiXv_DzeFsgEJW:22 a=D0-HAvA3Hk9NMREbgwuX:22 X-Orig-To: justin@openvpn.net X-Originating-Ip: [216.34.181.88] Authentication-Results: smtp11.gate.ord1c.rsapps.net; iprev=pass policy.iprev="216.34.181.88"; 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=rozman.si; dmarc=fail (p=none; dis=none) header.from=rozman.si X-Classification-ID: 7965b47e-ae10-11e7-b559-bc305beffa54-1-1 Received: from [216.34.181.88] ([216.34.181.88:43186] helo=lists.sourceforge.net) by smtp11.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 0B/67-06815-7D35DD95; Tue, 10 Oct 2017 19:12:23 -0400 Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1e23gi-00006A-UR; Tue, 10 Oct 2017 23:11:48 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.89) (envelope-from ) id 1e23ge-000060-KN for openvpn-devel@lists.sourceforge.net; Tue, 10 Oct 2017 23:11:44 +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; bh=mEEL8Umh1UoodzeS5iIfAN8YrNBLpRjIr29LgyeA6w0=; b=Yvp8yaDW4KHJenC5pBh4KCP7kLShPLVXG+y47T4DU/q5wNZs74FsunGT5UbRSLWqfBJwxC/tcAlG3JrB7LiSLLxnjApvSaWUPUEZe21hchy1VyLy5lMlCVn5/mkiVJ0OA9ff8ZfPwuK3G9nuUDs1/Y+rujoK3caQQ7FB8lB4OlI=; 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; bh=mEEL8Umh1UoodzeS5iIfAN8YrNBLpRjIr29LgyeA6w0=; b=JJzzVoFFSAUU90vjE8QMJEw5qDzlpYnrOOSXvylKxl8lA82ltnsEZJybshaxU2k8iQ0QWVjCSk8s9rC58vD2d6L524uu3jt1apnYrt5qWsta3R+hefJCiZbeZ/eFt5p6rAQS7KsR4NENC/AbgkzU028QekgseG/KzaV2Rn+RJ7U=; Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of rozman.si designates 89.212.80.145 as permitted sender) client-ip=89.212.80.145; envelope-from=simon@rozman.si; helo=amebis01.amebis.si; Received: from amebis01.amebis.si ([89.212.80.145]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1e23gb-0007JV-KZ for openvpn-devel@lists.sourceforge.net; Tue, 10 Oct 2017 23:11:44 +0000 Received: from SR5.amebis.doma (unknown [192.168.100.253]) by amebis01.amebis.si (Postfix) with ESMTP id 9DE8140606; Wed, 11 Oct 2017 01:11:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=rozman.si; s=default; t=1507677092; bh=q91D0XQdLobMxbs0+fyiCITCpeGcRU+nbt7ad31tn4s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=Ynqi+2jxHQVApWzrfq0bYFEGweuKpTu8DwhZ6uRJleAJb1IpUM+wPcpJI13rj5SQL g7c4GB4d0pbn8RYmz/ZaYSwLkd9WsV4e4U/WxLN0q2jrgZfhpt58HINKRHGBsK7yDD 5eUpPkShuSW+vCChdrXqksjMfRebQKzM9SWMIFU8= From: simon@rozman.si To: openvpn-devel@lists.sourceforge.net Date: Wed, 11 Oct 2017 01:11:22 +0200 Message-Id: <20171010231130.6832-5-simon@rozman.si> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20171010231130.6832-1-simon@rozman.si> References: <20171010231130.6832-1-simon@rozman.si> 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 http://www.dnswl.org/, no trust [89.212.80.145 listed in list.dnswl.org] -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1e23gb-0007JV-KZ Subject: [Openvpn-devel] [PATCH 05/13] Function prototypes are declared as "typedef ( *type_name)()" in MSVC. 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: Simon Rozman Note: NETIOAPI_API is defined as: #define NETIOAPI_API NETIO_STATUS NETIOAPI_API_ #define NETIOAPI_API_ WINAPI I am not sure whether interactive.c will compile using mingw with this patch. If not: 1. We can introduce some #ifdef _MSC_VER #else #endif 2. Since NTDDI_VERSION=NTDDI_VISTA, most of the dynamic API loading by GetProcAddress() could be simplified to statically linked API calls, avoiding function prototype declarations altogether. I suggest we do this anyway to clean-up the code in the future. --- src/openvpnserv/interactive.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 7ff45b1..8d94197 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -550,7 +550,7 @@ InterfaceLuid(const char *iface_name, PNET_LUID luid) LPWSTR wide_name; int n; - typedef NETIO_STATUS WINAPI (*ConvertInterfaceAliasToLuidFn) (LPCWSTR, PNET_LUID); + typedef NETIO_STATUS (WINAPI *ConvertInterfaceAliasToLuidFn) (LPCWSTR, PNET_LUID); static ConvertInterfaceAliasToLuidFn ConvertInterfaceAliasToLuid = NULL; if (!ConvertInterfaceAliasToLuid) { @@ -585,7 +585,7 @@ CmpAddress(LPVOID item, LPVOID address) static DWORD DeleteAddress(PMIB_UNICASTIPADDRESS_ROW addr_row) { - typedef NETIOAPI_API (*DeleteUnicastIpAddressEntryFn) (const PMIB_UNICASTIPADDRESS_ROW); + typedef NETIO_STATUS (NETIOAPI_API_ *DeleteUnicastIpAddressEntryFn) (const PMIB_UNICASTIPADDRESS_ROW); static DeleteUnicastIpAddressEntryFn DeleteUnicastIpAddressEntry = NULL; if (!DeleteUnicastIpAddressEntry) @@ -613,8 +613,8 @@ HandleAddressMessage(address_message_t *msg, undo_lists_t *lists) PMIB_UNICASTIPADDRESS_ROW addr_row; BOOL add = msg->header.type == msg_add_address; - typedef NETIOAPI_API (*CreateUnicastIpAddressEntryFn) (const PMIB_UNICASTIPADDRESS_ROW); - typedef NETIOAPI_API (*InitializeUnicastIpAddressEntryFn) (PMIB_UNICASTIPADDRESS_ROW); + typedef NETIO_STATUS (NETIOAPI_API_ *CreateUnicastIpAddressEntryFn) (const PMIB_UNICASTIPADDRESS_ROW); + typedef NETIO_STATUS (NETIOAPI_API_ *InitializeUnicastIpAddressEntryFn) (PMIB_UNICASTIPADDRESS_ROW); static CreateUnicastIpAddressEntryFn CreateUnicastIpAddressEntry = NULL; static InitializeUnicastIpAddressEntryFn InitializeUnicastIpAddressEntry = NULL; @@ -707,7 +707,7 @@ CmpRoute(LPVOID item, LPVOID route) static DWORD DeleteRoute(PMIB_IPFORWARD_ROW2 fwd_row) { - typedef NETIOAPI_API (*DeleteIpForwardEntry2Fn) (PMIB_IPFORWARD_ROW2); + typedef NETIO_STATUS (NETIOAPI_API_ *DeleteIpForwardEntry2Fn) (PMIB_IPFORWARD_ROW2); static DeleteIpForwardEntry2Fn DeleteIpForwardEntry2 = NULL; if (!DeleteIpForwardEntry2) @@ -735,7 +735,7 @@ HandleRouteMessage(route_message_t *msg, undo_lists_t *lists) PMIB_IPFORWARD_ROW2 fwd_row; BOOL add = msg->header.type == msg_add_route; - typedef NETIOAPI_API (*CreateIpForwardEntry2Fn) (PMIB_IPFORWARD_ROW2); + typedef NETIO_STATUS (NETIOAPI_API_ *CreateIpForwardEntry2Fn) (PMIB_IPFORWARD_ROW2); static CreateIpForwardEntry2Fn CreateIpForwardEntry2 = NULL; if (!CreateIpForwardEntry2) @@ -821,7 +821,7 @@ out: static DWORD HandleFlushNeighborsMessage(flush_neighbors_message_t *msg) { - typedef NETIOAPI_API (*FlushIpNetTable2Fn) (ADDRESS_FAMILY, NET_IFINDEX); + typedef NETIO_STATUS (NETIOAPI_API_ *FlushIpNetTable2Fn) (ADDRESS_FAMILY, NET_IFINDEX); static FlushIpNetTable2Fn flush_fn = NULL; if (msg->family == AF_INET)