FDH2 / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.55k stars 78 forks source link

Stalling after "Initialized server socket(s)" - but no firewall is active. #8

Closed BraveSentry closed 3 years ago

BraveSentry commented 3 years ago

Well, the title says it all. I have no active firewall but UxPlay stalls after "Initialized server socket(s)", even using -d I only get my MAC adress and "Initialized server socket(s)".

UxPlay is visible on my iPad but won't connect. I use Linux Mint 20.2 and an 8th gen iPad running iPadOS 14.4.1.

Any idea what I could do about this?

fduncanh commented 3 years ago

Here is the -d (debug) output of a successful start (with a firewall open at the default ports -p )

I dont know about the setup at Linux Mint but I would still guess some sort of firewall is blocking the ports somehow the iPads request to the server is not getting through. Here socket 31 is open at the main server port, 7000 in this case. https://topnewreview.com/using-the-mint-firewall/

$ uxplay -p -d using network ports UDP 7011 6001 6000 TCP 7100 7000 7001

Initialized server socket(s) Accepted IPv4 client on socket 31 Local: 192.168.1.25 Remote: 192.168.1.136 Open connections: 1 httpd receiving on socket 31 conn_request Handling request GET with URL /info INFO len = -1484793884 httpd receiving on socket 31 conn_request Handling request POST with URL /pair-setup httpd receiving on socket 31 conn_request Handling request POST with URL /pair-verify httpd receiving on socket 31 conn_request Handling request POST with URL /pair-verify httpd receiving on socket 31 conn_request Handling request POST with URL /fp-setup httpd receiving on socket 31 conn_request Handling request POST with URL /fp-setup httpd receiving on socket 31 conn_request Handling request SETUP with URL rtsp://192.168.1.25/7027027721913583545 DACP-ID: 41A43D016F643E8A Active-Remote: 1542534805 Transport: null SETUP 1 eiv_len = 16 ekey_len = 72 fairplay_decrypt ret = 0 timing_rport = 52980 raop_ntp parse remote ip = 192.168.1.136 raop_ntp starting time raop_ntp local timing port socket 32 port UDP 7011 raop_rtp parse remote ip = 192.168.1.136 raop_rtp_mirror parse remote ip = 192.168.1.136 eport = 7000, tport = 7011 raop_ntp send_len = 32 raop_ntp receive time type_t packetlen = 32 raop_ntp sync correction = -1631517287917886 Accepted IPv4 client on socket 33 Local: 192.168.1.20 Remote: 192.168.1.136 Open connections: 2 httpd receiving on socket 31 conn_request Handling request GET with URL /info INFO len = -1484793884 httpd receiving on socket 31 conn_request Handling request GET_PARAMETER with URL rtsp://192.168.1.25/7027027721913583545 httpd receiving on socket 31 conn_request Handling request RECORD with URL rtsp://192.168.1.25/7027027721913583545 raop_handler_record httpd receiving on socket 31 conn_request Handling request SETUP with URL rtsp://192.168.1.25/7027027721913583545 DACP-ID: 41A43D016F643E8A Active-Remote: 1542534805 Transport: null type = 110 streamConnectionID = 18278198698970988890 raop_rtp_mirror starting mirroring raop_rtp_mirror local data port socket 34 port TCP 7100 Mirroring initialized successfully httpd receiving on socket 31 conn_request Handling request SET_PARAMETER with URL rtsp://192.168.1.25/7027027721913583545 raop_rtp_mirror accepting client httpd receiving on socket 31 conn_request Handling request SET_PARAMETER with URL rtsp://192.168.1.25/7027027721913583545 raop_rtp_mirror width_source = 1440.000000 height_source = 1080.000000 width = 1440.000000 height = 1080.000000 raop_rtp_mirror sps size = 18 raop_rtp_mirror pps size = 4 raop_rtp_mirror video ntp = 1631633639816005, now = 1631633639770091, latency = -45914 raop_rtp_mirror video ntp = 1631633639865977, now = 1631633639791087, latency = -74890 raop_rtp_mirror video ntp = 1631633639882633, now = 1631633639808251, latency = -74382

fduncanh commented 3 years ago

Mint firewall is on by default.

user-friendly firewall for Linux Mint DE - Linux Mint Forums [Search domain forums.linuxmint.com] https://forums.linuxmint.com/viewtopic.php?p=781324 The Linux Mint firewall is on by default. Netfilter (IPTables) has a basic set of rules that in general allow internal programs to send stuff out and block external computers from sending unrequested stuff in. UFW, and its GUI interface GUFW (included as "Firewall" in Mint) provide a simpler means of establishing Netfilter rules that lets the user avoid having to exactly mimic the rule rules ...

BraveSentry commented 3 years ago

Thanks for the input. I took a look at my iptables config. It defaults to open. I used

# iptables -I INPUT -p tcp --dport PORTNR -j ACCEPT

and

# iptables -I OUTPUT -p tcp --sport PORTNR -j ACCEPT

for opening the standard ports of UxPlay anyway. The GUI firewall also was turned off all along. Just to be sure, I temporarily switched it on and allowed incoming traffic. All yields the same result: It stops at "Initialized server socket(s)"

Any other ideas?

fduncanh commented 3 years ago

As I said, Its a firewall problem. allow both incoming and outgoing.

on mint start firewall configuration (brick wall icon on mint) switch on the firewall with the slider Profile: public incoming: allow outgoing: allow. this completely opens the firewall

This allows uxplay to works on mint. it seems like if you don't configure the firewall on mint it is closed by default (?)

Since you probably want a firewall, follow the uxplay instruction to just open 3 tcp and 3 udp ports

you then need the -p [n] option when starting uxplay. I suggest using the legacy ports you get with -p (no n)

BraveSentry commented 3 years ago

Thanks for your suggesttion. I tried it to the letter, which gave no other result. I tested switching the profile to home, work and public respectively, each open for incoming and outgoing traffic. Still UxPlay is visible on the iPad but won't connect. All I see on Mint is the MAC address used and "Initialized server socket(s)". With -p, I also get the ports Uxplay tries to use.

Edit: -d does not give any other output. I tried this on my home network and on my mobile hotspot. I'll try it at work today but have no high hopes for it to work at work.

BraveSentry commented 3 years ago

So I've looked around a bit for things that might help spotting the problem a bit more exactly:

Using sudo pktstat -n, while the ipad tries to connext, I get this, with ...133 being the iPad and ...219 being the computer:

 112.9   0% tcp 192.168.0.133:49477 <-> 192.168.0.219:7000
 112.9   0% tcp 192.168.0.133:49479 <-> 192.168.0.219:7000

Using sudo ufw status verbose gives me this (if you need a translation, please ask):


Status: Aktiv
Protokollierung: on (full)
Voreinstellung: allow (eingehend), allow (abgehend), deny (gesendet)
Neue Profile: skip

Zu                         Aktion      Von
--                         ------      ---
7011/udp                   ALLOW IN    Anywhere                  
7000/tcp                   ALLOW IN    Anywhere                  
7100/tcp                   ALLOW IN    Anywhere                  
7001/tcp                   ALLOW IN    Anywhere                  
6001/udp                   ALLOW IN    Anywhere                  
6000/udp                   ALLOW IN    Anywhere                  
7011/udp (v6)              ALLOW IN    Anywhere (v6)             
7000/tcp (v6)              ALLOW IN    Anywhere (v6)             
7100/tcp (v6)              ALLOW IN    Anywhere (v6)             
7001/tcp (v6)              ALLOW IN    Anywhere (v6)             
6001/udp (v6)              ALLOW IN    Anywhere (v6)             
6000/udp (v6)              ALLOW IN    Anywhere (v6)  

And finally, when uxplay is active, sudo netstat -tulpen | grep ux only lists the following:

tcp 0 0 0.0.0.0:7000 0.0.0.0:* LISTEN 1000 746210 26285/uxplay

Could you figure out anything with this?

fduncanh commented 3 years ago

on mint, correct (working) firewall settings (for choice of ports -p )

sudo ufw status

Status: active

To                         Action      From
--                         ------      ----
7000,7001,7100/tcp         ALLOW       Anywhere                  
6000,6001,7011/udp         ALLOW       Anywhere                  
7000,7001,7100/tcp (v6)    ALLOW       Anywhere (v6)             
6000,6001,7011/udp (v6)    ALLOW       Anywhere (v6)             

7000,7001,7100/tcp         ALLOW OUT   Anywhere                  
6000,6001,7011/udp         ALLOW OUT   Anywhere                  
7000,7001,7100/tcp (v6)    ALLOW OUT   Anywhere (v6)             
6000,6001,7011/udp (v6)    ALLOW OUT   Anywhere (v6)             
fduncanh commented 3 years ago
 sudo netstat -tulpen | grep ux
tcp        0      0 0.0.0.0:7000            0.0.0.0:*               LISTEN      1000       55560      3284/uxplay         
tcp        0      0 0.0.0.0:7100            0.0.0.0:*               LISTEN      1000       55572      3284/uxplay         
udp        0      0 0.0.0.0:7011            0.0.0.0:*                           1000       55570      3284/uxplay    
BraveSentry commented 3 years ago

Okay, now I'm one step further: sudo ufw status output now looks like yours. sudo netstat -tulpen | grep ux only gives me tcp 0 0 0.0.0.0:7000 0.0.0.0:* LISTEN 1000 746210 26285/uxplay and nothing else. Starting uxplay -p -d gives me the same as before, but also an error message:

using network ports UDP 7011 6001 6000 TCP 7100 7000 7001

using randomly-generated MAC address 82:20:32:79:6f:1c

Error initialising socket 98

Edit: After a reboot, uxplay -p -d is back to the same as before:

using network ports UDP 7011 6001 6000 TCP 7100 7000 7001

using randomly-generated MAC address c6:e6:09:34:bc:e5

Initialized server socket(s)

Still uxplay is visible on the iPad but not able to connect.

BraveSentry commented 3 years ago

Okay, never mind, I just had a closer look at the iPad (which I got from my employer and use only for work) and found out that everything it does goes through a work related proxy. I can't even connect to my own wifi at home unless I use that proxy. I strongly suspect this was the error all along. I'll talk to some people at work to see if they can do something about that. Thanks for your patience and help!

BraveSentry commented 3 years ago

I'm sorry to have to reopen this, but the issue persists with a two iPads that doe not go via proxies, One tested in my home wifi, the other with my mobile hotspot. The results are the same as described above.

fduncanh commented 3 years ago

[boot linux mint 20.2, open a terminal] $ cat /etc/issue Linux Mint 20.2 Uma \n \l [disable the firewall] $ sudo ufw disable Firewall stopped and disabled on system startup $ sudo ufw status Status: inactive [now pull down the :screen mirroring box on the iPad] $ uxplay -n test using randomly-generated MAC address 9e:cc:74:c4:15:ba

Initialized server socket(s) [the name "test" should appear in the screen mirroring box on the pad: touch it to select]

Accepted IPv4 client on socket 29 Local: 192.168.1.20 Remote: 192.168.1.136 Open connections: 1 Accepted IPv4 client on socket 33 Local: 192.168.1.20 Remote: 192.168.1.136 Open connections: 2 raop_rtp_mirror starting mirroring

if this doesn't work ????? are you perhaps running some other firewall like firewalld ? (its possible to install this on ubuntu-like systems like mint) check with $ sudo firewall-cmd state sudo: firewall-cmd: command not found [if its there and on, the response would be "running"]

did you mess with iptables in some way ?

fduncanh commented 3 years ago

the test was on a 7th gen iPad running iPadOS 14.8. if possible test with 7th gen or earlier iPad to verify that Apple didnt change anything in 8'th gen. you said you had more than one iPad for testing.

fduncanh commented 3 years ago

sudo firewall-cmd --state is the test for firewalld

fduncanh commented 3 years ago

after getting uxplay working with no firewall, configure the firewall, and use uxplay -p[n]

BraveSentry commented 3 years ago

Thanks very much! I didn't know firewalld even existed and just assumed that there just was iptables and the ufw-gui. Switching firewalld off completely did the trick. Now I just have to find out how to open the ports there. Thanks again for your patience. That also clears the question about 8th gen iPads, no? If so, feel free to close. If not, please ask.

fduncanh commented 3 years ago

maybe uninstall firewalld and just use ufw.

On Sep 17, 2021, at 7:23 AM, BraveSentry @.***> wrote:

Thanks very much! I didn't know firewalld even existed and just assumed that there just was iptables and the ufw-gui. Switching firewalld off completely did the trick. Now I just have to find out how to open the ports there. Thanks again for your patience. That also clears the question about 8th gen iPads, no? If so, feel free to close. If not, please ask.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/FDH2/UxPlay/issues/8#issuecomment-921719395, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARKXYDLNXEXFAOLOKZASQ2TUCMQM7ANCNFSM5D7OFOAA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

fduncanh commented 3 years ago

problem was that user didn't know firewalld was also active. fixed, closing