File openslp.tcplocal.diff of Package openslp.3206

--- ./libslp/libslp_findattrs.c.orig	2014-02-20 10:41:46.070828839 +0000
+++ ./libslp/libslp_findattrs.c	2014-02-20 10:42:44.604828735 +0000
@@ -220,7 +220,7 @@ static SLPError ProcessAttrRqst(SLPHandl
                curpos - buf, ProcessAttrRplyCallback, handle, isV1);
          break;
       }
-      if (SLPNetIsIPV4())
+      if (SLPNetIsIPV4() && handle->params.findattrs.scopelistlen && memchr(handle->params.findattrs.scopelist, ',', handle->params.findattrs.scopelistlen))
       {
          if (KnownDASpanningListFromCache(handle,
                                           (int)handle->params.findattrs.scopelistlen,
--- ./libslp/libslp_findsrvs.c.orig	2014-02-20 10:41:51.558828829 +0000
+++ ./libslp/libslp_findsrvs.c	2014-02-20 10:43:06.068828697 +0000
@@ -352,7 +352,7 @@ static SLPError ProcessSrvRqst(SLPHandle
                curpos - buf, ProcessSrvRplyCallback, handle, false);
          break;
       }
-      if (SLPNetIsIPV4())
+      if (SLPNetIsIPV4() && handle->params.findsrvs.scopelistlen && memchr(handle->params.findsrvs.scopelist, ',', handle->params.findsrvs.scopelistlen))
       {
          if (KnownDASpanningListFromCache(handle,
                                           (int)handle->params.findsrvs.scopelistlen,
--- ./libslp/libslp_findsrvtypes.c.orig	2014-02-20 10:41:55.765828821 +0000
+++ ./libslp/libslp_findsrvtypes.c	2014-02-20 10:44:10.708828583 +0000
@@ -238,11 +238,11 @@ static SLPError ProcessSrvTypeRqst(SLPHa
                curpos - buf, ProcessSrvTypeRplyCallback, handle, false);
          break;
       }
-      if (SLPNetIsIPV4())
+      if (SLPNetIsIPV4() && handle->params.findsrvtypes.scopelistlen && memchr(handle->params.findsrvtypes.scopelist, ',', handle->params.findsrvtypes.scopelistlen))
       {
          if (KnownDASpanningListFromCache(handle,
-                                          (int)handle->params.findsrvs.scopelistlen,
-                                          handle->params.findsrvs.scopelist,
+                                          (int)handle->params.findsrvtypes.scopelistlen,
+                                          handle->params.findsrvtypes.scopelist,
                                           &destaddrs) > 0)
          {
             serr = NetworkMultiUcastRqstRply(destaddrs,
--- ./libslp/libslp_knownda.c.orig	2012-12-12 17:38:52.000000000 +0000
+++ ./libslp/libslp_knownda.c	2014-02-20 10:40:19.448828992 +0000
@@ -793,6 +793,8 @@ sockfd_t KnownDAConnect(SLPHandleInfo *
       const char * scopelist, void * peeraddr)
 {
    sockfd_t sock = SLP_INVALID_SOCKET;
+   int maxwait = SLPPropertyAsInteger("net.slp.DADiscoveryMaximumWait");
+   struct timeval timeout;
    size_t spistrlen = 0;
    char * spistr = 0;
 
@@ -815,15 +817,11 @@ sockfd_t KnownDAConnect(SLPHandleInfo *
             || (addr->sa_family == AF_INET && SLPNetIsIPV4()))
       {
          SLPNetSetPort(peeraddr, (uint16_t)SLPPropertyAsInteger("net.slp.port"));
-         sock = SLPNetworkCreateDatagram(addr->sa_family);
-         /* Now test if the DA will actually respond */
+         timeout.tv_usec = (maxwait % 1000) * 1000;
+         timeout.tv_sec = maxwait / 1000;
+         sock = SLPNetworkConnectStream(addr, &timeout);
          if (sock != SLP_INVALID_SOCKET)
-         {
-            if (KnownDADiscoveryRqstRply(sock, peeraddr, scopelistlen, scopelist, handle) > 0)
-               break;
-
-            closesocket(sock);
-         }
+            break;
       }
       KnownDABadDA(peeraddr);
    }
--- ./libslp/libslp_network.c.orig	2014-02-20 10:40:15.262828999 +0000
+++ ./libslp/libslp_network.c	2014-02-20 10:40:19.449828992 +0000
@@ -370,6 +370,8 @@ static int NetworkGetMcastAddrs(const ch
 sockfd_t NetworkConnectToSlpd(void * peeraddr)
 {
    sockfd_t sock = SLP_INVALID_SOCKET;
+   int maxwait = SLPPropertyAsInteger("net.slp.DADiscoveryMaximumWait");
+   struct timeval timeout;
 
    /*Note that these don't actually test the connection to slpd.
      They don't have to, since all code that calls this function eventually
@@ -378,14 +380,22 @@ sockfd_t NetworkConnectToSlpd(void * pee
    if (SLPNetIsIPV6())
       if (!SLPNetSetAddr(peeraddr, AF_INET6, (uint16_t)SLPPropertyAsInteger("net.slp.port"),
             &slp_in6addr_loopback))
-         sock = SLPNetworkCreateDatagram(AF_INET6);
+      {
+         timeout.tv_sec = maxwait / 1000;
+         timeout.tv_usec = (maxwait % 1000) * 1000;
+         sock = SLPNetworkConnectStream(peeraddr, &timeout);
+      }
 
    if (sock == SLP_INVALID_SOCKET && SLPNetIsIPV4())
    {
       int tempAddr = INADDR_LOOPBACK;
       if (SLPNetSetAddr(peeraddr, AF_INET,
             (uint16_t)SLPPropertyAsInteger("net.slp.port"), &tempAddr) == 0)
-         sock = SLPNetworkCreateDatagram(AF_INET);
+      {
+         timeout.tv_sec = maxwait / 1000;
+         timeout.tv_usec = (maxwait % 1000) * 1000;
+         sock = SLPNetworkConnectStream(peeraddr, &timeout);
+      }
    }
    return sock;
 }