I decided to investigate this further. And with the help of tshark(Wireshark CLI), it became more clear what's going on.
I tested with three players/controllers:
1) UPnPlay (proprietary, always works)
2) Slick UPnP [uses Cling library] (open-source, rarely works)
3) Kodi (does not work)
On the workstation running the server, I ran tshark listening at interface tun0 to see what's going on.
10.8.0.1 is the IP address of the server's TUN interface (assigned by OpenVPN).
10.8.0.2 is the IP address of the tablet's TUN interface (assigned by OpenVPN).
UPnPlay
tshark output (short):
Code:
10.8.0.2 -> 224.0.0.22 IGMPv3 40 Membership Report / Join group 239.255.255.250 for any sources
.
.
10.8.0.2 -> 239.255.255.250 SSDP 129 M-SEARCH * HTTP/1.1
Broadcast search packet (length 129) works and an HTTP connection is established afterwords.
Slick UPnP
tshark output (short):
Code:
10.8.0.2 -> 224.0.0.22 IGMPv3 40 Membership Report / Join group 239.255.255.250 for any sources
10.8.0.2 -> 239.255.255.250 SSDP 122 M-SEARCH * HTTP/1.1
10.8.0.2 -> 239.255.255.250 SSDP 122 M-SEARCH * HTTP/1.1
10.8.0.2 -> 239.255.255.250 SSDP 122 M-SEARCH * HTTP/1.1
Broadcast search packet (length 122) fails at finding any UPnP server.
The difference between the two packets is the ST field. In UPnPlay, it's "upnp:rootdevice".
In Slick UPnP, it's "ssdp:all".
Why Slick UPnP works on occasion
I noticed that Slick UPnP detects the server sometimes. Especially when I restart the server. It turned out the detection works when the server broadcasts NOTIFY packets:
Code:
10.8.0.1 -> 239.255.255.250 SSDP 386 NOTIFY * HTTP/1.1
Those broadcasts are sent when the server starts. And every 895 seconds after that by default. Luckily, that interval is configurable, so setting it to a lower value like 20 seconds works around the issue.
Kodi
With Kodi, I see complete silence as far as the TUN interfaces go. It doesn't send broadcast searches or react to NOTIFY packets.
However, monitoring the wlan0 interface shows that Kodi is sending broadcasts there with the right ST field.
So, I'm more confident now that the issue with Kodi is indeed ignoring the TUN interfaces.