philippe44 / LMS-uPnP

Integrate UPnP players with LogitechMediaServer
108 stars 17 forks source link

Could you offer way to use UPnPInit2? #59

Closed kpelckmans closed 1 year ago

kpelckmans commented 2 years ago

Running squeeze2upnp-x86-64 on a linux host with multiple network interfaces, squeeze2upnp runs on the wrong interface:

start with -b 192.168.0.1:49153, also reported in log file Binding to 192.168.0.1:49153 (http:49153)

using tcpdump -i eth1 -s0 -vv host 239.255.255.250', it shows that squeeze2upnp is trying to run presence check on eth1:

tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes
18:58:20.003610 IP (tos 0x0, ttl 4, id 60820, offset 0, flags [DF], proto UDP (17), length 158)
10.0.0.1.58791 > 239.255.255.250.1900: [bad udp cksum 0xb23b -> 0xb589!] UDP, length 130
18:58:20.105277 IP (tos 0x0, ttl 4, id 60842, offset 0, flags [DF], proto UDP (17), length 158)
10.0.0.1.58791 > 239.255.255.250.1900: [bad udp cksum 0xb23b -> 0xb589!] UDP, length 130

looking at the discussion to drop UpnpInit

2020-06-09 Fabrice Fontaine <fontaine.fabrice(at)gmail.com>

Drop UpnpInit
GitHub #182

This function is deprecated since a long time moreover it is vulnerable
to CallStranger a.k.a. CVE-2020-12695 and can't be fixed without
breaking the API as HostIP only allows the user to pass an IP address
and not a netmask.

If we want to discover the netmask from the HostIP provided in UPnPInit,
we'll have to loop through all the available interfaces to find the
interface with the given IP address to finally retrieve the netmask.
This is a lot of work/modification for a deprecated function. Moreover,
in the end UPnPInit will be like a "deprecated" (i.e. IPv4-only) version
of UPnPInit2.

So it is time to remove this deprecated function.

As a result, also remove getlocalhostname and DEFAULT_INTERFACE which
are not needed anymore and replace UpnpInit by UpnpInit2 in comments.

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

would it be possible to implement UpnpInit2?

I believe this would also solve my problem of specifying the correct interface. I have been trying to force squeeze2upnp on the right interface, even disabling interfaces, but nothing seems to help.

kpelckmans commented 2 years ago

In the mean time I solved the issue with a very simple re-routing: ip route add 239.255.255.250/32 dev eth0. Now it works

philippe44 commented 1 year ago

New version have updated libpupnp and now can handle iface name direclty