dco-linux: fix counter print format
PATCH 1/1 dco-linux: fix counter print format
Avoid compilation warnings on 32 bit platforms.
dco_linux.c: In function 'dco_update_peer_stat':
dco_linux.c:830:26: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'counter_type' {aka 'long long unsigned int'} [-Werror=format=]
830 | msg(D_DCO_DEBUG, "%s / dco_read_bytes: %lu", __func__,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
831 | c2->dco_read_bytes);
| ~~~~~~~~~~~~~~~~~~
| |
| counter_type {aka long long unsigned int}--- src/openvpn/dco_linux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
src/openvpn/dco_linux.c +4 -4
@@ -827,7 +827,7 @@ dco_update_peer_stat(struct context_2 *c2, struct nlattr *tb[], uint32_t id)if (tb[OVPN_GET_PEER_RESP_ATTR_LINK_RX_BYTES ]) { c2->dco_read_bytes =nla_get_u64 (tb[OVPN_GET_PEER_RESP_ATTR_LINK_RX_BYTES ]); -msg (D_DCO_DEBUG ,"%s / dco_read_bytes: %lu" , __func__, +msg (D_DCO_DEBUG ,"%s / dco_read_bytes: " counter_format, __func__, c2->dco_read_bytes); }else
@@ -839,7 +839,7 @@ dco_update_peer_stat(struct context_2 *c2, struct nlattr *tb[], uint32_t id)if (tb[OVPN_GET_PEER_RESP_ATTR_LINK_TX_BYTES ]) { c2->dco_write_bytes =nla_get_u64 (tb[OVPN_GET_PEER_RESP_ATTR_LINK_TX_BYTES ]); -msg (D_DCO_DEBUG ,"%s / dco_write_bytes: %lu" , __func__, +msg (D_DCO_DEBUG ,"%s / dco_write_bytes: " counter_format, __func__, c2->dco_write_bytes); }else
@@ -851,7 +851,7 @@ dco_update_peer_stat(struct context_2 *c2, struct nlattr *tb[], uint32_t id)if (tb[OVPN_GET_PEER_RESP_ATTR_VPN_RX_BYTES ]) { c2->tun_read_bytes =nla_get_u64 (tb[OVPN_GET_PEER_RESP_ATTR_VPN_RX_BYTES ]); -msg (D_DCO_DEBUG ,"%s / tun_read_bytes: %lu" , __func__, +msg (D_DCO_DEBUG ,"%s / tun_read_bytes: " counter_format, __func__, c2->tun_read_bytes); }else
@@ -863,7 +863,7 @@ dco_update_peer_stat(struct context_2 *c2, struct nlattr *tb[], uint32_t id)if (tb[OVPN_GET_PEER_RESP_ATTR_VPN_TX_BYTES ]) { c2->tun_write_bytes =nla_get_u64 (tb[OVPN_GET_PEER_RESP_ATTR_VPN_TX_BYTES ]); -msg (D_DCO_DEBUG ,"%s / tun_write_bytes: %lu" , __func__, +msg (D_DCO_DEBUG ,"%s / tun_write_bytes: " counter_format, __func__, c2->tun_write_bytes); }else
Signature · 1 line
2.30.2
Hi,
Quoted 6 lines · Sergey Korolev via Openvpn-devel
Avoid compilation warnings on 32 bit platforms.
dco_linux.c: In function 'dco_update_peer_stat':
dco_linux.c:830:26: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'counter_type' {aka 'long long unsigned int'} [-Werror=format=]
Quoted 8 lines
830 | msg(D_DCO_DEBUG, "%s / dco_read_bytes: %lu", __func__, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ 831 | c2->dco_read_bytes); | ~~~~~~~~~~~~~~~~~~ | | | counter_type {aka long long unsigned int}Signed-off-by Sergey Korolev <[email protected]...>
Thanks for catching this!
Signature · 1 line
Antonio Quartulli
I have not tested this beyond "does it still compile?", but a quick glance at the changes and the definitions agrees with Antonio's ACK.
Your patch has been applied to the master and release/2.6 branches.
commit 330bef679544b6a22d16a800c898927a785d74fc (master) commit fa434643534d506c834df3eb1dbb6073fb74b9f4 (HEAD -> release/2.6)
Author: Sergey Korolev via Openvpn-devel Date: Mon Jun 26 16:09:39 2023 +0300
dco-linux: fix counter print format
Signed-off-by: Sergey Korolev <[email protected]...>
Acked-by: Antonio Quartulli <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg26767.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering