]> git.ipfire.org Git - thirdparty/openvpn.git/commit
dco_linux: fix async message reception
authorAntonio Quartulli <antonio@mandelbit.com>
Fri, 25 Jul 2025 17:27:02 +0000 (19:27 +0200)
committerGert Doering <gert@greenie.muc.de>
Fri, 25 Jul 2025 18:04:04 +0000 (20:04 +0200)
commitf353b7100c859a02e70723c998594c3efd83c419
tree5fe47148b1103de73e6a0d963cafec9a6e4784c1
parentdf3ac551259865a0826d4571a3ae48bb1bdf38e3
dco_linux: fix async message reception

Currently whenever we send a PEER_GET request to ovpn, we also
set the CB that is supposed to parse the reply.

However, due to the async nature of netlink messages, we could
get an unrelated notification, sent by ovpn (kernel) upon some event,
after userland has set the CB, but before parsing the awaited reply.

When this happens, the notification is then parsed with the
configured CB instead of the notification parser, thus effectively
rejecting the notification and losing the event.

To fix this inconsistency, make ovpn_handle_msg() the default and
only netlink parser CB. It is configured upon DCO initialization
and is never removed.

ovpn_handle_msg() will check the message type and will call the
corresponding handler. This way, no matter what message we get at
what time, we'll always parse it correctly.

As a bonus we can also simplify the nl_sendmsg() API as we
don't need to pass the cb and its argument anymore.

The ID of the NLCTRL family is now also stored in the DCO
context as we need it to check when we receive a mcast ID
lookup message.

Change-Id: I23ad79e14844aefde9ece34dadef0b75ff267201
Github: closes OpenVPN/openvpn#793
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250725172708.19456-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32339.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/dco_linux.c
src/openvpn/dco_linux.h