Attention is currently required from: Arne Schwabe.

Name of user not set #1000061 has posted comments on this change by Arne 
Schwabe. ( https://gerrit.openvpn.net/c/openvpn/+/1859?usp=email )

Change subject: Add python scripts that demonstrate using the mangement 
interface
......................................................................


Patch Set 5:

(28 comments)

File sample/management/omi.py:

https://gerrit.openvpn.net/c/openvpn/+/1859/comment/39c7d200_a6d60073?usp=email 
:
PS5, Line 32: import asyncio
We should have full typing in this file, currently it's only partial


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/28ac9a86_5f732c88?usp=email 
:
PS5, Line 79:         # Event to
?


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/bc90a116_31fb5ccd?usp=email 
:
PS5, Line 88:         self._send_queue = asyncio.Queue()
self._send_queue = asyncio.Queue() should be declared before self._send_task - 
its working because task is started on first await but it still quite fragile


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/757ca94a_d2cf3737?usp=email 
:
PS5, Line 99:             logger.info(f'Connection lost ({excp}). Shutting 
down.')
Maybe warning? Or even error?


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/e3779ffa_5153101f?usp=email 
:
PS5, Line 106:             self._send_task.cancel()
Is this enough? What if we still have items left in _send_queue, for example? I 
know it's just a demo, but you never know if someone might just copy-paste it


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/f688d1f9_fe7f0683?usp=email 
:
PS5, Line 109:     async def _send_loop(self):
Shouldn't we wrap this loop in a try-except? If there's any error—like an 
IndexError or ValueError—this task will just fail silently.


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/d96be9f6_b0855b40?usp=email 
:
PS5, Line 146:                     pass
We can remove it


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/141584c1_660f74b8?usp=email 
:
PS5, Line 171:         if self._connect_data.password:
If we are checking password, maybe it should be declared as Optional[str]?


File sample/management/omi_client_protocol.py:

https://gerrit.openvpn.net/c/openvpn/+/1859/comment/b8e9bf39_39d266f2?usp=email 
:
PS5, Line 52:             logger.error(f"Error: trying to send ACC message with 
protocol {protocol} is not in the negotiated list of protocols 
({self._acc_negotiated_protocols})")
Should we have return here?


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/7ec580b9_a439f41b?usp=email 
:
PS5, Line 66:             flags = "6"
We should move it to well names constant


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/25c00ce0_13f349c8?usp=email 
:
PS5, Line 73:             await self.queue_command(command)
Could message chunks get mixed up? We yield control here with await, so in 
theory it could happen?


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/b82f1a77_bba35a09?usp=email 
:
PS5, Line 101:             logger.error(f"Error parsing ACC message: {e}", 
exc_info=True)
Shouldn't we have self._partial_acc_msg = "" here?


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/b5cf3b78_9f5084b3?usp=email 
:
PS5, Line 116:                 handler(self._partial_acc_msg)
Hmm, right now we're not allowing async handlers. Not sure if that matters for 
the demo, but they should probably support both sync and async (using 
nspect.isawaitable)


File sample/management/omi_server_demo.py:

https://gerrit.openvpn.net/c/openvpn/+/1859/comment/d5d44d2c_707ce064?usp=email 
:
PS5, Line 82:     logger.info("pytop module not found. TOTP testing disabled")
typo:)


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/26e6a206_5301f1a0?usp=email 
:
PS5, Line 89: class ServerDemoProtocol(OMIServerProtocol):
Same as other files - missing typing


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/55196b65_31eedabe?usp=email 
:
PS5, Line 97:         kid = client.authenticated_kid
Dow we need it?


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/9309fee4_9008d993?usp=email 
:
PS5, Line 118:         username = client.env.get("username")
get can return None, so it will fail with startswith later


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/3a67cde5_974e436b?usp=email 
:
PS5, Line 166:             await self.send_pending_auth(client, webauth + 
"https://community.openvpn.net";)
Missing kid parameter?


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/7968b30e_dab41017?usp=email 
:
PS5, Line 285:     print(f"Management interface version: {management_version}")
Mix of logger and print, should be logger


File sample/management/omi_server_protocol.py:

https://gerrit.openvpn.net/c/openvpn/+/1859/comment/cf8bfd05_7dc5a8ab?usp=email 
:
PS5, Line 112:         elif event in ("ACC", ):
Why tuple?


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/f81ef4da_5a2ddb9e?usp=email 
:
PS5, Line 116:             logger.info(f"Client event {event} not handled. 
(message: {args!r})")
debug instead of info?


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/5154b7de_1ea393e8?usp=email 
:
PS5, Line 127:         if client._partial_acc_msg and client._kid_acc_msg != kd:
kd? Should be probably kid


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/aceff9f4_5467765b?usp=email 
:
PS5, Line 186:             handler(client, kid, env, extra)
Exception in the handler will kill connection..? + hanlders should be async


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/fe5164fe_c83c14c9?usp=email 
:
PS5, Line 197:     async def get_client_status(self) -> OmiCommandResult:
Missing import for OmiCommandResult


File sample/management/omi_tools.py:

https://gerrit.openvpn.net/c/openvpn/+/1859/comment/2bde1279_8305f66b?usp=email 
:
PS5, Line 27: from omi import OmiProtocol, ConnectionProperties
Like other files -  missing typing


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/4ff2526c_d0e702af?usp=email 
:
PS5, Line 72:     transport, protocol, finish_future = await 
start_management_protocol()
Missing arguments?


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/656a33be_cf3545b2?usp=email 
:
PS5, Line 87: fork
asyncio.run != fork


https://gerrit.openvpn.net/c/openvpn/+/1859/comment/350a0bde_1627e9ac?usp=email 
:
PS5, Line 99:         asyncio.run(main_func(connect_parameters))
main() does not have any arguments



--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/1859?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib09bafabf612e9501ea757647c86a450c73228a5
Gerrit-Change-Number: 1859
Gerrit-PatchSet: 5
Gerrit-Owner: Arne Schwabe <[email protected]>
Gerrit-CC: Name of user not set #1000061
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
Gerrit-Comment-Date: Thu, 29 Oct 2026 12:07:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to