]> git.vomp.tv Git - vompserver.git/commitdiff
Fix for bootp using wrong config dir
authorChris Tallon <chris@vomp.tv>
Wed, 2 Apr 2008 19:08:24 +0000 (19:08 +0000)
committerChris Tallon <chris@vomp.tv>
Wed, 2 Apr 2008 19:08:24 +0000 (19:08 +0000)
bootpd.c
bootpd.h
mvpserver.c

index a5861320d4381156e7d5340703942427b33a07a8..801c5ac1a0c05395a8e18e9c1dc94c073b9bdfaf 100644 (file)
--- a/bootpd.c
+++ b/bootpd.c
@@ -41,11 +41,13 @@ int Bootpd::shutdown()
   return 1;
 }
 
-int Bootpd::run()
+int Bootpd::run(const char* tconfigDir)
 {
   if (threadIsActive()) return 1;
   log->log("BOOTPD", Log::DEBUG, "Starting bootpd");
 
+  configDir = tconfigDir;
+
   if (!ds.init(16867))
   {
     log->log("BOOTPD", Log::DEBUG, "DSock init error");
@@ -96,16 +98,14 @@ void Bootpd::processRequest(UCHAR* data, int length)
 
   if (data[0] != 1) return;  // Check it's a request
 
-
   // Open a config file for the given MAC
 
 #ifndef VOMPSTANDALONE
-  const char* configDir = cPlugin::ConfigDirectory();
+  const char* useConfigDir = configDir;
 #else
-  const char* configDir = ".";
+  const char* useConfigDir = ".";
 #endif
-//  char* configDir = "/opt/dvb/vdr-config-1.3/plugins";
-  if (!configDir)
+  if (!useConfigDir)
   {
     log->log("BOOTPD", Log::ERR, "No config dir!");
     return;
@@ -113,7 +113,7 @@ void Bootpd::processRequest(UCHAR* data, int length)
 
   Config config;
   char configFileName[PATH_MAX];
-  snprintf(configFileName, PATH_MAX, "%s/vomp-%02X-%02X-%02X-%02X-%02X-%02X.conf", configDir, data[28], data[29], data[30], data[31], data[32], data[33]);
+  snprintf(configFileName, PATH_MAX, "%s/vomp-%02X-%02X-%02X-%02X-%02X-%02X.conf", useConfigDir, data[28], data[29], data[30], data[31], data[32], data[33]);
   if (config.init(configFileName))
   {
     log->log("BOOTPD", Log::DEBUG, "Opened config file: %s", configFileName);
index 156d633a312b1970bd44a567b966de0256d51e3f..a56488121fd1863da3eddf02cd3f31d6f1d7c907 100644 (file)
--- a/bootpd.h
+++ b/bootpd.h
@@ -40,7 +40,7 @@ class Bootpd : public Thread
     Bootpd();
     virtual ~Bootpd();
 
-    int run();
+    int run(const char* tconfigDir);
     int shutdown();
 
   private:
@@ -50,6 +50,7 @@ class Bootpd : public Thread
 
     DatagramSocket ds;
     Log* log;
+    const char* configDir;
 };
 
 #endif
index d6a888b568d6e71bdec9f15d4ff86bf700aa7ad1..4ce198fcd464579afbfe1cb05b3ebb0cd8c8044d 100644 (file)
@@ -139,7 +139,7 @@ int MVPServer::run(char* tconfigDir)
 
   if (bootpEnabled)
   {
-    if (!bootpd.run())
+    if (!bootpd.run(configDir))
     {
       log.log("Main", Log::CRIT, "Could not start Bootpd");
       stop();