Bug 506182

Summary: Sending files does not work in NAT64 networks
Product: [Applications] kdeconnect Reporter: Sandro <sandro.jaeckel>
Component: commonAssignee: Albert Vaca Cintora <albertvaka>
Status: REPORTED ---    
Severity: normal CC: andrew.g.r.holmes
Priority: NOR    
Version First Reported In: 25.04.2   
Target Milestone: ---   
Platform: NixOS   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Sandro 2025-06-25 19:10:56 UTC
SUMMARY
Sharing a file via kdeconnect on a NAT64 network where the phone supports NAT64 and the laptop not never finishes.

STEPS TO REPRODUCE
1. Join a NAT64 network
2. Pair a Laptop and a Phone in kdeconnect
3. Try sharing a file from the phone to the laptop
4. The notification appears but the file is never send

OBSERVED RESULT
After the notification nothing happens. strace shows the following:

```
[pid  9509] ppoll([{fd=5, events=POLLIN}, {fd=20, events=POLLIN}, {fd=21, events=POLLIN}, {fd=22, events=POLLIN}, {fd=23, events=POLLIN}, {fd=24, events=POLLIN}, {fd=25, events=POLLIN}, {fd=26, events=POLLIN}, {fd=27, events=POLLIN}, {fd=28, events=POLLIN}, {fd=29, events=POLLIN}, {fd=30, events=POLLIN}, {fd=31, events=POLLIN}, {fd=32, events=POLLIN}, {fd=33, events=POLLIN}, {fd=34, events=POLLIN}, {fd=35, events=POLLIN}, {fd=36, events=POLLIN}, {fd=39, events=POLLIN}, {fd=40, events=POLLIN}, {fd=42, events=POLLIN}, {fd=43, events=POLLIN}, {fd=50, events=POLLOUT}, {fd=54, events=POLLIN}], 24, {tv_sec=0, tv_nsec=0}, NULL, 8) = 2 ([{fd=5, revents=POLLIN}, {fd=50, revents=POLLOUT|POLLERR|POLLHUP}], left {tv_sec=0, tv_nsec=0})
[pid  9509] read(5, "\3\0\0\0\0\0\0\0", 8) = 8
[pid  9509] write(5, "\1\0\0\0\0\0\0\0", 8) = 8
[pid  9509] connect(50, {sa_family=AF_INET6, sin6_port=htons(1739), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::ffff:172.20.72.12", &sin6_addr), sin6_scope_id=0}, 28) = -1 ECONNREFUSED (Connection refused)
[pid  9509] write(5, "\1\0\0\0\0\0\0\0", 8) = 8
[pid  9509] close(50) = 0
[pid  9509] socket(AF_INET6, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 50
[pid  9509] setsockopt(50, SOL_SOCKET, SO_OOBINLINE, [1], 4) = 0
[pid  9509] connect(50, {sa_family=AF_INET6, sin6_port=htons(1739), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::ffff:172.20.72.12", &sin6_addr), sin6_scope_id=0}, 28) = -1 EINPROGRESS (Operation now in progress)
[pid  9509] write(5, "\1\0\0\0\0\0\0\0", 8) = 8
[pid  9509] write(5, "\1\0\0\0\0\0\0\0", 8) = 8
[pid  9509] write(4, "\1\0\0\0\0\0\0\0", 8) = 8
[pid  9510] <... ppoll resumed>) = 1 ([{fd=4, revents=POLLIN}])
[pid  9510] read(4,  <unfinished ...>
[pid  9509] newfstatat(AT_FDCWD, "/etc/localtime",  <unfinished ...>
[pid  9510] <... read resumed>"\1\0\0\0\0\0\0\0", 8) = 8
```
172.20.72.12 is the IP of the device doing NAT64 using jool. kdeconnect should probably communicate that the laptop should use IPv6 if the phone uses nat64 or general prefer IPv6 if available.

EXPECTED RESULT
File to be shared

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: NixOS unstable
KDE Plasma Version: 6.4.0
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.0

ADDITIONAL INFORMATION
Comment 1 Sandro 2025-06-27 16:39:15 UTC
I am using Android 16 with KDEConnect App version 1.33.4 from the Play store.