NAT-PMP and UPnP IGDv2 do not work, UPnP IGDv1 created incorrect port mappings
UPnP bug was reported previously https://git.jami.net/savoirfairelinux/ring-client-android/issues/735
This report contains additional information after some experimentation
- Ring version: 20200501-01
- Device model: CyanogenMod 12.1
- Android version: 5.1.1
- What build you are using: F-droid (https://f-droid.org/repo/cx.ring_238.apk)
Steps to reproduce
-
Can you reproduce the bug: at will
- Add a SIP account with UPnP enabled
-
Steps:
- Force stop Jami (kill process)
- On the router, run miniupnpd with
force_igd_desc_v1=no
(i.e. IGD v2) - Start Jami
-
Actual result:
port 5060 mapping not created -
Expected result: port 5060 mapping created
-
Steps:
- Force stop Jami (kill process)
- On the router, run miniupnpd with
force_igd_desc_v1=yes
(i.e. IGD v1) - Start Jami
-
Actual result:
port 5060 mapping created -
Expected result: port 5060 mapping created
- Make a SIP call
-
Actual result:
port mappings for media (RTP/RTCP) did not match ports in SDP, no audio -
Expected result: port mappings for media (RTP/RTCP) matched ports in SDP, audio worked
-
Steps:
- Force stop Jami (kill process)
- On the router, run miniupnpd with
enable_upnp=no
(i.e. UPnP disabled),enable_natpmp=yes
(i.e. NAT-PMP enabled which is the default option) - Start Jami
-
Actual result:
port 5060 mapping not created -
Expected result: port 5060 mapping created
Additional information
Is it possible to allow users to choose preferred port mapping protocol e.g. an option to make Jami try NAT-PMP first, then fallback to UPnP (or vice versa)?
Some UPnP clients work fine with IGDv2, some don't, I tried this tool https://github.com/kaklakariada/portmapper and found that weupnp worked fine with IGDv2 while others didn't. http://miniupnp.free.fr/ provides both NAT-PMP and UPnP libraries which most likely would work with IGDv2 given that miniupnpd is IGDv2.
When using UPnP IGDv1, Jami seems to use port 0 causing the server to log errors like below
Sun May 17 18:51:08 2020 daemon.warn miniupnpd[18096]: upnp_event_process_notify: connect(192.168.1.197:0): Connection refused
Sun May 17 18:51:08 2020 daemon.err miniupnpd[18096]: upnpevents_processfds: 0x428660, remove subscriber uuid:10c4cddd-e822-40f6-9825-e5e7a04b59fe after an ERROR cb: http://192.168.1.197:0/
Sun May 17 18:51:55 2020 daemon.warn miniupnpd[18096]: upnp_event_process_notify: connect([fde3:a08b:5361:0000:5919:8ce4:538d:d8dd]:0): Connection refused
Sun May 17 18:51:55 2020 daemon.err miniupnpd[18096]: upnpevents_processfds: 0x4286e0, remove subscriber uuid:d8561f30-967b-47d8-921c-9a54f37b57e2 after an ERROR cb: http://[fde3:a08b:5361:0000:5919:8ce4:538d:d8dd]:0/