summaryrefslogtreecommitdiffstats
path: root/usr/local/www/guiconfig.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-06-22 01:17:28 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-06-22 01:17:28 +0000
commit9a4cb6b701532b5578842ba466eb6676cb7e2367 (patch)
tree5c613ad9e4751481fe64ed0a25e36f3017065cdb /usr/local/www/guiconfig.inc
parentc40fef82b4b9b078cdaeaf77cda0cdb7f76778ac (diff)
downloadpfsense-9a4cb6b701532b5578842ba466eb6676cb7e2367.zip
pfsense-9a4cb6b701532b5578842ba466eb6676cb7e2367.tar.gz
Restore guiconfig.inc and remove comonly used functions.
Somehow I forgot we already cleaned up this mess.
Diffstat (limited to 'usr/local/www/guiconfig.inc')
-rwxr-xr-xusr/local/www/guiconfig.inc82
1 files changed, 72 insertions, 10 deletions
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index e43dff1..8fa730b 100755
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -389,16 +389,6 @@ function ipsec_mobilekey_sort() {
usort($config['ipsec']['mobilekey'], "mobilekeycmp");
}
-function ipsec_ca_sort() {
- global $g, $config;
-
- function ipseccacmp($a, $b) {
- return strcmp($a['ident'], $b['ident']);
- }
-
- usort($config['ipsec']['cacert'], "ipseccacmp");
-}
-
function proxyarp_sort() {
global $g, $config;
@@ -512,4 +502,76 @@ function update_if_changed($varname, & $orig, $new) {
return false;
}
+function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendport) {
+
+ if (isset($adr['any']))
+ $padr = "any";
+ else if ($adr['network'])
+ $padr = $adr['network'];
+ else if ($adr['address']) {
+ list($padr, $pmask) = explode("/", $adr['address']);
+ if (!$pmask)
+ $pmask = 32;
+ }
+
+ if (isset($adr['not']))
+ $pnot = 1;
+ else
+ $pnot = 0;
+
+ if ($adr['port']) {
+ list($pbeginport, $pendport) = explode("-", $adr['port']);
+ if (!$pendport)
+ $pendport = $pbeginport;
+ } else {
+ if(alias_expand($pbeginport) <> "" || alias_expand($pendport) <> "") {
+ /* Item is a port alias */
+ } else {
+ $pbeginport = "any";
+ $pendport = "any";
+ }
+ }
+}
+
+
+function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $pendport=0) {
+
+ $adr = array();
+
+ if ($padr == "any")
+ $adr['any'] = true;
+ else if (is_specialnet($padr))
+ $adr['network'] = $padr;
+ else {
+ $adr['address'] = $padr;
+ if ($pmask != 32)
+ $adr['address'] .= "/" . $pmask;
+ }
+
+ if ($pnot)
+ $adr['not'] = true;
+ else
+ unset($addr['not']);
+
+ if (($pbeginport != 0) && ($pbeginport != "any")) {
+ if ($pbeginport != $pendport)
+ $adr['port'] = $pbeginport . "-" . $pendport;
+ else
+ $adr['port'] = $pbeginport;
+ }
+
+ if(alias_expand($pbeginport)) {
+ $adr['port'] = $pbeginport;
+ }
+}
+
+function is_specialnet($net) {
+ global $specialsrcdst;
+
+ if (in_array($net, $specialsrcdst) || strstr($net, "opt"))
+ return true;
+ else
+ return false;
+}
+
?> \ No newline at end of file
OpenPOWER on IntegriCloud