diff options
author | Alexander Chernavin <achernavin@netgate.com> | 2023-03-16 09:48:45 +0000 |
---|---|---|
committer | Fan Zhang <fanzhang.oss@gmail.com> | 2023-03-20 16:41:14 +0000 |
commit | d76c029a85f0b5a4bb72c84fb4cd012cbd5465cd (patch) | |
tree | 6570d9a299f31487d179dc84406ca1c669c8bee7 /test/test_stats_client.py | |
parent | 645a588ee3a136bd68b1e89414c6b0a192df3c31 (diff) |
wireguard: fix sending peer events from worker threads
Type: fix
API clients can register for peer events (e.g. to be notified when
connection is established). In a multi-worker setup, peer events might
be triggered from a worker thread. In order to send a peer event to the
clients, an API message needs to be allocated and populated.
API messages allocation is only allowed from the main thread. Currently,
the code does not handle the case when a peer event is trying to be sent
from a worker thread. In debug builds, when this happens, it causes
SIGABRT in vl_msg_api_alloc_internal() because assertion "pool == 0 ||
vlib_get_thread_index () == 0" fails. In production builds, when this
happens, it might cause unexplained behavior.
There is a test that is supposed to catch this but all multi-worker
Wireguard tests are currently disabled. This problem is likely to be one
of the reasons they were disabled.
With this fix, when a peer event is triggered from a worker thread,
allocate and send corresponding API message from the main thread using
RPC.
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Change-Id: Ib3fe19f8070563b35732afd16c017411c089437e
Diffstat (limited to 'test/test_stats_client.py')
0 files changed, 0 insertions, 0 deletions