X-Git-Url: http://git.pjr.cc/?p=CBFWR.git;a=blobdiff_plain;f=bin%2Fcbfwrd.php;h=4abcbbde32e31c633cdd494b1093141c8d7e3be8;hp=b8360e59edff9d8079bc2bf1f1d2981ae09f24ca;hb=c184472f1c4206a3bcd76ff8e9d27dc2eb1a4c4c;hpb=0f5458e4a9c18595f7d9501880011369e4e65942 diff --git a/bin/cbfwrd.php b/bin/cbfwrd.php index b8360e5..4abcbbd 100644 --- a/bin/cbfwrd.php +++ b/bin/cbfwrd.php @@ -19,14 +19,16 @@ glcas_pluginLoader(); error_log("CBFWRD starting"); +$comms = new Comms; -$config = new Config(); -global $config; if(isset($argv[1])) { + // we get called here on boot. if($argv[1] == "boot") { - // we get called here on boot. - $config->bootHardware(); + $config = new Config(false); + $config->findHardware(); + $conf = $config->getConfig(); + $comms->putConfig($conf, 1); exit(0); } } @@ -37,10 +39,18 @@ $cont = true; // setup our sem/shm stuff // do the initial stuff -$comms = new Comms; -$config->loadConfig(); +$config = new Config(true); +$config->loadConfigFile(); $rawconf = $config->getConfig(); $comms->putConfig($rawconf); +$config->applyConfig(); +$runconf["status"] = "nochange"; +$comms->putConfig($runconf, 2); +$res = $comms->getConfig(3); +if($res === false) { + $comms->putConfig($runconf, 3); +} + while($cont) { $msg = $comms->waitForMessage(); @@ -59,30 +69,9 @@ function cbfwd_commandProcessor($command) $comms->lockConfigs(); switch($cmds[0]) { - case "goodone": - break; - - // interface change requests - case "interface": - $int = $cmds[1]; - if($cmds[2] == "changename") { - $rawconf = $comms->getConfig(); - if(isset($rawconf["interface"]["$int"]["name"])) $rawconf["interface"]["$int"]["name"] = $cmds[3]; - $comms->putConfig($rawconf); - } + case "applyclientconfig": break; - case "zone": - $cmd = $cmds[1]; - switch($cmd) { - case "add": - $zonename = $cmds[2]; - $rawconf = $comms->getConfig(); - $rawconf["zone"][$zonename]["name"] = 1; - $comms->putConfig($rawconf); - break; - - } } $comms->unlockConfigs(); }