Menu

#77 Allowing SSDP M-SEARCH from other subnets

Unstable (example)
closed-accepted
5
2015-12-02
2012-02-29
No

This patch was in response to the Help I got regarding :
https://sourceforge.net/projects/minidlna/forums/forum/879957/topic/5062120

It is only active when one interface is configured : n_lan_addr == 1
I have tested the code here, and I can play a movie over the network.
The patch was created against the debian package minidlna-1.0.23+dfsg, but I think
it should be easy enough to apply in CVS.

If there is anything I can do to improve the patch let me know.

Thanks

Discussion

  • pasdVn

    pasdVn - 2013-11-18

    I tried to implement a more clean sollution of this issue.
    The wrong assumption in the current code is, that the tcp/ip stack of the kernel does not a correct filtering of udp multicasts, but is does. The socket only provides datagramms from that interfaces, we added a ip multicast membership for.
    Additionally, when we receive a datagramm, we can ask the kernel which interface received it, so that we dont't have to rely on the current same-subnet-hack for getting the interface adress we need to put in to the ssdp-response.

    Maybe somebody should try it on other platforms, but for me it works at least with linux kernel.

    Additional hint:
    I also noticed, that the current feature of limiting minidlna to certain interfaces is only implemented for ssdp, but (at least) not for http (the socket for media transport). So if this really should be someting like a security feature the http (and all other) server-sockets should be splitted by interface!?

     
    • Florian Will

      Florian Will - 2015-04-02

      Thanks, that patch is now used in the current Debian sid package. :)
      http://anonscm.debian.org/cgit/collab-maint/minidlna.git/plain/debian/patches/08_fix_multicast_from_other_subnet.patch?id=02e74952c8714809c43c9aa7ed80ff07a0d7d82e

      It fails on the freebsd kernel though, it's missing IP_PKTINFO. Not sure if that means the patch will be dropped in the future. Either the patch or kfreebsd support needs to go. Or someone fixes this for freebsd. :-)

       
      • Alexander GQ Gerasiov

        =( Yep, there is lack of IP_PKTINFO in FreeBSD (but there is one in NetBSD[1], so may be one day they will port it to FreeBSD too).

        For now, I'm going to add #ifdef magic to use PKTINFO only on hosts with PKTINFO support.

         
  • Sébastien Fulidis

    Hi there,
    this is my really first contribution to a sf project.
    Since a long time, I've tried to found a way to enable minidlna to work between networks. So the patch dated from 2012-02-29 was integrated and was worked for me by chance (indeed, the client was aware how to communicate with my 192.168.x.x subnet).

    But now I've changed my network with a first unsecured LAN in 192.168.x.x, and another behind a firewall router in 192.168.y.x.

    igmpproxy seems to be quite good to forward request from LAN to WAN, but after a bit wiresharking, I've found that client on x network doesn't know how to reach the server on y network, and I can't change client's route.

    The main idea behind this patch is to add a configuration option 'fake_lan' in minidlna.conf. If a SSDP muticast comes from another subnet, the host returned to the client is the fake_lan. You should set in fake_lan the address of the router in the WAN side and enable forwarding TCP requests on miniDLNA port from WAN to the server, and it should work, at least for me.

    What can be improved is a well integration of multiple network interfaces answer, with a different fake_lan per interface.

    Please note the patch is based on next git sha:
    commit f18c3cee6f9aa85337452648a79c2d13ff815685

     
  • Ian Pilcher

    Ian Pilcher - 2015-09-06

    Is there some reason that this patch hasn't been integrated? This is basic functionality, and it's been more than 3 years ...

     
  • Justin Maggard

    Justin Maggard - 2015-09-08
    • status: open --> closed-accepted
    • Group: --> Unstable (example)
     
  • Blake Setlow

    Blake Setlow - 2015-12-02

    This patch breaks minidla for me on Mac OS 10.9.2, with the error:
    minissdp.c:264: error: sendto(udp): -1 49 Can't assign requested address
    The line number is approximate because I messed with things for a while before I tried reverting the patch.

     
  • Blake Setlow

    Blake Setlow - 2015-12-02

    I think this patch, applied to HEAD, makes it work again on Mac OS. But I don't know how it will affect other platforms.

    diff --git a/minissdp.c b/minissdp.c
    index 9e1704e..0d8e27b 100644
    --- a/minissdp.c
    +++ b/minissdp.c
    @@ -120,7 +120,7 @@ OpenAndConfSSDPReceiveSocket(void)
    * to receive datagramms send to this multicast address.
    * To specify the local nics we want to use we have to use setsockopt,
    * see AddMulticastMembership(...). */
    - sockname.sin_addr.s_addr = inet_addr(SSDP_MCAST_ADDR);
    + sockname.sin_addr.s_addr = htonl(INADDR_ANY);

        if (bind(s, (struct sockaddr *)&sockname, sizeof(struct sockaddr_in)) < 0)
        {
    
     

Log in to post a comment.