From 6a5de79951743c8685cbb3ddfca2b4b95ad40882 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 2 Apr 2008 19:08:24 +0000 Subject: [PATCH] Fix for bootp using wrong config dir --- bootpd.c | 14 +++++++------- bootpd.h | 3 ++- mvpserver.c | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bootpd.c b/bootpd.c index a586132..801c5ac 100644 --- 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); diff --git a/bootpd.h b/bootpd.h index 156d633..a564881 100644 --- 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 diff --git a/mvpserver.c b/mvpserver.c index d6a888b..4ce198f 100644 --- a/mvpserver.c +++ b/mvpserver.c @@ -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(); -- 2.39.5