File openslp.discovery.diff of Package openslp

--- slpd/slpd_outgoing.c.orig	2009-12-22 15:23:09.000000000 +0000
+++ slpd/slpd_outgoing.c	2009-12-22 15:47:35.000000000 +0000
@@ -420,6 +420,24 @@ SLPDSocket* SLPDOutgoingConnect(struct i
 }
 
 /*=========================================================================*/
+int SLPDHaveOutgoingConnectedSocket(struct in_addr* addr)
+/* Check if there is an outgoing socket for the specified address          */
+/*                                                                         */
+/* addr (IN) the address of the peer to check                              */
+/*=========================================================================*/
+{
+    SLPDSocket* sock = (SLPDSocket*)G_OutgoingSocketList.head;
+    while ( sock )
+    {
+	if (sock->state >= STREAM_CONNECT_IDLE &&
+	    sock->peeraddr.sin_addr.s_addr == addr->s_addr)
+	    return 1;
+        sock = (SLPDSocket*)sock->listitem.next;    
+    }
+    return 0;
+}
+
+/*=========================================================================*/
 void SLPDOutgoingDatagramWrite(SLPDSocket* sock)
 /* Add a ready to write outgoing datagram socket to the outgoing list.     */
 /* The datagram will be written then sit in the list until it ages out     */
--- slpd/slpd_outgoing.h.orig	2009-12-22 15:43:52.000000000 +0000
+++ slpd/slpd_outgoing.h	2009-12-22 15:45:26.000000000 +0000
@@ -107,6 +107,13 @@ SLPDSocket* SLPDOutgoingConnect(struct i
 /* returns: pointer to socket or null on error                             */
 /*=========================================================================*/
 
+/*=========================================================================*/
+int SLPDHaveOutgoingConnectedSocket(struct in_addr* addr);
+/* Check if there is an outgoing socket for the specified address          */
+/*                                                                         */
+/* addr (IN) the address of the peer to check                              */
+/*=========================================================================*/
+
 
 /*=========================================================================*/
 int SLPDOutgoingInit();
--- slpd/slpd_process.c.orig	2009-12-22 15:01:43.000000000 +0000
+++ slpd/slpd_process.c	2009-12-22 15:43:20.000000000 +0000
@@ -1120,7 +1120,11 @@ int ProcessDAAdvert(SLPMessage message,
     if(G_SlpdProperty.DAActiveDiscoveryInterval == 0 &&
        message->header.xid != 0)
     {
-        goto RESPOND;
+	/* do not ignore replys of our DiscoveryRequests made for
+         * static and dhcp configured DAs. For now we check this by
+         * testing if the sockaddr is on the outgoing socket list */
+	if (!SLPDHaveOutgoingConnectedSocket(&message->peer.sin_addr))
+	    goto RESPOND;
     } 
 
     /*-------------------------------*/
openSUSE Build Service is sponsored by