From patchwork Wed Mar 24 11:23:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1656 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.27.255.8]) by backend30.mail.ord1d.rsapps.net with LMTP id eBUvOR68W2DdTgAAIUCqbw (envelope-from ) for ; Wed, 24 Mar 2021 18:24:30 -0400 Received: from proxy2.mail.iad3a.rsapps.net ([172.27.255.8]) by director7.mail.ord1d.rsapps.net with LMTP id qP0HOR68W2CDegAAovjBpQ (envelope-from ) for ; Wed, 24 Mar 2021 18:24:30 -0400 Received: from smtp24.gate.iad3a ([172.27.255.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy2.mail.iad3a.rsapps.net with LMTPS id 4CQjMh68W2AGEwAABcWvHw (envelope-from ) for ; Wed, 24 Mar 2021 18:24:30 -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: smtp24.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; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: b330198a-8cef-11eb-869e-5254009f6f51-1-1 Received: from [216.105.38.7] ([216.105.38.7:43972] helo=lists.sourceforge.net) by smtp24.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id E9/69-00652-E1CBB506; Wed, 24 Mar 2021 18:24:30 -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 1lPBuj-0000rM-GV; Wed, 24 Mar 2021 22:23:45 +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 1lPBug-0000rE-LU for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 22:23:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TS5SovzGZgcoSsEE6g83J5PHyuG8hnSgoHQbWY9pQdI=; b=ExenmUQk5m7zJ+NkPCiW13vZaQ MYSoneTAWExm8XyJNhJYB/AXvhRNYwC9SpKjBXDuRB0y2WaFofoWSAkza67/khSMJ7gqPf6iYkOCJ TWqLZJAd9mZecE+Lw33OdPFjw9n299hEPdd448k/CaVH1PGgRRkvl2d/KhPpyPs++pNw=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=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: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=TS5SovzGZgcoSsEE6g83J5PHyuG8hnSgoHQbWY9pQdI=; b=WMLlaVCu8B2RuzJL3f8o/xTASg KGLzgAs8E0T7+4auI0Ub8EXfds1Ry0Wthw3WdbJMzzuAccgE+KuNds5gIdRbYrNcmoso+xbDzcFp7 g7G8tMyruQBCivmfVW0u/goZ9qocB/qHXpTuz4wdzjGCowgV4ci9DPI09TB+QMrOdbbk=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1lPBuc-007CbX-8B for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 22:23:42 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1lPBuV-000ExF-1X for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 23:23:31 +0100 Received: (nullmailer pid 506 invoked by uid 10006); Wed, 24 Mar 2021 22:23:30 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 24 Mar 2021 23:23:27 +0100 Message-Id: <20210324222330.455-1-arne@rfc2549.org> 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 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: rfc2549.org] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1lPBuc-007CbX-8B Subject: [Openvpn-devel] [PATCH 1/4] Make buffer related function conversion explicit when narrowing 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 Clang and gcc do report many of the narrowing conversion that MSVC reports, like these: warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data This commit changes int to size_t where it is safe (e.g. checked by buf_size_valid) and add casts where necessary. In the function buffer_read_from_file the return value of fread is size_t (at least on Linux/Windows/macOS and cppreference), so fix the check to actually make sense. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/buffer.c | 20 ++++++++++---------- src/openvpn/buffer.h | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index 35d9ecdc..48bf25d5 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -661,7 +661,7 @@ rm_trailing_chars(char *str, const char *what_to_delete) bool modified; do { - const int len = strlen(str); + const size_t len = strlen(str); modified = false; if (len > 0) { @@ -687,7 +687,7 @@ string_alloc(const char *str, struct gc_arena *gc) { if (str) { - const int n = strlen(str) + 1; + const size_t n = strlen(str) + 1; char *ret; if (gc) @@ -814,7 +814,7 @@ string_alloc_buf(const char *str, struct gc_arena *gc) bool buf_string_match_head_str(const struct buffer *src, const char *match) { - const int size = strlen(match); + const size_t size = strlen(match); if (size < 0 || size > src->len) { return false; @@ -827,7 +827,7 @@ buf_string_compare_advance(struct buffer *src, const char *match) { if (buf_string_match_head_str(src, match)) { - buf_advance(src, strlen(match)); + buf_advance(src, (int)strlen(match)); return true; } else @@ -1244,7 +1244,7 @@ buffer_list_push(struct buffer_list *ol, const char *str) struct buffer_entry *e = buffer_list_push_data(ol, str, len+1); if (e) { - e->buf.len = len; /* Don't count trailing '\0' as part of length */ + e->buf.len = (int)len; /* Don't count trailing '\0' as part of length */ } } } @@ -1293,7 +1293,7 @@ void buffer_list_aggregate_separator(struct buffer_list *bl, const size_t max_len, const char *sep) { - const int sep_len = strlen(sep); + const size_t sep_len = strlen(sep); struct buffer_entry *more = bl->head; size_t size = 0; int count = 0; @@ -1400,7 +1400,7 @@ buffer_read_from_file(const char *filename, struct gc_arena *gc) { struct buffer ret = { 0 }; - platform_stat_t file_stat = {0}; + platform_stat_t file_stat = { 0 }; if (platform_stat(filename, &file_stat) < 0) { return ret; @@ -1414,13 +1414,13 @@ buffer_read_from_file(const char *filename, struct gc_arena *gc) const size_t size = file_stat.st_size; ret = alloc_buf_gc(size + 1, gc); /* space for trailing \0 */ - ssize_t read_size = fread(BPTR(&ret), 1, size, fp); - if (read_size < 0) + size_t read_size = fread(BPTR(&ret), 1, size, fp); + if (read_size == 0) { free_buf_gc(&ret, gc); goto cleanup; } - ASSERT(buf_inc_len(&ret, read_size)); + ASSERT(buf_inc_len(&ret, (int)read_size)); buf_null_terminate(&ret); cleanup: diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h index 1722ffd5..9ea70284 100644 --- a/src/openvpn/buffer.h +++ b/src/openvpn/buffer.h @@ -332,13 +332,13 @@ buf_set_write(struct buffer *buf, uint8_t *data, int size) } static inline void -buf_set_read(struct buffer *buf, const uint8_t *data, int size) +buf_set_read(struct buffer *buf, const uint8_t *data, size_t size) { if (!buf_size_valid(size)) { buf_size_error(size); } - buf->len = buf->capacity = size; + buf->len = buf->capacity = (int)size; buf->offset = 0; buf->data = (uint8_t *)data; } @@ -538,10 +538,10 @@ struct buffer buf_sub(struct buffer *buf, int size, bool prepend); */ static inline bool -buf_safe(const struct buffer *buf, int len) +buf_safe(const struct buffer *buf, size_t len) { return buf_valid(buf) && buf_size_valid(len) - && buf->offset + buf->len + len <= buf->capacity; + && buf->offset + buf->len + (int)len <= buf->capacity; } static inline bool @@ -549,7 +549,7 @@ buf_safe_bidir(const struct buffer *buf, int len) { if (buf_valid(buf) && buf_size_valid_signed(len)) { - const int newlen = buf->len + len; + int newlen = buf->len + len; return newlen >= 0 && buf->offset + newlen <= buf->capacity; } else @@ -653,7 +653,7 @@ buf_advance(struct buffer *buf, int size) */ static inline uint8_t * -buf_write_alloc(struct buffer *buf, int size) +buf_write_alloc(struct buffer *buf, size_t size) { uint8_t *ret; if (!buf_safe(buf, size)) @@ -661,7 +661,7 @@ buf_write_alloc(struct buffer *buf, int size) return NULL; } ret = BPTR(buf) + buf->len; - buf->len += size; + buf->len += (int)size; return ret; } @@ -686,7 +686,7 @@ buf_read_alloc(struct buffer *buf, int size) } static inline bool -buf_write(struct buffer *dest, const void *src, int size) +buf_write(struct buffer *dest, const void *src, size_t size) { uint8_t *cp = buf_write_alloc(dest, size); if (!cp) From patchwork Wed Mar 24 11:23:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1655 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.27.255.52]) by backend30.mail.ord1d.rsapps.net with LMTP id ALJlBhy8W2AiQgAAIUCqbw (envelope-from ) for ; Wed, 24 Mar 2021 18:24:28 -0400 Received: from proxy11.mail.iad3a.rsapps.net ([172.27.255.52]) by director10.mail.ord1d.rsapps.net with LMTP id 8H7qBRy8W2DjKgAApN4f7A (envelope-from ) for ; Wed, 24 Mar 2021 18:24:28 -0400 Received: from smtp19.gate.iad3a ([172.27.255.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy11.mail.iad3a.rsapps.net with LMTPS id AKwHARy8W2A5GQAAxCvdqw (envelope-from ) for ; Wed, 24 Mar 2021 18:24:28 -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: smtp19.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; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: b1875f3a-8cef-11eb-941e-5254005d39f2-1-1 Received: from [216.105.38.7] ([216.105.38.7:50004] helo=lists.sourceforge.net) by smtp19.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 06/45-04446-B1CBB506; Wed, 24 Mar 2021 18:24:27 -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 1lPBue-0000yx-He; Wed, 24 Mar 2021 22:23:40 +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 1lPBud-0000yj-4Y for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 22:23:39 +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=eLt5kI/BHYme1Fa6GGXnA+Y4prMK9FT8D4wW591kl/E=; b=TJ466Hz6GN9qexk2egw+oNxl0A uL2Gmh2Yg91aUHxrS+2epoh3GtAOG+n43LvEnHrhd7NLLeGFwU52tS1wyJ4+A7Xi1SXejj3ONfn4c OfwvxmsNqzWT5xTlDhTamdPeiK4kdw0GD/qCVhAGPiGjSUPxl6cDctQt3kRlaCW/6IB0=; 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=eLt5kI/BHYme1Fa6GGXnA+Y4prMK9FT8D4wW591kl/E=; b=RbAE6WpnplNLWq2ovzAO1voL2/ r5age+JnZjEAhvSd0i6hiXr6kKpEWBrgOTO5avpn/kbw4TNME5jzPcELssGGIJDoIoZ0MLWU0bmjT 8iCRmguHYe5vzt2Haa78xwNyqFhE/D69DVUQe2YA/2Zvvv3XasyUv40TZTGiwzwgVhEA=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lPBub-0003Yj-HT for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 22:23:39 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1lPBuV-000ExI-4U for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 23:23:31 +0100 Received: (nullmailer pid 514 invoked by uid 10006); Wed, 24 Mar 2021 22:23:31 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 24 Mar 2021 23:23:28 +0100 Message-Id: <20210324222330.455-2-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210324222330.455-1-arne@rfc2549.org> References: <20210324222330.455-1-arne@rfc2549.org> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 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: rfc2549.org] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1lPBub-0003Yj-HT Subject: [Openvpn-devel] [PATCH 2/4] Fix unchecked signess conversions reported by 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 Whenever possible the types have been aligned in the various parts of OpenVPN. If that was not possible, an explicit cast to a narrower type has been added. Signed-off-by: Arne Schwabe --- src/openvpn/console_builtin.c | 2 +- src/openvpn/dhcp.c | 2 +- src/openvpn/multi.h | 2 +- src/openvpn/options.h | 2 +- src/openvpn/packet_id.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/openvpn/console_builtin.c b/src/openvpn/console_builtin.c index 445928bf..74a0e2b6 100644 --- a/src/openvpn/console_builtin.c +++ b/src/openvpn/console_builtin.c @@ -74,7 +74,7 @@ get_console_input_win32(const char *prompt, const bool echo, char *input, const if (in != INVALID_HANDLE_VALUE && err != INVALID_HANDLE_VALUE && !win32_service_interrupt(&win32_signal) - && WriteFile(err, prompt, strlen(prompt), &len, NULL)) + && WriteFile(err, prompt, (DWORD)strlen(prompt), &len, NULL)) { bool is_console = (GetFileType(in) == FILE_TYPE_CHAR); DWORD flags_save = 0; diff --git a/src/openvpn/dhcp.c b/src/openvpn/dhcp.c index c19370eb..1e79ccc4 100644 --- a/src/openvpn/dhcp.c +++ b/src/openvpn/dhcp.c @@ -113,7 +113,7 @@ do_extract(struct dhcp *dhcp, int optlen) const int owlen = len + 2; /* len of data to overwrite */ uint8_t *src = dest + owlen; uint8_t *end = p + optlen; - const int movlen = end - src; + const size_t movlen = end - src; if (movlen > 0) { memmove(dest, src, movlen); /* overwrite router option */ diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h index 7669508c..65f64659 100644 --- a/src/openvpn/multi.h +++ b/src/openvpn/multi.h @@ -181,7 +181,7 @@ struct multi_context { struct mroute_addr local; bool enable_c2c; int max_clients; - int tcp_queue_limit; + unsigned int tcp_queue_limit; int status_file_version; int n_clients; /* current number of authenticated clients */ diff --git a/src/openvpn/options.h b/src/openvpn/options.h index f3208c71..d8e91fbc 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -457,7 +457,7 @@ struct options bool ccd_exclusive; bool disable; int n_bcast_buf; - int tcp_queue_limit; + unsigned int tcp_queue_limit; struct iroute *iroutes; struct iroute_ipv6 *iroutes_ipv6; /* IPv6 */ bool push_ifconfig_defined; diff --git a/src/openvpn/packet_id.h b/src/openvpn/packet_id.h index 3b58da22..0d2e094d 100644 --- a/src/openvpn/packet_id.h +++ b/src/openvpn/packet_id.h @@ -316,7 +316,7 @@ packet_id_close_to_wrapping(const struct packet_id_send *p) static inline bool check_timestamp_delta(time_t remote, unsigned int max_delta) { - unsigned int abs; + time_t abs; const time_t local_now = now; if (local_now >= remote) From patchwork Wed Mar 24 11:23:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1657 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.27.255.53]) by backend30.mail.ord1d.rsapps.net with LMTP id QNxTISi8W2CYXQAAIUCqbw (envelope-from ) for ; Wed, 24 Mar 2021 18:24:40 -0400 Received: from proxy17.mail.iad3a.rsapps.net ([172.27.255.53]) by director8.mail.ord1d.rsapps.net with LMTP id gHUWISi8W2CqcAAAfY0hYg (envelope-from ) for ; Wed, 24 Mar 2021 18:24:40 -0400 Received: from smtp53.gate.iad3a ([172.27.255.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy17.mail.iad3a.rsapps.net with LMTPS id 2DbSGSi8W2CQPQAAR4KW9A (envelope-from ) for ; Wed, 24 Mar 2021 18:24:40 -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: smtp53.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; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: b8ffd4fe-8cef-11eb-9d19-5254009c3572-1-1 Received: from [216.105.38.7] ([216.105.38.7:55100] helo=lists.sourceforge.net) by smtp53.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id F2/FE-10486-72CBB506; Wed, 24 Mar 2021 18:24:40 -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.92.3) (envelope-from ) id 1lPBus-00008j-QP; Wed, 24 Mar 2021 22:23:54 +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.92.3) (envelope-from ) id 1lPBur-000086-66 for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 22:23:53 +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=26q0E6Pmya7WqrSAxk38kALYosTbfEu8B3c0bGxri/k=; b=eqQhh9HqqJdK0kZeYgndjRzxBI HUsuOPFZTnM9RA6loL8LfUlzgO6wYhrlAFDPd1BnhFL2woyhRHFzK1pMOg4fTEVbv7s20OyGKNg3S mcJoL8PCbbm8C3jshvvPaN4l/QthW9Y0xIWif+r/sCkTyOhGDGWKuErzo5R2xtmeVZcs=; 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=26q0E6Pmya7WqrSAxk38kALYosTbfEu8B3c0bGxri/k=; b=CaaDnTmMZvj9xHhjYYPYUS26Zu +dFjnna376f8Xwjlw/j5JkbD6f9qOWj83O0B2vmopt4AvWYJcVsmfGQvwPXLPvBYqdmVykRSyc/ZO fKrPYGTHMWxZHo10i30zAAlR1koYTFlxJrF+BcMGjptRT6L+q8F7l7Mg8DDlAp4Tu65c=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1lPBuc-007Cbb-8A for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 22:23:52 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1lPBuV-000ExL-6j for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 23:23:31 +0100 Received: (nullmailer pid 517 invoked by uid 10006); Wed, 24 Mar 2021 22:23:31 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 24 Mar 2021 23:23:29 +0100 Message-Id: <20210324222330.455-3-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210324222330.455-1-arne@rfc2549.org> References: <20210324222330.455-1-arne@rfc2549.org> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 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: rfc2549.org] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1lPBuc-007Cbb-8A Subject: [Openvpn-devel] [PATCH 3/4] Fix socket related functions using int instead of socket_descriptor_t 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 On windows the SOCKET type is a UINT_PTR, which is a 64 bit pointer, so using an int worked so far but is actually quite wrong. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/fdmisc.c | 8 ++++---- src/openvpn/fdmisc.h | 10 +++++----- src/openvpn/mtu.c | 2 +- src/openvpn/mtu.h | 2 +- src/openvpn/socket.c | 16 ++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/openvpn/fdmisc.c b/src/openvpn/fdmisc.c index 1cea505c..e0d198e5 100644 --- a/src/openvpn/fdmisc.c +++ b/src/openvpn/fdmisc.c @@ -36,7 +36,7 @@ /* Set a file descriptor to non-blocking */ bool -set_nonblock_action(int fd) +set_nonblock_action(socket_descriptor_t fd) { #ifdef _WIN32 u_long arg = 1; @@ -55,7 +55,7 @@ set_nonblock_action(int fd) /* Set a file descriptor to not be passed across execs */ bool -set_cloexec_action(int fd) +set_cloexec_action(socket_descriptor_t fd) { #ifndef _WIN32 if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) @@ -68,7 +68,7 @@ set_cloexec_action(int fd) /* Set a file descriptor to non-blocking */ void -set_nonblock(int fd) +set_nonblock(socket_descriptor_t fd) { if (!set_nonblock_action(fd)) { @@ -78,7 +78,7 @@ set_nonblock(int fd) /* Set a file descriptor to not be passed across execs */ void -set_cloexec(int fd) +set_cloexec(socket_descriptor_t fd) { if (!set_cloexec_action(fd)) { diff --git a/src/openvpn/fdmisc.h b/src/openvpn/fdmisc.h index 0fb8b934..f4b67482 100644 --- a/src/openvpn/fdmisc.h +++ b/src/openvpn/fdmisc.h @@ -28,16 +28,16 @@ #include "error.h" #include "syshead.h" -bool set_nonblock_action(int fd); +bool set_nonblock_action(socket_descriptor_t fd); -bool set_cloexec_action(int fd); +bool set_cloexec_action(socket_descriptor_t fd); -void set_nonblock(int fd); +void set_nonblock(socket_descriptor_t fd); -void set_cloexec(int fd); +void set_cloexec(socket_descriptor_t fd); static inline void -openvpn_fd_set(int fd, fd_set *setp) +openvpn_fd_set(socket_descriptor_t fd, fd_set *setp) { #ifndef _WIN32 /* The Windows FD_SET() implementation does not overflow */ ASSERT(fd >= 0 && fd < FD_SETSIZE); diff --git a/src/openvpn/mtu.c b/src/openvpn/mtu.c index 3ddeac76..3317c884 100644 --- a/src/openvpn/mtu.c +++ b/src/openvpn/mtu.c @@ -166,7 +166,7 @@ frame_print(const struct frame *frame, #define MTUDISC_NOT_SUPPORTED_MSG "--mtu-disc is not supported on this OS" void -set_mtu_discover_type(int sd, int mtu_type, sa_family_t proto_af) +set_mtu_discover_type(socket_descriptor_t sd, int mtu_type, sa_family_t proto_af) { if (mtu_type >= 0) { diff --git a/src/openvpn/mtu.h b/src/openvpn/mtu.h index 549c319b..0c8bdf8b 100644 --- a/src/openvpn/mtu.h +++ b/src/openvpn/mtu.h @@ -209,7 +209,7 @@ void frame_print(const struct frame *frame, int level, const char *prefix); -void set_mtu_discover_type(int sd, int mtu_type, sa_family_t proto_af); +void set_mtu_discover_type(socket_descriptor_t sd, int mtu_type, sa_family_t proto_af); int translate_mtu_discover_type_name(const char *name); diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index ebe8c85c..0d9b793c 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -846,7 +846,7 @@ mac_addr_safe(const char *mac_addr) } static int -socket_get_sndbuf(int sd) +socket_get_sndbuf(socket_descriptor_t sd) { #if defined(HAVE_GETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_SNDBUF) int val; @@ -863,7 +863,7 @@ socket_get_sndbuf(int sd) } static void -socket_set_sndbuf(int sd, int size) +socket_set_sndbuf(socket_descriptor_t sd, int size) { #if defined(HAVE_SETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_SNDBUF) if (setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (void *) &size, sizeof(size)) != 0) @@ -874,7 +874,7 @@ socket_set_sndbuf(int sd, int size) } static int -socket_get_rcvbuf(int sd) +socket_get_rcvbuf(socket_descriptor_t sd) { #if defined(HAVE_GETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_RCVBUF) int val; @@ -891,7 +891,7 @@ socket_get_rcvbuf(int sd) } static bool -socket_set_rcvbuf(int sd, int size) +socket_set_rcvbuf(socket_descriptor_t sd, int size) { #if defined(HAVE_SETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_RCVBUF) if (setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (void *) &size, sizeof(size)) != 0) @@ -904,7 +904,7 @@ socket_set_rcvbuf(int sd, int size) } static void -socket_set_buffers(int fd, const struct socket_buffer_size *sbs) +socket_set_buffers(socket_descriptor_t fd, const struct socket_buffer_size *sbs) { if (sbs) { @@ -934,7 +934,7 @@ socket_set_buffers(int fd, const struct socket_buffer_size *sbs) */ static bool -socket_set_tcp_nodelay(int sd, int state) +socket_set_tcp_nodelay(socket_descriptor_t sd, int state) { #if defined(_WIN32) || (defined(HAVE_SETSOCKOPT) && defined(IPPROTO_TCP) && defined(TCP_NODELAY)) if (setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (void *) &state, sizeof(state)) != 0) @@ -954,7 +954,7 @@ socket_set_tcp_nodelay(int sd, int state) } static inline void -socket_set_mark(int sd, int mark) +socket_set_mark(socket_descriptor_t sd, int mark) { #if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK if (mark && setsockopt(sd, SOL_SOCKET, SO_MARK, (void *) &mark, sizeof(mark)) != 0) @@ -965,7 +965,7 @@ socket_set_mark(int sd, int mark) } static bool -socket_set_flags(int sd, unsigned int sockflags) +socket_set_flags(socket_descriptor_t sd, unsigned int sockflags) { if (sockflags & SF_TCP_NODELAY) { From patchwork Wed Mar 24 11:23:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1654 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director15.mail.ord1d.rsapps.net ([172.27.255.7]) by backend30.mail.ord1d.rsapps.net with LMTP id uP8pIxS8W2A0bQAAIUCqbw (envelope-from ) for ; Wed, 24 Mar 2021 18:24:20 -0400 Received: from proxy3.mail.iad3a.rsapps.net ([172.27.255.7]) by director15.mail.ord1d.rsapps.net with LMTP id qDIbIxS8W2DwZQAAIcMcQg (envelope-from ) for ; Wed, 24 Mar 2021 18:24:20 -0400 Received: from smtp25.gate.iad3a ([172.27.255.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy3.mail.iad3a.rsapps.net with LMTPS id YJ8gHBS8W2BzGQAAYaqY3Q (envelope-from ) for ; Wed, 24 Mar 2021 18:24:20 -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; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: aca80fdc-8cef-11eb-887a-52540086a678-1-1 Received: from [216.105.38.7] ([216.105.38.7:54988] 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 22/5A-04167-31CBB506; Wed, 24 Mar 2021 18:24:19 -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.92.3) (envelope-from ) id 1lPBuf-00006t-EH; Wed, 24 Mar 2021 22:23:41 +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.92.3) (envelope-from ) id 1lPBud-00006j-6X for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 22:23:39 +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=ff63qpyy6tE9UmmGVrNVBnDo1eiNQZ/H+9sAKXpgkj0=; b=HQ4FIDqWHchYaYUZCqkVRGGhuh YrwDca3MEP3XK3NGH641qeYuuM+IsBCvCkCUaGehfBKjX6/Qn/tGD3x8tl0qpRiR0n1ivQpvx6MDQ mv12+JXfue/rv0XfZ7s1UInY9ojve5GnshgtzvjiIn93DFnhdfVAjrSHAQOqOQhvCSrI=; 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=ff63qpyy6tE9UmmGVrNVBnDo1eiNQZ/H+9sAKXpgkj0=; b=gOV8L9vurv0Q32oxYl6BseqOm4 90RFi+kmq/6XtirfECb+jSf3urvixkKrE/senEa9X3Q2gsk420Z3aRtt8ItNSeDCDUFmgCEXGUWbv YxW/KuswBDF5xHd8t65JnPoBe6D0HmiRTCE3K7SqrxObGQZjGyf18DZMxrbC7R7P0G38=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lPBub-0003Yk-HB for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 22:23:39 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1lPBuV-000ExO-8o for openvpn-devel@lists.sourceforge.net; Wed, 24 Mar 2021 23:23:31 +0100 Received: (nullmailer pid 520 invoked by uid 10006); Wed, 24 Mar 2021 22:23:31 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 24 Mar 2021 23:23:30 +0100 Message-Id: <20210324222330.455-4-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210324222330.455-1-arne@rfc2549.org> References: <20210324222330.455-1-arne@rfc2549.org> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 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: rfc2549.org] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1lPBub-0003Yk-HB Subject: [Openvpn-devel] [PATCH 4/4] Use correct types for OpenSSL and Windows APIs 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 The error code of OpenSSL is a long. On most Unics systems (mac, Linux...) this happens to be the same as size_t. But on Windows as LP64, long is a 32 bit type and size_t is a 64 bit type. So use the same type as OpenSSL. When calling the Windows API use DWORD for the functions that want a DWORD. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/crypto_openssl.c | 2 +- src/openvpn/cryptoapi.c | 2 +- src/openvpn/route.c | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c index 4486d246..573beaed 100644 --- a/src/openvpn/crypto_openssl.c +++ b/src/openvpn/crypto_openssl.c @@ -199,7 +199,7 @@ crypto_clear_error(void) void crypto_print_openssl_errors(const unsigned int flags) { - size_t err = 0; + unsigned long err = 0; while ((err = ERR_get_error())) { diff --git a/src/openvpn/cryptoapi.c b/src/openvpn/cryptoapi.c index a992441b..ded8c914 100644 --- a/src/openvpn/cryptoapi.c +++ b/src/openvpn/cryptoapi.c @@ -997,7 +997,7 @@ pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, } msg(D_LOW, "cryptoapicert: calling priv_enc_CNG with alg = %ls", alg); - *siglen = priv_enc_CNG(cd, alg, tbs, (int)tbslen, sig, *siglen, + *siglen = priv_enc_CNG(cd, alg, tbs, (int)tbslen, sig, (int)*siglen, cng_padding_type(padding), (DWORD)saltlen); return (*siglen == 0) ? 0 : 1; diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 5e1dca67..c6b3dc58 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -2701,12 +2701,11 @@ get_default_gateway_row(const MIB_IPFORWARDTABLE *routes) struct gc_arena gc = gc_new(); DWORD lowest_metric = MAXDWORD; const MIB_IPFORWARDROW *ret = NULL; - int i; int best = -1; if (routes) { - for (i = 0; i < routes->dwNumEntries; ++i) + for (DWORD i = 0; i < routes->dwNumEntries; ++i) { const MIB_IPFORWARDROW *row = &routes->table[i]; const in_addr_t net = ntohl(row->dwForwardDest); @@ -3167,14 +3166,13 @@ void show_routes(int msglev) { struct gc_arena gc = gc_new(); - int i; const MIB_IPFORWARDTABLE *rt = get_windows_routing_table(&gc); msg(msglev, "SYSTEM ROUTING TABLE"); if (rt) { - for (i = 0; i < rt->dwNumEntries; ++i) + for (DWORD i = 0; i < rt->dwNumEntries; ++i) { msg(msglev, "%s", format_route_entry(&rt->table[i], &gc)); } @@ -4023,8 +4021,7 @@ test_local_addr(const in_addr_t addr, const struct route_gateway_info *rgi) const MIB_IPFORWARDTABLE *rt = get_windows_routing_table(&gc); if (rt) { - int i; - for (i = 0; i < rt->dwNumEntries; ++i) + for (DWORD i = 0; i < rt->dwNumEntries; ++i) { const MIB_IPFORWARDROW *row = &rt->table[i]; const in_addr_t net = ntohl(row->dwForwardDest);