OpenVPN / openvpn3

OpenVPN 3 is a C++ class library that implements the functionality of an OpenVPN client, and is protocol-compatible with the OpenVPN 2.x branch.
933 stars 371 forks source link

Error calling protect method on socket [Mac M1] #243

Closed alexsmartens closed 1 year ago

alexsmartens commented 1 year ago

This issue is related to which was unfortunately closed without anyone attempting to solve it.

I'm seeing this problem on an M1 Mac. OpenVPN Connect 3.3.6 (4368): Error calling protect () method on socket. Here's my log:

[Sep 15, 2022, 07:17:13] EVENT: RESOLVE
[Sep 15, 2022, 07:17:13] Contacting
[Sep 15, 2022, 07:17:13] EVENT: WAIT
[Sep 15, 2022, 07:17:13] UnixCommandAgent:
transmitting bypass route to
"host": "XXX.XXX.XXX.XXX"
"ipv6": false,
"pid": 11202
[Sep 15, 2022, 07:17:13] Transport Error:
socket_protect error (UDP)
[Sep 15, 2022, 07:17:13] Client terminated
restarting in 2000 ms...
Screen Shot 2022-09-15 at 7 50 46 AM
alexsmartens commented 1 year ago

The OpenVPN community would really appreciate if someone could take care of fixing the above problem.

For now, @antonb-taod suggested a good temporary fix that worked for me:

I don't know what issue other have, but I was able to solve mine today.

I was getting an error calling protected() method and same logs as mentiones above. I figured out that the file /var/run/agent_ovpnconnect.sock didn't exist and apparently the problem was that for any reason the ovpn agent wasn't running. To solve this I had to start /Library/Frameworks/OpenVPNConnect.framework/Versions/Current/usr/sbin/ovpnagent manually (I'm using macOS M1 12.2.1).

Hope it will help someone.

ordex commented 1 year ago

This bug tracker is about the OpenVPN3 library. For problems with OpenVPN Connect (that is a commercial product), please go to

strayon commented 7 months ago

I resolved this issue by revisiting OpenVPN's startup settings in "Settings > General > Login Items" and re-enabling it. Previously, I had unchecked it in the startup section.

georganix commented 7 months ago

Thank you @strayon that helped. Also, when entering the username in the VPN some servers require a prefix DOMAIN\userhandler. I also removed the DOMAIN\ portion and connected immediately.

diereysaa commented 4 months ago

In my case (MacOS Sonoma 14.1.2 on M2) the solution proposed by @antonb-taod and posted by @alexsmartens worked like a charm. Just needed to add sudo to it and the ampersand for leaving the daemon running in the background:

sudo /Library/Frameworks/OpenVPNConnect.framework/Versions/Current/usr/sbin/ovpnagent &