[Openvpn-devel,3/3] dco: improve comment about hidden debug message

Message ID 20230103202330.1835-3-a@unstable.cc
State Accepted
Headers show
Series [Openvpn-devel,1/3] dco: properly re-initialize dco_del_peer_reason | expand

Commit Message

Antonio Quartulli Jan. 3, 2023, 8:23 p.m. UTC
While at it also improve the debug message itself
to be more self-explanatory.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 src/openvpn/multi.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Arne Schwabe Jan. 6, 2023, 3:04 p.m. UTC | #1
Am 03.01.23 um 21:23 schrieb Antonio Quartulli:
> While at it also improve the debug message itself
> to be more self-explanatory.
> 
> Signed-off-by: Antonio Quartulli <a@unstable.cc>
> ---
>   src/openvpn/multi.c | 13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
> index b10a6d8d..8facc66f 100644
> --- a/src/openvpn/multi.c
> +++ b/src/openvpn/multi.c
> @@ -3296,12 +3296,17 @@ multi_process_incoming_dco(struct multi_context *m)
>           if (dco->dco_message_type == OVPN_CMD_DEL_PEER
>               && dco->dco_del_peer_reason == OVPN_DEL_PEER_REASON_USERSPACE)
>           {
> -            /* we get notified after we kill the peer ourselves and probably
> -             * have already forgotten about it. This is expected */
> +            /* we receive OVPN_CMD_DEL_PEER message with reason USERSPACE
> +             * after we kill the peer ourselves. This peer may have already
> +             * been deleted, so we end up here.
> +             * In this case, print the following debug message with DCO_DEBUG
> +             * level only to avoid polluting the standard DCO level with this
> +             * harmless event.
> +             */
>               msglevel = D_DCO_DEBUG;
>           }
> -        msg(msglevel, "Received packet for peer-id unknown to OpenVPN: %d, "
> -            "type %d, reason %d", peer_id, dco->dco_message_type,
> +        msg(msglevel, "Received DCO message for unknown peer-id: %d, "
> +            "type %d, del_peer_reason %d", peer_id, dco->dco_message_type,
>               dco->dco_del_peer_reason);
>           /* Also clear the buffer if this was incoming packet for a dropped peer */
>           buf_init(&dco->dco_packet_in, 0);

Acked-By: Arne Schwabe <arne@rfc2549.org>
Gert Doering Jan. 7, 2023, 5:55 p.m. UTC | #2
Not sure about the message rewording ("I can understand both variants
just fine"), but - as discussed - the comment is helpful for readers
foreign to these code paths.

Not tested beyond "does it compile?" - trivial enough.

Your patch has been applied to the master and release/2.6 branch.

commit b20daf274304ee30daa839910e633c96307a4744 (master)
commit fce1e72f18aea303056967f6a2e6be9324a9ca4e (release/2.6)
Author: Antonio Quartulli
Date:   Tue Jan 3 21:23:30 2023 +0100

     dco: improve comment about hidden debug message

     Signed-off-by: Antonio Quartulli <a@unstable.cc>
     Acked-by: Arne Schwabe <arne@rfc2549.org>
     Message-Id: <20230103202330.1835-3-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25883.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index b10a6d8d..8facc66f 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -3296,12 +3296,17 @@  multi_process_incoming_dco(struct multi_context *m)
         if (dco->dco_message_type == OVPN_CMD_DEL_PEER
             && dco->dco_del_peer_reason == OVPN_DEL_PEER_REASON_USERSPACE)
         {
-            /* we get notified after we kill the peer ourselves and probably
-             * have already forgotten about it. This is expected */
+            /* we receive OVPN_CMD_DEL_PEER message with reason USERSPACE
+             * after we kill the peer ourselves. This peer may have already
+             * been deleted, so we end up here.
+             * In this case, print the following debug message with DCO_DEBUG
+             * level only to avoid polluting the standard DCO level with this
+             * harmless event.
+             */
             msglevel = D_DCO_DEBUG;
         }
-        msg(msglevel, "Received packet for peer-id unknown to OpenVPN: %d, "
-            "type %d, reason %d", peer_id, dco->dco_message_type,
+        msg(msglevel, "Received DCO message for unknown peer-id: %d, "
+            "type %d, del_peer_reason %d", peer_id, dco->dco_message_type,
             dco->dco_del_peer_reason);
         /* Also clear the buffer if this was incoming packet for a dropped peer */
         buf_init(&dco->dco_packet_in, 0);