Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1361?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: dco_freebsd.c: fix integer warnings
......................................................................
dco_freebsd.c: fix integer warnings
Fix all nvlist_get_number() related warnings by explicitly casting - these
are all messages coming from DCO, which we trust in this (nothing will
crash if a number is truncated, just "things will not work correctly").
Remove #pragmas.
Change-Id: Ief19ba87b0832baa6530ea8bf039d85115434e3e
Signed-off-by: Gert Doering <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1361
Message-Id: <[email protected]>
URL:
https://www.mail-archive.com/[email protected]/msg34256.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/dco_freebsd.c
1 file changed, 11 insertions(+), 17 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/61/1361/2
diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c
index 21f0ac0..f2a89ac 100644
--- a/src/openvpn/dco_freebsd.c
+++ b/src/openvpn/dco_freebsd.c
@@ -72,11 +72,6 @@
return (nvl);
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
static bool
nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *ss)
{
@@ -93,7 +88,7 @@
return (false);
}
- ss->ss_family = nvlist_get_number(nvl, "af");
+ ss->ss_family = (unsigned char)nvlist_get_number(nvl, "af");
switch (ss->ss_family)
{
@@ -107,7 +102,7 @@
data = nvlist_get_binary(nvl, "address", &len);
ASSERT(len == sizeof(in->sin_addr));
memcpy(&in->sin_addr, data, sizeof(in->sin_addr));
- in->sin_port = nvlist_get_number(nvl, "port");
+ in->sin_port = (in_port_t)nvlist_get_number(nvl, "port");
break;
}
@@ -121,11 +116,11 @@
data = nvlist_get_binary(nvl, "address", &len);
ASSERT(len == sizeof(in6->sin6_addr));
memcpy(&in6->sin6_addr, data, sizeof(in6->sin6_addr));
- in6->sin6_port = nvlist_get_number(nvl, "port");
+ in6->sin6_port = (in_port_t)nvlist_get_number(nvl, "port");
if (nvlist_exists_number(nvl, "scopeid"))
{
- in6->sin6_scope_id = nvlist_get_number(nvl, "scopeid");
+ in6->sin6_scope_id = (uint32_t)nvlist_get_number(nvl,
"scopeid");
}
break;
}
@@ -614,9 +609,12 @@
return -EINVAL;
}
- dco->dco_message_peer_id = nvlist_get_number(nvl, "peerid");
+ /* dco_message_peer_id is signed int, because other parts of the
+ * code treat "-1" as "this is a message not specific to one peer"
+ */
+ dco->dco_message_peer_id = (int)nvlist_get_number(nvl, "peerid");
- type = nvlist_get_number(nvl, "notification");
+ type = (enum ovpn_notif_type)nvlist_get_number(nvl, "notification");
switch (type)
{
@@ -625,7 +623,7 @@
if (nvlist_exists_number(nvl, "del_reason"))
{
- uint32_t reason = nvlist_get_number(nvl, "del_reason");
+ uint32_t reason = (uint32_t)nvlist_get_number(nvl,
"del_reason");
if (reason == OVPN_DEL_REASON_TIMEOUT)
{
dco->dco_del_peer_reason = OVPN_DEL_PEER_REASON_EXPIRED;
@@ -869,7 +867,7 @@
for (size_t i = 0; i < npeers; i++)
{
const nvlist_t *peer = nvpeers[i];
- uint32_t peerid = nvlist_get_number(peer, "peerid");
+ uint32_t peerid = (uint32_t)nvlist_get_number(peer, "peerid");
const nvlist_t *bytes = nvlist_get_nvlist(peer, "bytes");
/* we can end here in p2mp mode, or in p2p mode via
@@ -890,10 +888,6 @@
return 0;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
/* get stats for a single peer
* we can get here for "the peer stats" in p2p client mode, or by
* being queried for a particular peer in p2mp mode, for --inactive
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1361?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ief19ba87b0832baa6530ea8bf039d85115434e3e
Gerrit-Change-Number: 1361
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel