lan-mouse icon indicating copy to clipboard operation
lan-mouse copied to clipboard

os error 10054, webrtc_dtls::conn] server: read_and_buffer exit with Alert is Fatal or Close Notify

Open hazg opened this issue 10 months ago • 4 comments

After a couple minutes of use (pretty fast use), the mouse cannot move to the remote computer.

ubuntu 25.04 - host (ufw - off), GNOME Shell 47.0, wayland

lan-mouse 0.10.0
branch:main
commit_hash:3e1c3e95
build_time:2025-01-27 15:54:48 +00:00
build_env:rustc 1.84.0 (9fc6b4312 2025-01-07),stable-x86_64-unknown-linux-gnu

windows 10 22H2 - remote (firewall - off, uac - off)

lan-mouse 0.10.0
branch:main
commit_hash:3e1c3e95
build_time:2025-01-27 15:58:21 +00:00
build_env:rustc 1.84.0 (9fc6b4312 2025-01-07),stable-x86_64-pc-windows-msvc

Lunux host conf

# example configuration

# capture_backend = "LayerShell"

# release bind
release_bind = ["KeyA", "KeyS", "KeyD", "KeyF"]

# optional port (defaults to 4242)
port = 6666
# optional frontend -> defaults to gtk if available
# frontend = "gtk"

# list of authorized tls certificate fingerprints that
# are accepted for incoming traffic
[authorized_fingerprints]
"8b:c0:09:ss:c2:f0:1e:e7:8e:c9:9f:e8:d5:a7:19:92:28:de:59:d9:81:40:75:5b:8b:ce:4d:28:cf:22:af:05" = "so"

# define a client on the right side with host name "iridium"

# define a client on the left side with IP address 192.168.178.189
[left]
activate_on_startup = true
# The hostname is optional: When no hostname is specified,
# at least one ip address needs to be specified.
hostname = "hp"
# ips for ethernet and wifi
ips = ["192.168.0.37"]
# optional port
port = 6666

Remote windows conf

port = 6666
[authorized_fingerprints]
"8b:c0:09:ss:c2:f0:1e:e7:8e:c9:9f:e8:d5:a7:19:92:28:de:59:d9:81:40:75:5b:8b:ce:4d:28:cf:22:af:05" = "so"

Linux Host LOG

[2025-02-13T07:10:05Z DEBUG input_capture::libei] START EMULATING
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: DeviceStartEmulating(DeviceStartEmulating { device: Device("captured keyboard"), serial: 968, sequence: 56 })
[2025-02-13T07:10:05Z DEBUG input_capture::libei] START EMULATING
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: PointerMotion(PointerMotion { device: Device("captured relative pointer"), time: 136363891710, dx: -16.278507, dy: 0.0 })
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: Frame(Frame { device: Device("captured relative pointer"), serial: 969, time: 136363891710 })
[2025-02-13T07:10:05Z TRACE lan_mouse::capture] (0): Input(Pointer(Motion { time: 3219905534, dx: -16.278507232666016, dy: 0.0 }))
[2025-02-13T07:10:05Z DEBUG input_capture::libei] release session requested
[2025-02-13T07:10:05Z DEBUG input_capture::libei] activated: Activated(OwnedObjectPath(ObjectPath("/org/freedesktop/portal/desktop/session/1_6883/ashpd_QXKptv7VDl")), ActivatedOptions { activation_id: Some(56), cursor_position: Some((0.0, 263.0)), barrier_id: Some(Barrier(1)) })
[2025-02-13T07:10:05Z TRACE lan_mouse::capture] (0): Begin
[2025-02-13T07:10:05Z DEBUG input_capture::libei] release session requested
[2025-02-13T07:10:05Z DEBUG input_capture::libei] releasing input capture 56
[2025-02-13T07:10:05Z DEBUG input_capture::libei] client entered @ (0, 263)
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: DeviceStopEmulating(DeviceStopEmulating { device: Device("captured relative pointer"), serial: 970 })
[2025-02-13T07:10:05Z DEBUG input_capture::libei] STOP EMULATING
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: DeviceStopEmulating(DeviceStopEmulating { device: Device("captured keyboard"), serial: 971 })
[2025-02-13T07:10:05Z DEBUG input_capture::libei] STOP EMULATING
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: DeviceStartEmulating(DeviceStartEmulating { device: Device("captured relative pointer"), serial: 972, sequence: 57 })
[2025-02-13T07:10:05Z DEBUG input_capture::libei] START EMULATING
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: DeviceStartEmulating(DeviceStartEmulating { device: Device("captured keyboard"), serial: 973, sequence: 57 })
[2025-02-13T07:10:05Z DEBUG input_capture::libei] START EMULATING
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: PointerMotion(PointerMotion { device: Device("captured relative pointer"), time: 136363900301, dx: -1.6817079, dy: 0.0 })
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: Frame(Frame { device: Device("captured relative pointer"), serial: 974, time: 136363900301 })
[2025-02-13T07:10:05Z TRACE lan_mouse::capture] (0): Input(Pointer(Motion { time: 3219914125, dx: -1.6817078590393066, dy: 0.0 }))
[2025-02-13T07:10:05Z DEBUG input_capture::libei] release session requested
[2025-02-13T07:10:05Z DEBUG input_capture::libei] activated: Activated(OwnedObjectPath(ObjectPath("/org/freedesktop/portal/desktop/session/1_6883/ashpd_QXKptv7VDl")), ActivatedOptions { activation_id: Some(57), cursor_position: Some((5.9604645e-8, 263.0)), barrier_id: Some(Barrier(1)) })
[2025-02-13T07:10:05Z TRACE lan_mouse::capture] (0): Begin
[2025-02-13T07:10:05Z DEBUG input_capture::libei] release session requested
[2025-02-13T07:10:05Z DEBUG input_capture::libei] releasing input capture 57
[2025-02-13T07:10:05Z DEBUG input_capture::libei] client entered @ (0.000000059604645, 263)
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: DeviceStopEmulating(DeviceStopEmulating { device: Device("captured relative pointer"), serial: 975 })
[2025-02-13T07:10:05Z DEBUG input_capture::libei] STOP EMULATING
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: DeviceStopEmulating(DeviceStopEmulating { device: Device("captured keyboard"), serial: 976 })
[2025-02-13T07:10:05Z DEBUG input_capture::libei] STOP EMULATING
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: DeviceStartEmulating(DeviceStartEmulating { device: Device("captured relative pointer"), serial: 977, sequence: 58 })
[2025-02-13T07:10:05Z DEBUG input_capture::libei] START EMULATING
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: DeviceStartEmulating(DeviceStartEmulating { device: Device("captured keyboard"), serial: 978, sequence: 58 })
[2025-02-13T07:10:05Z DEBUG input_capture::libei] START EMULATING
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: PointerMotion(PointerMotion { device: Device("captured relative pointer"), time: 136363907731, dx: 0.0, dy: 0.0 })
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: Frame(Frame { device: Device("captured relative pointer"), serial: 979, time: 136363907731 })
[2025-02-13T07:10:05Z TRACE lan_mouse::capture] (0): Input(Pointer(Motion { time: 3219921555, dx: 0.0, dy: 0.0 }))
[2025-02-13T07:10:05Z DEBUG input_capture::libei] release session requested
[2025-02-13T07:10:05Z DEBUG input_capture::libei] activated: Activated(OwnedObjectPath(ObjectPath("/org/freedesktop/portal/desktop/session/1_6883/ashpd_QXKptv7VDl")), ActivatedOptions { activation_id: Some(58), cursor_position: Some((0.0, 263.0)), barrier_id: Some(Barrier(1)) })
[2025-02-13T07:10:05Z TRACE lan_mouse::capture] (0): Begin
[2025-02-13T07:10:05Z DEBUG input_capture::libei] release session requested
[2025-02-13T07:10:05Z DEBUG input_capture::libei] releasing input capture 58
[2025-02-13T07:10:05Z DEBUG input_capture::libei] client entered @ (0, 263)
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: DeviceStopEmulating(DeviceStopEmulating { device: Device("captured relative pointer"), serial: 980 })
[2025-02-13T07:10:05Z DEBUG input_capture::libei] STOP EMULATING
[2025-02-13T07:10:05Z TRACE input_capture::libei] from ei: DeviceStopEmulating(DeviceStopEmulating { device: Device("captured keyboard"), serial: 981 })
[2025-02-13T07:10:05Z DEBUG input_capture::libei] STOP EMULATING
[2025-02-13T07:10:05Z TRACE webrtc_dtls::handshaker] [handshake:client] Flight 3 retransmit_timer
[2025-02-13T07:10:05Z TRACE webrtc_dtls::handshaker] [handshake:client] Flight 3: Sending
[2025-02-13T07:10:05Z TRACE webrtc_dtls::conn] Send [handshake:client] -> ClientHello (epoch: 0, seq: 1)
[2025-02-13T07:10:05Z TRACE webrtc_dtls::handshaker] [handshake:client] Flight 3: Waiting
[2025-02-13T07:10:06Z TRACE webrtc_dtls::handshaker] [handshake:client] Flight 3 retransmit_timer
[2025-02-13T07:10:06Z TRACE webrtc_dtls::handshaker] [handshake:client] Flight 3: Sending
[2025-02-13T07:10:06Z TRACE webrtc_dtls::conn] Send [handshake:client] -> ClientHello (epoch: 0, seq: 1)
[2025-02-13T07:10:06Z TRACE webrtc_dtls::handshaker] [handshake:client] Flight 3: Waiting

Remote windows LOG

[2025-02-13T07:10:02Z TRACE lan_mouse::emulation] motion(0,-1) <-<-<-<-<- 192.168.0.66:49360
[2025-02-13T07:10:02Z TRACE lan_mouse::emulation] ping <-<-<-<-<- 192.168.0.66:49360
[2025-02-13T07:10:02Z TRACE lan_mouse::listen] reply pong: alive >=>=>=>=>=> 192.168.0.66:49360
[2025-02-13T07:10:03Z TRACE lan_mouse::emulation] ping <-<-<-<-<- 192.168.0.66:49360
[2025-02-13T07:10:03Z TRACE lan_mouse::listen] reply pong: alive >=>=>=>=>=> 192.168.0.66:49360
[2025-02-13T07:10:03Z TRACE lan_mouse::emulation] ping <-<-<-<-<- 192.168.0.66:49360
[2025-02-13T07:10:03Z TRACE lan_mouse::listen] reply pong: alive >=>=>=>=>=> 192.168.0.66:49360
[2025-02-13T07:10:04Z TRACE lan_mouse::emulation] ping <-<-<-<-<- 192.168.0.66:49360
[2025-02-13T07:10:04Z TRACE lan_mouse::listen] reply pong: alive >=>=>=>=>=> 192.168.0.66:49360
[2025-02-13T07:10:04Z TRACE webrtc_dtls::handshaker] [handshake:server] Flight 0: Preparing
[2025-02-13T07:10:04Z TRACE webrtc_dtls::handshaker] [handshake:server] Flight 0: Sending
[2025-02-13T07:10:04Z TRACE lan_mouse::emulation] button(left, 0) <-<-<-<-<- 192.168.0.66:49360
[2025-02-13T07:10:04Z TRACE webrtc_dtls::conn] Recv [handshake:server] -> ClientHello (epoch: 0, seq: 0)
[2025-02-13T07:10:04Z TRACE webrtc_dtls::conn] server: <- Alert LevelWarning: CloseNotify
[2025-02-13T07:10:04Z TRACE webrtc_dtls::conn] server: read_and_buffer return err: Alert is Fatal or Close Notify
[2025-02-13T07:10:04Z TRACE webrtc_dtls::conn] server: read_and_buffer exit with Alert is Fatal or Close Notify
[2025-02-13T07:10:04Z TRACE webrtc_dtls::handshaker] [handshake:server] Flight 0: Waiting
[2025-02-13T07:10:04Z DEBUG webrtc_dtls::flight::flight0] [handshake:server] use cipher suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
[2025-02-13T07:10:04Z TRACE webrtc_dtls::handshaker] [handshake:server] Flight 0 -> Flight 2
[2025-02-13T07:10:04Z TRACE webrtc_dtls::handshaker] [handshake:server] Flight 2: Preparing
[2025-02-13T07:10:04Z TRACE webrtc_dtls::handshaker] [handshake:server] Flight 2: Sending
[2025-02-13T07:10:04Z INFO  lan_mouse::listen] dtls client disconnected 192.168.0.66:49360
[2025-02-13T07:10:04Z TRACE lan_mouse::emulation] motion(0,-0.8400067090988159) <-<-<-<-<- 192.168.0.66:49360
[2025-02-13T07:10:04Z WARN  webrtc_util::conn::conn_udp_listener] ListenConfig pconn.recv_from error: io error: An existing connection was forcibly closed by the remote host (os error 10054)
[2025-02-13T07:10:04Z TRACE webrtc_dtls::conn] Send [handshake:server] -> HelloVerifyRequest (epoch: 0, seq: 0)
[2025-02-13T07:10:04Z TRACE webrtc_dtls::conn] server: handle_outgoing_packets exit
[2025-02-13T07:10:04Z TRACE webrtc_dtls::handshaker] [handshake:server] Flight 2: Waiting
[2025-02-13T07:10:05Z TRACE webrtc_dtls::handshaker] [handshake:server] Flight 2 retransmit_timer
[2025-02-13T07:10:05Z TRACE webrtc_dtls::handshaker] [handshake:server] Flight 2: Waiting
[2025-02-13T07:10:06Z TRACE webrtc_dtls::conn] server: read_and_buffer exit
[2025-02-13T07:10:06Z TRACE webrtc_dtls::conn] server: handle_outgoing_packets exit
[2025-02-13T07:10:08Z WARN  lan_mouse::emulation] releasing keys: 192.168.0.66:49360 not responding!
[2025-02-13T07:10:08Z DEBUG input_capture] destroying capture 9223372036854775808 @ right
[2025-02-13T07:10:08Z DEBUG input_capture] remaining ids @ right: []
[2025-02-13T07:10:08Z DEBUG input_capture] destroying capture @ right - no remaining ids
[2025-02-13T07:10:21Z INFO  lan_mouse::service] terminating service ...
[2025-02-13T07:10:21Z DEBUG lan_mouse::service] terminating capture ...
[2025-02-13T07:10:21Z DEBUG lan_mouse::capture] terminating capture
[2025-02-13T07:10:21Z DEBUG lan_mouse::service] terminating emulation ...
[2025-02-13T07:10:21Z DEBUG lan_mouse::emulation] terminating emulation
[2025-02-13T07:10:21Z DEBUG lan_mouse::service] terminating dns resolver ...
[2025-02-13T07:10:21Z INFO  lan_mouse] service exited!

hazg avatar Feb 13 '25 07:02 hazg

My temporary workaround. You need to set LAN_MOUSE_LOG_LEVEL=trace in ENV

Set-Location "C:\\path\\to\\lan-mouse"
$processName = "lan-mouse" # Without .exe 
$argumentList = "-d"
$searchString = "webrtc"
$timeout = 5

$logFile = "$processName-log.txt"

function Start-ProcessAndMonitor {
    Start-Process -FilePath $processName -ArgumentList $argumentList -NoNewWindow -RedirectStandardError $logFile
    Start-Sleep -Seconds 5
}

function MonitorOutput {
    $output = Get-Content -Path $logFile -Tail 10
    if ($output -match $searchString) {
        Write-Host "Error detected, restarting $processName"
        Stop-Process -Name $processName -Force
        Start-ProcessAndMonitor
    }
}

Start-ProcessAndMonitor

while ($true) {
    Start-Sleep -Seconds $timeout
    MonitorOutput
}

hazg avatar Feb 13 '25 10:02 hazg

Could you send a full log of this? The above log from the linux side seems to be after the connection has already been closed.

feschber avatar Feb 20 '25 17:02 feschber

This may not related issue, however windows side seems to break connection when it's long idle state.

Had same log on windows side:

webrtc_util::conn::conn_udp_listener] ListenConfig pconn.recv_from error: io error: An existing connection was forcibly closed by the remote host (os error 10054)

Had this log on nixos side:

[2025-03-04T05:56:26Z INFO  lan_mouse::capture] releasing capture: left remote client device region
[2025-03-04T05:57:41Z WARN  lan_mouse::connect] 10.10.0.9:4242 did not respond, closing connection
[2025-03-04T05:57:41Z WARN  lan_mouse::connect] recv error
[2025-03-04T05:57:41Z WARN  lan_mouse::connect] client (1) @ 10.10.0.9:4242 connection closed

After the connection broke, windows does not listen any inputs from nixos side. nixos side throws Connection time out.

Update: netstat.exe -ano shows that the port 0.0.0.0:4242,42410,42411,42422 are reserved by lan-mouse.exe

ilsubyeega avatar Mar 04 '25 09:03 ilsubyeega

Could you send a full log of this? The above log from the linux side seems to be after the connection has already been closed.

I apologize for the long response

I removed the port overrides from the configs.

windows.log

lan-mouse.log

hazg avatar Mar 20 '25 11:03 hazg