Package: minissdpd
Version: 1.0-2
Severity: critical
Tags: patch

Hi,

Minissdpd will not coexist with other apps that wish to listen to SSDP
multicast traffic.
- minissdpd will refuse to start if another SSDP app is running (i.e.
  already using the UDP port)
- when  minissdpd is running, other apps, which normally start fine and
  peacefully coexist with each other, fail to start.
  (e.g. upnp-router-control and gssdp-device-sniffer)

debian:root ~ 113 # ps ax | grep minissdpd
17975 ?        Ss     0:00 minissdpd -i 0.0.0.0
17990 pts/4    S+     0:00 grep minissdpd
debian:root ~ 114 # upnp-router-control
* Initializing GUI...
* Showing GUI...
* Starting UPnP Resource discovery... 
** ERROR **: \u001b[31m[EE]\u001b[0m gupnp_context_new: Failed to bind 
socketError binding to address: Address already in use (33)
aborting...
Aborted
debian:root ~ 115 # gssdp-device-sniffer 
Error creating the GSSDP client: Failed to bind socketError binding to address: 
Address already in use
debian:root ~ 116 # 

---------

debian:root ~ 234 # upnp-router-control &
[2] 21274
debian:root ~ 235 # * Initializing GUI...
* Showing GUI...
* Starting UPnP Resource discovery... done

debian:root ~ 235 # gssdp-device-sniffer &
[3] 21276
debian:root ~ 236 # minissdpd -d -i 0.0.0.0
minissdpd[21277]: bind(udp): Address already in use
minissdpd[21277]: Cannot open socket for receiving SSDP messages, exiting
debian:root ~ 237 # 


The problem is that minissdpd does not set the SO_REUSEADDR option on the
UDP socket. Other apps (e.g. upnp-router-control and gssdp-device-sniffer) do
set SO_REUSEADDR.

I have attached a patch to fix this.

I hereby allow this patch to be included in, and redistributed with, minidsspd
or any derived software using the same license that minissdpd 1.0-2 (as found
in debian on oct 6, 2011) uses.
If this is not sufficient, please ask, and I'll reformulate to something 
acceptable.

Regards,

Rogier.

Patch:
----------------------------
diff -aur minissdpd-1.0/openssdpsocket.c 
minissdpd-1.0-patch-sharesock/openssdpsocket.c
--- minissdpd-1.0/openssdpsocket.c      2008-10-04 12:53:03.000000000 +0200
+++ minissdpd-1.0-patch-sharesock/openssdpsocket.c      2011-10-06 
13:59:40.000000000 +0200
@@ -42,6 +42,8 @@
                                                         const char * * 
listen_addr)
 {
        int s;
+       int rv;
+       int opt;
        struct sockaddr_in sockname;
        
        if( (s = socket(PF_INET, SOCK_DGRAM, 0)) < 0)
@@ -58,6 +60,15 @@
     sockname.sin_addr.s_addr = htonl(INADDR_ANY);
     /*sockname.sin_addr.s_addr = inet_addr(ifaddr);*/
 
+       opt = 1;
+       rv = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+       if (rv < 0)
+       {
+               syslog(LOG_ERR, "setsockopt(SO_REUSEADDR): %m");
+               close(s);
+               return -1;
+       }
+
     if(bind(s, (struct sockaddr *)&sockname, sizeof(struct sockaddr_in)) < 0)
        {
                syslog(LOG_ERR, "bind(udp): %m");
----------------------------


-- System Information:
Debian Release: wheezy/sid
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'testing')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.38-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages minissdpd depends on:
ii  libc6                         2.13-10    Embedded GNU C Library: Shared lib

minissdpd recommends no packages.

minissdpd suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to