Dear all,

Does anyone have any objections for the patch below? It allows for 
disabling DHCP for scope and/or DA discovery on networks that don't use 
this mechanism.

By the way, while I was working on this, I noticed a few things:

* The DHCP mechanism doesn't work when there's already a dhcp client 
process running (at least on a Linux system). dhcpCreateBCSkt() in 
openslp/common/slp_dhcp.c can't bind to the 'IPPORT_BOOTPC' port in that 
case, without any notifications.
* The DHCP mechanism should handle all used network interfaces 
separately. Now the request is sent from 'INADDR_ANY', causing only one 
(OS chosen) interface to be used.
* I wondered why KnownDARefreshCache() in 
openslp/libslp/libslp_knownda.c stops as soon as any of the discover 
mechanisms does actually find anything. The other mechanisms are not 
called then anymore.

BR,
     Roel


Index: openslp/libslp/libslp_knownda.c
===================================================================
--- openslp/libslp/libslp_knownda.c     (revision 1650)
+++ openslp/libslp/libslp_knownda.c     (working copy)
@@ -677,7 +677,8 @@
          /* discover DAs */
          if(KnownDADiscoverFromIPC(handle) == 0)
              if(KnownDADiscoverFromProperties(scopelistlen, scopelist, handle) 
== 0)
-                if(KnownDADiscoverFromDHCP(handle) == 0)
+                if (! SLPPropertyAsBoolean(SLPGetProperty("net.slp.useDHCP"))
+                            || KnownDADiscoverFromDHCP(handle) == 0)
                      KnownDADiscoverFromMulticast(scopelistlen, scopelist, 
handle);
          return SLP_TRUE;
      }
@@ -889,7 +890,8 @@
        /* Discover all DAs. */
        if (KnownDADiscoverFromIPC(handle) == 0)
        {
-         KnownDADiscoverFromDHCP(handle);
+         if (SLPPropertyAsBoolean(SLPGetProperty("net.slp.useDHCP")))
+            KnownDADiscoverFromDHCP(handle);
           KnownDADiscoverFromProperties(0,"", handle);
           KnownDADiscoverFromMulticast(0,"", handle);
        }
@@ -976,7 +978,8 @@
     /* Discover all DAs. */
     if (KnownDADiscoverFromIPC(handle) == 0)
     {
-      KnownDADiscoverFromDHCP(handle);
+      if (SLPPropertyAsBoolean(SLPGetProperty("net.slp.useDHCP")))
+         KnownDADiscoverFromDHCP(handle);
        KnownDADiscoverFromProperties(0,"", handle);
        KnownDADiscoverFromMulticast(0,"", handle);
     }
Index: openslp/common/slp_property.c
===================================================================
--- openslp/common/slp_property.c       (revision 1650)
+++ openslp/common/slp_property.c       (working copy)
@@ -165,6 +165,7 @@
        {"net.slp.checkSourceAddr", "true", 0},
        {"net.slp.broadcastAddr", "255.255.255.255", 0},
        {"net.slp.port", "427", 0},
+      {"net.slp.useDHCP", "true", 0},

     /* Additional properties that are specific to IPv6 */
        {"net.slp.useIPv6", "false", 0},
Index: openslp/slpd/slpd_property.c
===================================================================
--- openslp/slpd/slpd_property.c        (revision 1650)
+++ openslp/slpd/slpd_property.c        (working copy)
@@ -139,6 +139,7 @@
        G_SlpdProperty.DAHeartBeat = SLPD_AGE_INTERVAL;

     G_SlpdProperty.port = (uint16_t)SLPPropertyAsInteger("net.slp.port");
+   G_SlpdProperty.useDHCP = SLPPropertyAsBoolean("net.slp.useDHCP");

     /* set the net.slp.interfaces property */
     if (SLPNetIsIPV4()&&  SLPNetIsIPV6())
Index: openslp/slpd/slpd_property.h
===================================================================
--- openslp/slpd/slpd_property.h        (revision 1650)
+++ openslp/slpd/slpd_property.h        (working copy)
@@ -113,6 +113,7 @@
     int DAHeartBeat;
     int appendLog;
     int MTU;
+   int useDHCP;
  } SLPDProperty;

  extern SLPDProperty G_SlpdProperty;
Index: openslp/slpd/slpd_knownda.c
===================================================================
--- openslp/slpd/slpd_knownda.c (revision 1650)
+++ openslp/slpd/slpd_knownda.c (working copy)
@@ -685,7 +685,8 @@
     /*-----------------------------------------------------------------*/
     /* Discover DHCP DA's and add them to the active discovery list.    */
     /*-----------------------------------------------------------------*/
-   SLPDKnownDAFromDHCP();
+   if (G_SlpdProperty.useDHCP)
+      SLPDKnownDAFromDHCP();

     /*------------------------------------------------------------------*/
     /* Generate the list of our URLs                                    */
Index: openslp/etc/slp.conf
===================================================================
--- openslp/etc/slp.conf        (revision 1650)
+++ openslp/etc/slp.conf        (working copy)
@@ -168,6 +168,10 @@
  # listening port will break compliance with RFC2608. (Default is 427).
  ;net.slp.port = 427

+# A boolean indicating whether DHCP should be used for DA discovery and/or
+# scope discovery. (Default setting is true).
+;net.slp.useDHCP = true
+
  #----------------------------------------------------------------------------
  # Security
  #----------------------------------------------------------------------------


------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Openslp-devel mailing list
Openslp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openslp-devel

Reply via email to