Wireguard Go C API Callbacks
Manikandan Thiagarajan
tmani at prosimo.io
Thu Mar 10 01:00:48 UTC 2022
Hi,
We are using Wireguard Go C API to integrate with our packet tunnel network extension to forward traffic to WG Tunnel on Mac OS. Sometimes We encounter some issues with the tunnel that it doesn’t respond anymore. Below log is one of the scenarios where we see this issue. The Wireguard log says "no buffer space available”. Below are my questions regarding this issue and in general WG C API.
“[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Failed to read packet from TUN device: route ip+net: sysctl: no buffer space available"
1. When do we hit this issue? How do we prevent this.
2. I think we need some kind of callback C APIs that notifies such errors to the callers.
3. Also it would be nice to have status update callbacks such as Tunnel established, Handshake completed. Handshake failed, Tunnel file descriptor closed and any other updates.
We would like to handle these notifications and take some actions such as re create the tunnels, update our own UI, and etc
Thanks,
Mani
[Sun Mar 6 15:27:15 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: receive incoming v4 - started
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: event worker - stopped
replace_peers=true
public_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
endpoint=x.x.x.x:51820
persistent_keepalive_interval=0
replace_allowed_ips=true
allowed_ip=10.50.19.176/32
public_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
endpoint=x.x.x.x:51820
persistent_keepalive_interval=0
replace_allowed_ips=true
allowed_ip=10.255.254.170/32
for interface 100.140.34.230/11
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:286 [INFO]: Update tunnel 0 CCConfig: private_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
replace_peers=true
public_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
endpoint=x.x.x.x:51820
persistent_keepalive_interval=0
replace_allowed_ips=true
allowed_ip=10.50.19.176/32
public_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
endpoint=x.x.x.x:51820
persistent_keepalive_interval=0
replace_allowed_ips=true
allowed_ip=10.255.254.170/32
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: UAPI: Updating private key
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: UAPI: Removing all peers
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - Stopping
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - Routine: sequential sender - stopped
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - Routine: sequential receiver - stopped
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - Stopping
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - Routine: sequential receiver - stopped
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - Routine: sequential sender - stopped
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - Starting
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - Routine: sequential sender - started
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - UAPI: Created
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - Routine: sequential receiver - started
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - UAPI: Updating endpoint
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - UAPI: Updating persistent keepalive interval
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - UAPI: Removing all allowedips
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - UAPI: Adding allowedip
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - Starting
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - UAPI: Created
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - Routine: sequential receiver - started
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - Routine: sequential sender - started
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - UAPI: Updating endpoint
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - UAPI: Updating persistent keepalive interval
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - UAPI: Removing all allowedips
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - UAPI: Adding allowedip
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: receive incoming v4 - stopped
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: receive incoming v6 - stopped
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: UDP bind has been updated
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: receive incoming v6 - started
[Sun Mar 6 15:27:21 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: receive incoming v4 - started
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Failed to read packet from TUN device: route ip+net: sysctl: no buffer space available
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: TUN reader - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Device closing
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: receive incoming v4 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: receive incoming v6 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - Stopping
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - Routine: sequential sender - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(EBXr…oDk8) - Routine: sequential receiver - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - Stopping
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - Routine: sequential sender - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: peer(3wsi…8IXc) - Routine: sequential receiver - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Device closed
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 2 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 11 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 6 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 10 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 7 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 4 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 10 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 5 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 12 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 2 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 7 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 8 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 1 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 9 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 9 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 5 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 1 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: decryption worker 3 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 11 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 8 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 12 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 4 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 3 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: handshake worker 6 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 5 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 9 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 6 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 11 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 12 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 3 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 10 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 4 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 1 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 7 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 8 - stopped
[Sun Mar 6 15:27:22 2022] 832, AgentPacketTunnelProvider.mm:41 [INFO]: Routine: encryption worker 2 - stopped
More information about the WireGuard
mailing list