}
+function CBFWRoutingPage($urls)
+{
+ if(isset($urls[1])) {
+ switch($urls[1]) {
+ case "edit":
+ CBFWpageBuilder(null, "CBFWRoutingPageEdit", null, null, $urls[2]);
+ break;
+ case "change":
+ CBFWRoutingChange();
+ break;
+ default:
+ CBFWpageBuilder(null, "CBFWRoutingPageDisplay");
+ }
+ } else {
+ error_log("main interface page");
+ CBFWpageBuilder(null, "CBFWRoutingPageDisplay");
+ }
+
+}
+
+function CBFWRoutingPageDisplay()
+{
+ echo "<h2>Routing</h2>";
+}
+
function CBFWInterfacesPage($urls)
{
if(isset($urls[1])) {
global $BASE_URL, $MENU_ITEMS;
$comms = new Comms();
- $comms->sendMessage("interface eth0 changename poof");
header("Location: $BASE_URL/interfaces");
}
global $BASE_URL, $MENU_ITEMS;
$interface = $urls;
+ $comms = new Comms();
+
+ $config = getWebUserConfig();
+ $boot_config = $comms->getConfig(1);
+
+ if(isset($config["interface"]["dev"]["$interface"]["name"])) $name = $config["interface"]["dev"]["$interface"]["name"];
+ else $name = "";
+
+ $extra2 = "";
+ if(file_exists("/sys/class/net/$interface/address")) {
+ $extra2 = trim(file_get_contents("/sys/class/net/$interface/address"));
+ }
+
+ $extra = "";
+ if(isset($boot_config["hardware"]["netdev"]["$interface"]["hwaddress"])) {
+ $hwaddr = $boot_config["hardware"]["netdev"]["$interface"]["hwaddress"];
+ $extra = " <i>Original address: $hwaddr</i>";
+ if($hwaddr != $extra2 && $extra2 != "") {
+ $extra .= " <i>Current Address: $hwaddr</i>";
+ }
+ }
+ if(isset($config["interface"]["dev"]["$interface"]["hwaddress"])) $hwaddr = $config["interface"]["dev"]["$interface"]["hwaddress"];
+
+ if(isset($config["interface"]["dev"]["$interface"]["zone"])) $zone = $config["interface"]["dev"]["$interface"]["zone"];
+
+ if(isset($config["interface"]["dev"]["$interface"]["address4"])) $ip4 = $config["interface"]["dev"]["$interface"]["address4"];
+
+ if(isset($config["interface"]["dev"]["$interface"]["address6"])) $ip6 = $config["interface"]["dev"]["$interface"]["address6"];
+
+ if(isset($boot_config["hardware"]["netdev"]["$interface"]["speed"])) $speed = $boot_config["hardware"]["netdev"]["$interface"]["speed"];
+ if(isset($boot_config["hardware"]["netdev"]["$interface"]["duplex"])) $duplex = $boot_config["hardware"]["netdev"]["$interface"]["duplex"];
+ if(isset($config["interface"]["dev"]["$interface"]["speed"])) $speed = $config["interface"]["dev"]["$interface"]["speed"];
+ if(isset($config["interface"]["dev"]["$interface"]["duplex"])) $duplex = $config["interface"]["dev"]["$interface"]["duplex"];
+
echo "<h3>Edit Interface $interface</h3><br>";
echo "<form method=\"post\" action=\"$BASE_URL/interfaces/change/$interface\">";
echo "<table>";
- echo "<tr><td>Name</td><td><input type=\"text\" name=\"name\"></td></tr>";
- echo "<tr><td>HW Address</td><td><input type=\"text\" name=\"hwaddr\"></td></tr>";
- echo "<tr><td>Zone</td><td><input type=\"text\" name=\"zone\"></td></tr>";
- echo "<tr><td>IPv4 Address</td><td><input type=\"text\" name=\"ipv4addr\"></td></tr>";
- echo "<tr><td>IPv6 Address</td><td><input type=\"text\" name=\"ipv6addr\"></td></tr>";
- echo "<tr><td>Speed</td><td><input type=\"text\" name=\"speed\"></td></tr>";
- echo "<tr><td>Duplex</td><td><input type=\"text\" name=\"duplex\"></td></tr>";
+ echo "<tr><td>Name</td><td><input type=\"text\" name=\"name\" value=\"$name\"></td></tr>";
+ echo "<tr><td>HW Address</td><td><input type=\"text\" name=\"hwaddr\" value=\"$hwaddr\">$extra</td></tr>";
+ echo "<tr><td>Zone</td><td><input type=\"text\" name=\"zone\" value=\"$zone\"></td></tr>";
+ echo "<tr><td>IPv4 Address</td><td><input type=\"text\" name=\"ipv4addr\" value=\"$ip4\"></td></tr>";
+ echo "<tr><td>IPv6 Address</td><td><input type=\"text\" name=\"ipv6addr\" value=\"$ip6\"></td></tr>";
+ echo "<tr><td>Speed</td><td><select name=\"duplex\"><option value=\"auto\">Auto</option><option value=\"10\">10</option>";
+ echo "<option value=\"100\">100</option><option value=\"1000\">1000</option><option value=\"10000\">10000</option></select></td></tr>";
+ echo "<tr><td>Duplex</td><td><select name=\"duplex\"><option value=\"auto\">Auto</option><option value=\"full\">Full</option><option value=\"half\">Half</option></select></td></tr>";
echo "</table>";
echo "<input type=\"submit\" name=\"Change\" value=\"Change\"><br>";
//echo "<a href=\"$BASE_URL/interfaces/\">Back</a>";
$MENU_ITEMS["20_Objects"]["name"] = "Objects";
$MENU_ITEMS["30_Rules"]["link"] = "$BASE_URL/rules";
$MENU_ITEMS["30_Rules"]["name"] = "Rules";
+$MENU_ITEMS["15_Routes"]["link"] = "$BASE_URL/routing";
+$MENU_ITEMS["15_Routes"]["name"] = "Routing";
$MENU_ITEMS["10_Interfaces"]["link"] = "$BASE_URL/interfaces";
$MENU_ITEMS["10_Interfaces"]["name"] = "Interfaces";
$MENU_ITEMS["05_Admin"]["link"] = "$BASE_URL/admin";
case "objects":
CBFWObjectsPage($url_s);
break;
+ case "routing":
+ CBFWRoutingPage($url_s);
+ break;
case "rules":
$bodyFunction = "CBFWRulesPage";
break;
print_r($comms->getConfig(2));
echo "\n\n\n";
print_r($comms->getConfig(3));
+ echo "\n\n\n";
+ print_r($comms->getConfig(4));
+ echo "\n\n\n";
+ print_r($comms->getConfig(5));
echo "</pre>";
}