Skip to content

Conversation

@alloc33
Copy link

@alloc33 alloc33 commented Dec 26, 2025

Backport of commit 7791f53 from master.

Currently, reading and processing of incoming DCO messages are decoupled: notifications are read, parsed, and the relevant information is stored in fields of dco_context_t for later processing. This approach is problematic on Linux, since libnl does not allow reading a single netlink message at a time, which can result in loss of information when multiple notifications are available.

This change adopts a read -> parse -> process paradigm. On Linux, processing is now invoked directly from within the parsing callback.

On Linux, a DEL_PEER notification from the kernel triggers a GET_PEER request from userspace, which can lead to errors when multiple simultaneous DEL_PEER notifications are received. To avoid this, introduce a lock that prevents requesting stats while still busy parsing other messages.

Note: The 2.6 backport requires additional changes not present in the master commit because the multi context linkage infrastructure differs:

  • Added multi pointer to struct context (openvpn.h)
  • Set context linkages in init.c, mtcp.c, mudp.c
  • Added dco_linux.h changes for context pointer

Reported-by: Stefan Baranoff stefan.baranoff@trinitycyber.com
Github: #900
Github: #918
Github: #931
Github: fixes #919
(backport of commit 7791f53)

Thank you for your contribution

You are welcome to open PR, but they are used for discussion only. All
patches must eventually go to the openvpn-devel mailing list for review:

Please send your patch using git-send-email. For example to send your latest commit to the list:

$ git send-email --to=openvpn-devel@lists.sourceforge.net HEAD~1

For details, see these Wiki articles:

Backport of commit 7791f53 from master.

Currently, reading and processing of incoming DCO messages are
decoupled: notifications are read, parsed, and the relevant information
is stored in fields of dco_context_t for later processing. This approach
is problematic on Linux, since libnl does not allow reading a single
netlink message at a time, which can result in loss of information when
multiple notifications are available.

This change adopts a read -> parse -> process paradigm. On Linux,
processing is now invoked directly from within the parsing callback.

On Linux, a DEL_PEER notification from the kernel triggers a GET_PEER
request from userspace, which can lead to errors when multiple
simultaneous DEL_PEER notifications are received. To avoid this,
introduce a lock that prevents requesting stats while still busy
parsing other messages.

Note: The 2.6 backport requires additional changes not present in the
master commit because the multi context linkage infrastructure differs:
- Added multi pointer to struct context (openvpn.h)
- Set context linkages in init.c, mtcp.c, mudp.c
- Added dco_linux.h changes for context pointer

Reported-by: Stefan Baranoff <stefan.baranoff@trinitycyber.com>
Github: OpenVPN#900
Github: OpenVPN#918
Github: OpenVPN#931
Github: fixes OpenVPN#919
(backport of commit 7791f53)

Signed-off-by: Nikolai Shelekhov <nickshv13@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant