Skip to content

kcd connect <ip> can never succeed: pre-TLS identity carries targetDeviceId 'manual', app drops it #31

Description

@ekollof

Summary

kcd connect <ip> dials with targetID = "manual" (internal/daemon/ipc_routes.go), and DialDevice unconditionally copies that into the pre-TLS plaintext identity as TargetDeviceID (internal/daemon/transport.go). The Android app enforces targetDeviceId when present (LanLinkProvider.kt):

val targetDeviceId = identityPacket.getStringOrNull("targetDeviceId")
if (targetDeviceId != null && targetDeviceId != DeviceHelper.getDeviceId(context)) {
    Log.e("KDE/LanLinkProvider", "Received a connection request for a device that isn't me: $targetDeviceId")
    socket.closeSafe()
    return
}

So every manual connect is rejected with isn't me: manual. kcd itself enforces the same rule inbound (transport.go: preBody.TargetDeviceID != "" && != localDeviceID \u2192 drop), so a literal "manual" value is wrong on both sides.

Evidence (live capture, kcd 1.18.1 + KDE Connect Android 1.35.16, Pixel 10a)

Phone logcat at the moment of kcd connect 192.168.178.98:

I KDE/LanLinkProvider: identity packet received from a TCP connection from mercury
E KDE/LanLinkProvider: Received a connection request for a device that isn't me: manual

Daemon side only ever shows the dial (device_id=manual); the phone closes right after reading the identity.

Impact

Combined with no dial-on-startup (auto-reconnect only runs post-drop) and the phone not dialling back on its own, there is currently no working path to (re)establish a link to a known paired device short of a full unpair/re-pair cycle.

Suggested fix

When the target id is unknown (manual connect), omit TargetDeviceID (empty \u2192 field absent) instead of sending the placeholder. The app skips the check when the field is null, and auto-reconnect/pair flows that pass the real id are unaffected.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions