Cannot completely disable UPnP on Kodi
#1
Hello,

I've been trying to get Kodi to completely shut down its UPnP server in order to launch my custom UPnP virtual device along with it, but I cannot seem to be able to do it.
Here is an excerpt of guisettings.xml
Code:
<services>
        <airplay>false</airplay>
        <airplaypassword default="true"></airplaypassword>
        <airplayvideosupport default="true">true</airplayvideosupport>
        <airplayvolumecontrol default="true">true</airplayvolumecontrol>
        <devicename>osmc-Gideon</devicename>
        <esallinterfaces>true</esallinterfaces>
        <escontinuousdelay default="true">25</escontinuousdelay>
        <esenabled default="true">true</esenabled>
        <esinitialdelay default="true">750</esinitialdelay>
        <esmaxclients default="true">20</esmaxclients>
        <esport default="true">9777</esport>
        <esportrange default="true">10</esportrange>
        <upnpannounce>false</upnpannounce>
        <upnpcontroller default="true">false</upnpcontroller>
        <upnplookforexternalsubtitles default="true">false</upnplookforexternalsubtitles>
        <upnprenderer default="true">false</upnprenderer>
        <upnpserver default="true">false</upnpserver>
        <useairplaypassword default="true">false</useairplaypassword>
        <webserver default="true">true</webserver>
        <webserverpassword default="true"></webserverpassword>
        <webserverport default="true">8080</webserverport>
        <webserverusername default="true"></webserverusername>
        <webskin default="true">webinterface.default</webskin>
        <zeroconf>false</zeroconf>
    </services>

I set everything regarding upnp and zeroconf to false but Kodi still opens the port on the next launch:
Code:
osmc@osmc-Gideon:~$ sudo netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      1078/kodi.bin
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      280/mono
tcp        0      0 0.0.0.0:1075            0.0.0.0:*               LISTEN      1078/kodi.bin
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      265/sshd
tcp        0      0 192.168.1.118:34206     0.0.0.0:*               LISTEN      280/mono
tcp        0      0 127.0.0.1:32806         0.0.0.0:*               LISTEN      280/mono
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      331/rpcbind
tcp6       0      0 :::8080                 :::*                    LISTEN      1078/kodi.bin
tcp6       0      0 :::22                   :::*                    LISTEN      265/sshd
tcp6       0      0 :::9090                 :::*                    LISTEN      1078/kodi.bin
tcp6       0      0 :::111                  :::*                    LISTEN      331/rpcbind
udp        0      0 127.0.0.1:51561         0.0.0.0:*                           280/mono
[b]udp        0      0 0.0.0.0:1900            0.0.0.0:*                           1078/kodi.bin[/b]
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           280/mono
udp        0      0 0.0.0.0:10621           0.0.0.0:*                           1078/kodi.bin
udp        0      0 0.0.0.0:929             0.0.0.0:*                           331/rpcbind
udp        0      0 0.0.0.0:9777            0.0.0.0:*                           1078/kodi.bin
udp        0      0 0.0.0.0:111             0.0.0.0:*                           331/rpcbind
udp        0      0 192.168.1.118:123       0.0.0.0:*                           436/ntpd
udp        0      0 127.0.0.1:123           0.0.0.0:*                           436/ntpd
udp        0      0 0.0.0.0:123             0.0.0.0:*                           436/ntpd
udp        0      0 0.0.0.0:43751           0.0.0.0:*                           247/avahi-daemon: r
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           247/avahi-daemon: r
udp6       0      0 :::1900                 :::*                                280/mono
udp6       0      0 :::929                  :::*                                331/rpcbind
udp6       0      0 :::54312                :::*                                247/avahi-daemon: r
udp6       0      0 :::111                  :::*                                331/rpcbind
udp6       0      0 ::1:123                 :::*                                436/ntpd
udp6       0      0 :::123                  :::*                                436/ntpd
udp6       0      0 :::5353                 :::*                                247/avahi-daemon: r

Any ideas? Did I miss another configuration file used for UPnP, or forgot to disable another service?

EDIT: noticed I miss quite important bits:
This is Kodi 16.1-RC3 running on OSMC 2016.04-1 on a Raspberry Pi 2

Thanks,
rally
Reply
#2
Thread moved to the Pi section
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#3
Okay so I did a bit more research on this issue, and it seems that Kodi always starts the UPnP network bits, despite them being disabled in the setting file.
In NetworkServices.cpp, line 825 begins the StartUPnP method that is called every time Kodi boots (from line 484), and this method doesn't do any checking of the settings nor does most of the submethods called.

I'll work in a fix later this week unless someone is faster than I am.
Reply
#4
Made the fix and created PR #10072 on github
https://github.com/xbmc/xbmc/pull/10072
Reply
#5
Nice find, thanks for the fix!
Reply

Logout Mark Read Team Forum Stats Members Help
Cannot completely disable UPnP on Kodi0