]> git.ipfire.org Git - thirdparty/openvpn.git/commit
dco_linux: fix async message reception ovpn-fix-async
authorAntonio Quartulli <antonio@mandelbit.com>
Tue, 22 Jul 2025 19:54:34 +0000 (21:54 +0200)
committerAntonio Quartulli <antonio@mandelbit.com>
Wed, 23 Jul 2025 12:28:37 +0000 (14:28 +0200)
commit5a3b755f23f963d8b3c0892a799668f4bb7484dc
treec511423673c148f55f01af57b57e00683ac99fce
parent684fdd6a0606513cd15d99cea9066d2309650d1c
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 upon some event,
after having 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
according parser. This way, no matter what message we get at
what time, but 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: OpenVPN/openvpn#793
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
src/openvpn/dco_linux.c
src/openvpn/dco_linux.h