Setting the firewall to allow all local subnet traffic enables me to connect my Android phone to my computer via KDE Connect. Changing the rules to allow only ports 1717-1764 (as described at https://community.kde.org/KDEConnect) prevents the phone and computer from connecting. Reproducible: Always Steps to Reproduce: 1. Under System Settings -> Firewall, add two policies as follows, with the IP address range adjusted to your local subnet: a) Policy: Allow. Direction: Incoming. Source: 192.168.1.0/24. Destination: 192.168.1.0/24. Port: Any port. b) Policy: Allow. Direction: Outgoing. Source: 192.168.1.0/24. Destination: 192.168.1.0/24. Port: Any port. 2. Use KDE Connect to pair your Android phone to your computer. The phone and computer should recognize each other within a minute. 3. Go back to System Settings -> Firewall, remove the policies from step 1, and add these policies: a) Policy: Allow. Direction: Incoming. Source: 192.168.1.0/24. Destination: 192.168.1.0/24. Port: 1714:1764. Protocol: TCP. b) Policy: Allow. Direction: Incoming. Source: 192.168.1.0/24. Destination: 192.168.1.0/24. Port: 1714:1764. Protocol: TCP. c) Policy: Allow. Direction: Incoming. Source: 192.168.1.0/24. Destination: 192.168.1.0/24. Port: 1714:1764. Protocol: UDP. d) Policy: Allow. Direction: Incoming. Source: 192.168.1.0/24. Destination: 192.168.1.0/24. Port: 1714:1764. Protocol: UDP. 4. Disconnect the phone from wifi for a minute. 5. Try to use KDE Connect to communicate between the phone and computer. Actual Results: My phone cannot see my computer and my computer cannot see my phone. Expected Results: Either KDE Connect should connect my phone to my computer when limited to ports 1714-1764 or the KDE Community Wiki page at https://community.kde.org/KDEConnect should list a different port range that works. If the bug is in the documentation and not the program, then this affects the automatic firewall settings hook request in Bug 337250, and the associated Redhat bug at https://bugzilla.redhat.com/show_bug.cgi?id=1115547. On my computer I'm running fully up-to-date 64-bit Chakra Linux, which as of 2015-06-05 (http://chakraos.org/news/index.php?/archives/149-KDE-Applications-15.04.2-available.html) includes the latest KDE stuff that doesn't depend on Plasma 5 or Frameworks 5. In particular, it includes version 0.8 of KDE Connect. On my phone I'm running unrooted Android 4.1.2 with KDE Connect version 0.8h installed via F-Droid.
The port range is correct [1], so it looks like a configuration problem. Maybe UDP broadcast is not allowed? Also, I've noted that in your second set of policies you only allow "Direction: Incoming", but in your first set of policies you allow both incoming and outgoing. Can that be the issue? Finally, make sure that the syntax for port ranges is 1714:1764 and not 1717-1764 (I've seen in some software the first syntax means "redirect 1714 to 1764"). Also, I don't know if wildcards are allowed, but if they were, one single policy like this should be enough: Policy: Allow. Direction: *. Source: 192.168.1.0/24. Destination: 192.168.1.0/24. Port: 1714:1764. Protocol: *. https://github.com/albertvaka/kdeconnect-kde/blob/master/core/backends/lan/lanlinkprovider.cpp#L69
I don't know about UDP broadcast, but the only thing I changed between KDE Connect working and not working is the firewall rules, not general settings. The firewall configuration tool I'm using is kcm-ufw, which is described at [1] (though Chakra's package manager says it's version 0.5.0-1, which is higher than [1]'s version of 0.4.3). I couldn't copy configurations from kcm-ufw, so I typed one into the report and copy-pasted it as a template for the others, forgetting to change half of them to "Direction: Outgoing". The actual firewall rules are correct as far as I can tell. The hover text for the port number entry box says to use a colon for a range. Also, it ignores any dashes I try to enter. Unfortunately the kcm-ufw on Chakra Linux does not allow such generalized configuration. It also doesn't allow setting protocol between TCP and UDP unless the port is specified, in which case it is mandatory to choose only one of them for the rule. Thus 4 rules are required for one simple thing. Your KDE Connect code looks correct to my C++-naive eyes. The main change to the function in question since the version [2] when Chakra's KDE Connect package was compiled is to add a check for exceeding the maximum port number. At this point, the only explanations I can think of are: (a) the version of KDE Connect on my phone also lacks the maximum port check and the router I'm using is blocking ports 1714-1764, or (b) I fail at setting firewall rules with kcm-ufw. So unless I'm missing something, this bug report is invalid, and I'm sorry for wasting your time. 1: http://kde-apps.org/content/show.php/UFW+KControl+Module?content=137789 2: https://github.com/albertvaka/kdeconnect-kde/blob/c7c1974ea9837bc4a4f71f67327bc51b20411a7f/core/backends/lan/lanlinkprovider.cpp#L75
Did you manage to solve the problem in the end? :)
Please answer Albert and reopen.
Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed. Thank you for helping us make KDE software even better for everyone!
Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging Thank you for helping us make KDE software even better for everyone!