Change in openvpn[master]: dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
A message that is not in the archive (sent off-list or not yet received): gerrit.1762292654000.Ife55cb78401dad921b75f6c86d9bd0642f6a6e83@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email
to review the following change.
Change subject: dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
......................................................................
dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
Some of these debug messages only existed on Linux, and made debugging DCO issues on FreeBSD more difficult. Add them, using the same style as used for dco_linux.c
---
M src/openvpn/dco_freebsd.c
1 file changed, 14 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/49/1349/1
src/openvpn/dco_freebsd.c +14 -1
@@ -577,6 +577,9 @@ mi->context.c2.dco_read_bytes =nvlist_get_number (nvl,"in" ); mi->context.c2.dco_write_bytes =nvlist_get_number (nvl,"out" ); + +msg (D_DCO_DEBUG ,"%s: peer-id %d, dco_read_bytes: " counter_format" dco_write_bytes: " counter_format, + __func__, peerid, mi->context.c2.dco_read_bytes, mi->context.c2.dco_write_bytes); }int
@@ -614,6 +617,7 @@ dco->dco_message_peer_id =nvlist_get_number (nvl,"peerid" ); type =nvlist_get_number (nvl,"notification" ); +switch (type) {case OVPN_NOTIF_DEL_PEER :
@@ -631,6 +635,8 @@ dco->dco_del_peer_reason =OVPN_DEL_PEER_REASON_USERSPACE ; } } +msg (D_DCO_DEBUG ,"%s: received NOTIF_DEL_PEER for peer-id=%d, reason=%d" , __func__, + dco->dco_message_peer_id, dco->dco_del_peer_reason);if (nvlist_exists_nvlist (nvl,"bytes" )) {
@@ -651,6 +657,8 @@break ;case OVPN_NOTIF_ROTATE_KEY : +msg (D_DCO_DEBUG ,"%s: received NOTIF_ROTATE_KEY for peer-id=%d" , __func__, + dco->dco_message_peer_id); dco->dco_message_type =OVPN_CMD_SWAP_KEYS ;break ;
@@ -670,12 +678,14 @@msg (M_WARN ,"Failed to parse float notification" );break ; } +msg (D_DCO_DEBUG ,"%s: received NOTIF_FLOAT for peer-id=%d" , __func__, + dco->dco_message_peer_id); dco->dco_message_type =OVPN_CMD_FLOAT_PEER ;break ; }default : -msg (M_WARN ,"Unknown kernel notification %d" , type); +msg (M_WARN ,"%s: unknown kernel notification %d" , __func__, type);break ; }
@@ -815,6 +825,8 @@return 0 ; } +msg (D_DCO_DEBUG , __func__); +CLEAR (drv);snprintf (drv.ifd_name,IFNAMSIZ ,"%s" , dco->ifname); drv.ifd_cmd =OVPN_GET_PEER_STATS ;
@@ -873,6 +885,7 @@int dco_get_peer_stats (struct context *c,const bool raise_sigusr1_on_err) { +msg (D_DCO_DEBUG , __func__);/* Not implemented. */ return 0 ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife55cb78401dad921b75f6c86d9bd0642f6a6e83
Gerrit-Change-Number: 1349
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: cron2, plaisthos.
flichtenheld has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email )
Change subject: dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
......................................................................
Patch Set 2:
(1 comment)
File src/openvpn/dco_freebsd.c:
http://gerrit.openvpn.net/c/openvpn/+/1349/comment/7d84545b_9e9f9371?usp=email :
PS2, Line 581: msg(D_DCO_DEBUG, "%s: peer-id %d, dco_read_bytes: " counter_format " dco_write_bytes: " counter_format,
peer-id should be "%u" since it is uint32_t.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife55cb78401dad921b75f6c86d9bd0642f6a6e83
Gerrit-Change-Number: 1349
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Fri, 07 Nov 2025 13:24:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: cron2, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email
to look at the new patch set (#3).
Change subject: dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
......................................................................
dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
Some of these debug messages only existed on Linux, and made debugging DCO issues on FreeBSD more difficult. Add them, using the same style as used for dco_linux.c
While at it, change all format strings for "peerid" to "%u" (wherever appropriate, dco->dco_message_peer_id is an "int" today and changing this to uint32_t is out of scope for "make better logging")
---
M src/openvpn/dco_freebsd.c
1 file changed, 21 insertions(+), 8 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/49/1349/3
src/openvpn/dco_freebsd.c +21 -8
@@ -147,7 +147,7 @@ nvl =nvlist_create (0 ); -msg (D_DCO_DEBUG ,"%s: peer-id %d, fd %d" , __func__, peerid, sd); +msg (D_DCO_DEBUG ,"%s: peer-id %u, fd %d" , __func__, peerid, sd);if (localaddr) {
@@ -363,7 +363,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d" , __func__, peerid); +msg (D_DCO_DEBUG ,"%s: peer-id %u" , __func__, peerid); nvl =nvlist_create (0 );nvlist_add_number (nvl,"peerid" , peerid);
@@ -392,7 +392,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d" , __func__, peerid); +msg (D_DCO_DEBUG ,"%s: peer-id %u" , __func__, peerid); nvl =nvlist_create (0 );nvlist_add_number (nvl,"peerid" , peerid);
@@ -421,7 +421,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d, slot %d" , __func__, peerid, slot); +msg (D_DCO_DEBUG ,"%s: peer-id %u, slot %d" , __func__, peerid, slot); nvl =nvlist_create (0 );nvlist_add_number (nvl,"slot" , slot);
@@ -493,7 +493,7 @@nvlist_t *nvl, *encrypt_nvl, *decrypt_nvl;int ret; -msg (D_DCO_DEBUG ,"%s: slot %d, key-id %d, peer-id %d, cipher %s, epoch %d" , __func__, slot, keyid, peerid, +msg (D_DCO_DEBUG ,"%s: slot %d, key-id %d, peer-id %u, cipher %s, epoch %d" , __func__, slot, keyid, peerid, ciphername, epoch); nvl =nvlist_create (0 );
@@ -539,7 +539,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d, ping interval %d, ping timeout %d" , __func__, peerid, +msg (D_DCO_DEBUG ,"%s: peer-id %u, ping interval %d, ping timeout %d" , __func__, peerid, keepalive_interval, keepalive_timeout); nvl =nvlist_create (0 );
@@ -569,7 +569,7 @@ {if (peerid >= m->max_clients || !m->instances[peerid]) { -msg (M_WARN ,"dco_update_peer_stat: invalid peer ID %d returned by kernel" , peerid); +msg (M_WARN ,"dco_update_peer_stat: invalid peer ID %u returned by kernel" , peerid);return ; }
@@ -577,6 +577,9 @@ mi->context.c2.dco_read_bytes =nvlist_get_number (nvl,"in" ); mi->context.c2.dco_write_bytes =nvlist_get_number (nvl,"out" ); + +msg (D_DCO_DEBUG ,"%s: peer-id %u, dco_read_bytes: " counter_format" dco_write_bytes: " counter_format, + __func__, peerid, mi->context.c2.dco_read_bytes, mi->context.c2.dco_write_bytes); }int
@@ -614,6 +617,7 @@ dco->dco_message_peer_id =nvlist_get_number (nvl,"peerid" ); type =nvlist_get_number (nvl,"notification" ); +switch (type) {case OVPN_NOTIF_DEL_PEER :
@@ -631,6 +635,8 @@ dco->dco_del_peer_reason =OVPN_DEL_PEER_REASON_USERSPACE ; } } +msg (D_DCO_DEBUG ,"%s: received NOTIF_DEL_PEER for peer-id=%d, reason=%d" , __func__, + dco->dco_message_peer_id, dco->dco_del_peer_reason);if (nvlist_exists_nvlist (nvl,"bytes" )) {
@@ -651,6 +657,8 @@break ;case OVPN_NOTIF_ROTATE_KEY : +msg (D_DCO_DEBUG ,"%s: received NOTIF_ROTATE_KEY for peer-id=%d" , __func__, + dco->dco_message_peer_id); dco->dco_message_type =OVPN_CMD_SWAP_KEYS ;break ;
@@ -670,12 +678,14 @@msg (M_WARN ,"Failed to parse float notification" );break ; } +msg (D_DCO_DEBUG ,"%s: received NOTIF_FLOAT for peer-id=%d" , __func__, + dco->dco_message_peer_id); dco->dco_message_type =OVPN_CMD_FLOAT_PEER ;break ; }default : -msg (M_WARN ,"Unknown kernel notification %d" , type); +msg (M_WARN ,"%s: unknown kernel notification %d" , __func__, type);break ; }
@@ -815,6 +825,8 @@return 0 ; } +msg (D_DCO_DEBUG , __func__); +CLEAR (drv);snprintf (drv.ifd_name,IFNAMSIZ ,"%s" , dco->ifname); drv.ifd_cmd =OVPN_GET_PEER_STATS ;
@@ -873,6 +885,7 @@int dco_get_peer_stats (struct context *c,const bool raise_sigusr1_on_err) { +msg (D_DCO_DEBUG , __func__);/* Not implemented. */ return 0 ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1349?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: Ife55cb78401dad921b75f6c86d9bd0642f6a6e83
Gerrit-Change-Number: 1349
Gerrit-PatchSet: 3
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email )
Change subject: dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
......................................................................
Patch Set 3:
(1 comment)
File src/openvpn/dco_freebsd.c:
http://gerrit.openvpn.net/c/openvpn/+/1349/comment/d6969526_ed181807?usp=email :
PS2, Line 581: msg(D_DCO_DEBUG, "%s: peer-id %d, dco_read_bytes: " counter_format " dco_write_bytes: " counter_format,
Quoted 1 line
peer-id should be "%u" since it is
uint32_t.
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife55cb78401dad921b75f6c86d9bd0642f6a6e83
Gerrit-Change-Number: 1349
Gerrit-PatchSet: 3
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 07 Nov 2025 16:44:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Attention is currently required from: cron2, plaisthos.
flichtenheld has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email )
Change subject: dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife55cb78401dad921b75f6c86d9bd0642f6a6e83
Gerrit-Change-Number: 1349
Gerrit-PatchSet: 3
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Fri, 07 Nov 2025 16:48:40 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v3 1/1 dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
In reply to a message not in the archiveSome of these debug messages only existed on Linux, and made debugging DCO issues on FreeBSD more difficult. Add them, using the same style as used for dco_linux.c
While at it, change all format strings for "peerid" to "%u" (wherever appropriate, dco->dco_message_peer_id is an "int" today and changing this to uint32_t is out of scope for "make better logging")
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1349
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1349
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
src/openvpn/dco_freebsd.c +21 -8
@@ -147,7 +147,7 @@ nvl =nvlist_create (0 ); -msg (D_DCO_DEBUG ,"%s: peer-id %d, fd %d" , __func__, peerid, sd); +msg (D_DCO_DEBUG ,"%s: peer-id %u, fd %d" , __func__, peerid, sd);if (localaddr) {
@@ -363,7 +363,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d" , __func__, peerid); +msg (D_DCO_DEBUG ,"%s: peer-id %u" , __func__, peerid); nvl =nvlist_create (0 );nvlist_add_number (nvl,"peerid" , peerid);
@@ -392,7 +392,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d" , __func__, peerid); +msg (D_DCO_DEBUG ,"%s: peer-id %u" , __func__, peerid); nvl =nvlist_create (0 );nvlist_add_number (nvl,"peerid" , peerid);
@@ -421,7 +421,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d, slot %d" , __func__, peerid, slot); +msg (D_DCO_DEBUG ,"%s: peer-id %u, slot %d" , __func__, peerid, slot); nvl =nvlist_create (0 );nvlist_add_number (nvl,"slot" , slot);
@@ -493,7 +493,7 @@nvlist_t *nvl, *encrypt_nvl, *decrypt_nvl;int ret; -msg (D_DCO_DEBUG ,"%s: slot %d, key-id %d, peer-id %d, cipher %s, epoch %d" , __func__, slot, keyid, peerid, +msg (D_DCO_DEBUG ,"%s: slot %d, key-id %d, peer-id %u, cipher %s, epoch %d" , __func__, slot, keyid, peerid, ciphername, epoch); nvl =nvlist_create (0 );
@@ -539,7 +539,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d, ping interval %d, ping timeout %d" , __func__, peerid, +msg (D_DCO_DEBUG ,"%s: peer-id %u, ping interval %d, ping timeout %d" , __func__, peerid, keepalive_interval, keepalive_timeout); nvl =nvlist_create (0 );
@@ -569,7 +569,7 @@ {if (peerid >= m->max_clients || !m->instances[peerid]) { -msg (M_WARN ,"dco_update_peer_stat: invalid peer ID %d returned by kernel" , peerid); +msg (M_WARN ,"dco_update_peer_stat: invalid peer ID %u returned by kernel" , peerid);return ; }
@@ -577,6 +577,9 @@ mi->context.c2.dco_read_bytes =nvlist_get_number (nvl,"in" ); mi->context.c2.dco_write_bytes =nvlist_get_number (nvl,"out" ); + +msg (D_DCO_DEBUG ,"%s: peer-id %u, dco_read_bytes: " counter_format" dco_write_bytes: " counter_format, + __func__, peerid, mi->context.c2.dco_read_bytes, mi->context.c2.dco_write_bytes); }int
@@ -614,6 +617,7 @@ dco->dco_message_peer_id =nvlist_get_number (nvl,"peerid" ); type =nvlist_get_number (nvl,"notification" ); +switch (type) {case OVPN_NOTIF_DEL_PEER :
@@ -631,6 +635,8 @@ dco->dco_del_peer_reason =OVPN_DEL_PEER_REASON_USERSPACE ; } } +msg (D_DCO_DEBUG ,"%s: received NOTIF_DEL_PEER for peer-id=%d, reason=%d" , __func__, + dco->dco_message_peer_id, dco->dco_del_peer_reason);if (nvlist_exists_nvlist (nvl,"bytes" )) {
@@ -651,6 +657,8 @@break ;case OVPN_NOTIF_ROTATE_KEY : +msg (D_DCO_DEBUG ,"%s: received NOTIF_ROTATE_KEY for peer-id=%d" , __func__, + dco->dco_message_peer_id); dco->dco_message_type =OVPN_CMD_SWAP_KEYS ;break ;
@@ -670,12 +678,14 @@msg (M_WARN ,"Failed to parse float notification" );break ; } +msg (D_DCO_DEBUG ,"%s: received NOTIF_FLOAT for peer-id=%d" , __func__, + dco->dco_message_peer_id); dco->dco_message_type =OVPN_CMD_FLOAT_PEER ;break ; }default : -msg (M_WARN ,"Unknown kernel notification %d" , type); +msg (M_WARN ,"%s: unknown kernel notification %d" , __func__, type);break ; }
@@ -815,6 +825,8 @@return 0 ; } +msg (D_DCO_DEBUG , __func__); +CLEAR (drv);snprintf (drv.ifd_name,IFNAMSIZ ,"%s" , dco->ifname); drv.ifd_cmd =OVPN_GET_PEER_STATS ;
@@ -873,6 +885,7 @@int dco_get_peer_stats (struct context *c,const bool raise_sigusr1_on_err) { +msg (D_DCO_DEBUG , __func__);/* Not implemented. */ return 0 ; }
[Openvpn-devel] [PATCH applied] Re: dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
Tested on FreeBSD 14.3 / DCO. Thanks for the review.
Patch has been applied to the master branch.
commit 6711ffa9990d027f566fea4dcf005a8a0be71f13
Author: Gert Doering Date: Fri Nov 7 17:50:29 2025 +0100
dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: Frank Lichtenheld <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1349
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34250.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
......................................................................
dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
Some of these debug messages only existed on Linux, and made debugging DCO issues on FreeBSD more difficult. Add them, using the same style as used for dco_linux.c
While at it, change all format strings for "peerid" to "%u" (wherever appropriate, dco->dco_message_peer_id is an "int" today and changing this to uint32_t is out of scope for "make better logging")
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1349
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34250.html
---
M src/openvpn/dco_freebsd.c
1 file changed, 21 insertions(+), 8 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/49/1349/4
src/openvpn/dco_freebsd.c +21 -8
@@ -147,7 +147,7 @@ nvl =nvlist_create (0 ); -msg (D_DCO_DEBUG ,"%s: peer-id %d, fd %d" , __func__, peerid, sd); +msg (D_DCO_DEBUG ,"%s: peer-id %u, fd %d" , __func__, peerid, sd);if (localaddr) {
@@ -363,7 +363,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d" , __func__, peerid); +msg (D_DCO_DEBUG ,"%s: peer-id %u" , __func__, peerid); nvl =nvlist_create (0 );nvlist_add_number (nvl,"peerid" , peerid);
@@ -392,7 +392,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d" , __func__, peerid); +msg (D_DCO_DEBUG ,"%s: peer-id %u" , __func__, peerid); nvl =nvlist_create (0 );nvlist_add_number (nvl,"peerid" , peerid);
@@ -421,7 +421,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d, slot %d" , __func__, peerid, slot); +msg (D_DCO_DEBUG ,"%s: peer-id %u, slot %d" , __func__, peerid, slot); nvl =nvlist_create (0 );nvlist_add_number (nvl,"slot" , slot);
@@ -493,7 +493,7 @@nvlist_t *nvl, *encrypt_nvl, *decrypt_nvl;int ret; -msg (D_DCO_DEBUG ,"%s: slot %d, key-id %d, peer-id %d, cipher %s, epoch %d" , __func__, slot, keyid, peerid, +msg (D_DCO_DEBUG ,"%s: slot %d, key-id %d, peer-id %u, cipher %s, epoch %d" , __func__, slot, keyid, peerid, ciphername, epoch); nvl =nvlist_create (0 );
@@ -539,7 +539,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d, ping interval %d, ping timeout %d" , __func__, peerid, +msg (D_DCO_DEBUG ,"%s: peer-id %u, ping interval %d, ping timeout %d" , __func__, peerid, keepalive_interval, keepalive_timeout); nvl =nvlist_create (0 );
@@ -569,7 +569,7 @@ {if (peerid >= m->max_clients || !m->instances[peerid]) { -msg (M_WARN ,"dco_update_peer_stat: invalid peer ID %d returned by kernel" , peerid); +msg (M_WARN ,"dco_update_peer_stat: invalid peer ID %u returned by kernel" , peerid);return ; }
@@ -577,6 +577,9 @@ mi->context.c2.dco_read_bytes =nvlist_get_number (nvl,"in" ); mi->context.c2.dco_write_bytes =nvlist_get_number (nvl,"out" ); + +msg (D_DCO_DEBUG ,"%s: peer-id %u, dco_read_bytes: " counter_format" dco_write_bytes: " counter_format, + __func__, peerid, mi->context.c2.dco_read_bytes, mi->context.c2.dco_write_bytes); }int
@@ -614,6 +617,7 @@ dco->dco_message_peer_id =nvlist_get_number (nvl,"peerid" ); type =nvlist_get_number (nvl,"notification" ); +switch (type) {case OVPN_NOTIF_DEL_PEER :
@@ -631,6 +635,8 @@ dco->dco_del_peer_reason =OVPN_DEL_PEER_REASON_USERSPACE ; } } +msg (D_DCO_DEBUG ,"%s: received NOTIF_DEL_PEER for peer-id=%d, reason=%d" , __func__, + dco->dco_message_peer_id, dco->dco_del_peer_reason);if (nvlist_exists_nvlist (nvl,"bytes" )) {
@@ -651,6 +657,8 @@break ;case OVPN_NOTIF_ROTATE_KEY : +msg (D_DCO_DEBUG ,"%s: received NOTIF_ROTATE_KEY for peer-id=%d" , __func__, + dco->dco_message_peer_id); dco->dco_message_type =OVPN_CMD_SWAP_KEYS ;break ;
@@ -670,12 +678,14 @@msg (M_WARN ,"Failed to parse float notification" );break ; } +msg (D_DCO_DEBUG ,"%s: received NOTIF_FLOAT for peer-id=%d" , __func__, + dco->dco_message_peer_id); dco->dco_message_type =OVPN_CMD_FLOAT_PEER ;break ; }default : -msg (M_WARN ,"Unknown kernel notification %d" , type); +msg (M_WARN ,"%s: unknown kernel notification %d" , __func__, type);break ; }
@@ -815,6 +825,8 @@return 0 ; } +msg (D_DCO_DEBUG , __func__); +CLEAR (drv);snprintf (drv.ifd_name,IFNAMSIZ ,"%s" , dco->ifname); drv.ifd_cmd =OVPN_GET_PEER_STATS ;
@@ -873,6 +885,7 @@int dco_get_peer_stats (struct context *c,const bool raise_sigusr1_on_err) { +msg (D_DCO_DEBUG , __func__);/* Not implemented. */ return 0 ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1349?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: Ife55cb78401dad921b75f6c86d9bd0642f6a6e83
Gerrit-Change-Number: 1349
Gerrit-PatchSet: 4
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email )
Change subject: dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
......................................................................
dco_freebsd.c: add D_DCO_DEBUG messages for counters and notifications
Some of these debug messages only existed on Linux, and made debugging DCO issues on FreeBSD more difficult. Add them, using the same style as used for dco_linux.c
While at it, change all format strings for "peerid" to "%u" (wherever appropriate, dco->dco_message_peer_id is an "int" today and changing this to uint32_t is out of scope for "make better logging")
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1349
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34250.html
---
M src/openvpn/dco_freebsd.c
1 file changed, 21 insertions(+), 8 deletions(-)
src/openvpn/dco_freebsd.c +21 -8
@@ -147,7 +147,7 @@ nvl =nvlist_create (0 ); -msg (D_DCO_DEBUG ,"%s: peer-id %d, fd %d" , __func__, peerid, sd); +msg (D_DCO_DEBUG ,"%s: peer-id %u, fd %d" , __func__, peerid, sd);if (localaddr) {
@@ -363,7 +363,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d" , __func__, peerid); +msg (D_DCO_DEBUG ,"%s: peer-id %u" , __func__, peerid); nvl =nvlist_create (0 );nvlist_add_number (nvl,"peerid" , peerid);
@@ -392,7 +392,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d" , __func__, peerid); +msg (D_DCO_DEBUG ,"%s: peer-id %u" , __func__, peerid); nvl =nvlist_create (0 );nvlist_add_number (nvl,"peerid" , peerid);
@@ -421,7 +421,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d, slot %d" , __func__, peerid, slot); +msg (D_DCO_DEBUG ,"%s: peer-id %u, slot %d" , __func__, peerid, slot); nvl =nvlist_create (0 );nvlist_add_number (nvl,"slot" , slot);
@@ -493,7 +493,7 @@nvlist_t *nvl, *encrypt_nvl, *decrypt_nvl;int ret; -msg (D_DCO_DEBUG ,"%s: slot %d, key-id %d, peer-id %d, cipher %s, epoch %d" , __func__, slot, keyid, peerid, +msg (D_DCO_DEBUG ,"%s: slot %d, key-id %d, peer-id %u, cipher %s, epoch %d" , __func__, slot, keyid, peerid, ciphername, epoch); nvl =nvlist_create (0 );
@@ -539,7 +539,7 @@nvlist_t *nvl;int ret; -msg (D_DCO_DEBUG ,"%s: peer-id %d, ping interval %d, ping timeout %d" , __func__, peerid, +msg (D_DCO_DEBUG ,"%s: peer-id %u, ping interval %d, ping timeout %d" , __func__, peerid, keepalive_interval, keepalive_timeout); nvl =nvlist_create (0 );
@@ -569,7 +569,7 @@ {if (peerid >= m->max_clients || !m->instances[peerid]) { -msg (M_WARN ,"dco_update_peer_stat: invalid peer ID %d returned by kernel" , peerid); +msg (M_WARN ,"dco_update_peer_stat: invalid peer ID %u returned by kernel" , peerid);return ; }
@@ -577,6 +577,9 @@ mi->context.c2.dco_read_bytes =nvlist_get_number (nvl,"in" ); mi->context.c2.dco_write_bytes =nvlist_get_number (nvl,"out" ); + +msg (D_DCO_DEBUG ,"%s: peer-id %u, dco_read_bytes: " counter_format" dco_write_bytes: " counter_format, + __func__, peerid, mi->context.c2.dco_read_bytes, mi->context.c2.dco_write_bytes); }int
@@ -614,6 +617,7 @@ dco->dco_message_peer_id =nvlist_get_number (nvl,"peerid" ); type =nvlist_get_number (nvl,"notification" ); +switch (type) {case OVPN_NOTIF_DEL_PEER :
@@ -631,6 +635,8 @@ dco->dco_del_peer_reason =OVPN_DEL_PEER_REASON_USERSPACE ; } } +msg (D_DCO_DEBUG ,"%s: received NOTIF_DEL_PEER for peer-id=%d, reason=%d" , __func__, + dco->dco_message_peer_id, dco->dco_del_peer_reason);if (nvlist_exists_nvlist (nvl,"bytes" )) {
@@ -651,6 +657,8 @@break ;case OVPN_NOTIF_ROTATE_KEY : +msg (D_DCO_DEBUG ,"%s: received NOTIF_ROTATE_KEY for peer-id=%d" , __func__, + dco->dco_message_peer_id); dco->dco_message_type =OVPN_CMD_SWAP_KEYS ;break ;
@@ -670,12 +678,14 @@msg (M_WARN ,"Failed to parse float notification" );break ; } +msg (D_DCO_DEBUG ,"%s: received NOTIF_FLOAT for peer-id=%d" , __func__, + dco->dco_message_peer_id); dco->dco_message_type =OVPN_CMD_FLOAT_PEER ;break ; }default : -msg (M_WARN ,"Unknown kernel notification %d" , type); +msg (M_WARN ,"%s: unknown kernel notification %d" , __func__, type);break ; }
@@ -815,6 +825,8 @@return 0 ; } +msg (D_DCO_DEBUG , __func__); +CLEAR (drv);snprintf (drv.ifd_name,IFNAMSIZ ,"%s" , dco->ifname); drv.ifd_cmd =OVPN_GET_PEER_STATS ;
@@ -873,6 +885,7 @@int dco_get_peer_stats (struct context *c,const bool raise_sigusr1_on_err) { +msg (D_DCO_DEBUG , __func__);/* Not implemented. */ return 0 ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1349?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ife55cb78401dad921b75f6c86d9bd0642f6a6e83
Gerrit-Change-Number: 1349
Gerrit-PatchSet: 4
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>