From: paulr Date: Thu, 22 Sep 2011 07:14:44 +0000 (+1000) Subject: config stuff X-Git-Url: http://git.pjr.cc/?a=commitdiff_plain;h=fa4d5e8e3250b981ee563f21df08c729dd3d4c57;p=CBFWR.git config stuff --- diff --git a/libcbfwr/comms.php b/libcbfwr/comms.php index b0c4f04..7f89650 100644 --- a/libcbfwr/comms.php +++ b/libcbfwr/comms.php @@ -37,6 +37,13 @@ class Comms { sem_release($this->semres); } + function deleteConfig($type) + { + global $MESSAGE_KEY, $LOCKING_KEY, $STORE_KEY, $CONF_STORE_SIZE; + $shm_space = shm_attach($STORE_KEY, $CONF_STORE_SIZE); + + shm_remove_var($shm_space, $type); + } // type = 0 for the fs config // type = 1 for the boot hardware config diff --git a/libcbfwr/config.php b/libcbfwr/config.php index 3c7a54f..3720d6a 100644 --- a/libcbfwr/config.php +++ b/libcbfwr/config.php @@ -63,6 +63,7 @@ class Config { } fclose($fp); } + if(file_exists("/sys/class/net/$fname/mtu")) $this->config["hardware"]["netdev"][$fname]["mtu"] = file_get_contents("/sys/class/net/$fname/mtu"); if(file_exists("/sys/class/net/$fname/address")) $this->config["hardware"]["netdev"][$fname]["hwaddress"] = file_get_contents("/sys/class/net/$fname/address"); if(file_exists("/sys/class/net/$fname/bonding")) $this->config["hardware"]["netdev"][$fname]["bonding"] = true; if(file_exists("/sys/class/net/$fname/bridge")) $this->config["hardware"]["netdev"][$fname]["bridge"] = true; diff --git a/libcbfwr/fwui.php b/libcbfwr/fwui.php index decadf2..5d78f38 100644 --- a/libcbfwr/fwui.php +++ b/libcbfwr/fwui.php @@ -122,6 +122,9 @@ function CBFWInterfacesPageDisplay() // hw address if(isset($val["hwaddress"])) $table[$key]["hwaddress"] = $val["hwaddress"]; + + // current mtu + if(isset($val["mtu"])) $table[$key]["mtu"] = $val["mtu"]; } foreach($config["hardware"]["netdev"] as $key=>$val) { diff --git a/libcbfwr/web.php b/libcbfwr/web.php index 87e7bf4..562d1db 100644 --- a/libcbfwr/web.php +++ b/libcbfwr/web.php @@ -83,13 +83,17 @@ function CBFBuildHomePage($urls) { echo "Must remember this, gotta rules could apply to multiple zones not just one
"; echo "i.e.: add rule reject from object/host/hostname to address6/2003::123 in zones Zone/zonename/rulenum Zone/zonename/rulenum"; - $conf = new Config(); - $conf->loadConfig(); + + $comms = new Comms(); echo "
";
-	print_r($conf->getConfig());
+	print_r($comms->getConfig(0));
+	echo "\n\n\n";
+	print_r($comms->getConfig(1));
+	echo "\n\n\n";
+	print_r($comms->getConfig(2));
 	echo "\n\n\n";
-	print_r($conf->getBootConfig());
+	print_r($comms->getConfig(3));
 	echo "
"; } diff --git a/unittests/deleteshm.php b/unittests/deleteshm.php new file mode 100644 index 0000000..d773aa4 --- /dev/null +++ b/unittests/deleteshm.php @@ -0,0 +1,24 @@ +deleteConfig($i); + +?> \ No newline at end of file