Commit 0142ae76 authored by Franco Fichtner's avatar Franco Fichtner

firewall: merge aliases from master

parent 023e2d64
......@@ -92,13 +92,15 @@ function legacy_list_aliasses($type) {
$result = array();
if (isset($config['aliases']['alias'])) {
foreach ($config['aliases']['alias'] as $alias) {
if ($type == "port") {
if (preg_match("/port/i", $alias['type'])) {
$result[] = $alias;
}
} else {
if (!preg_match("/port/i", $alias['type'])){
$result[] = $alias;
if (!empty($alias['address'])) {
if ($type == "port") {
if (preg_match("/port/i", $alias['type'])) {
$result[] = $alias;
}
} else {
if (!preg_match("/port/i", $alias['type'])){
$result[] = $alias;
}
}
}
}
......
......@@ -306,14 +306,6 @@ function ip_range_to_subnet_array($startip, $endip) {
return $rangesubnets;
}
function is_iprange($range) {
if (substr_count($range, '-') != 1) {
return false;
}
list($ip1, $ip2) = explode ('-', $range);
return (is_ipaddr($ip1) && is_ipaddr($ip2));
}
/* returns true if $ipaddr is a valid dotted IPv4 address or a IPv6 */
function is_ipaddr($ipaddr) {
if(is_ipaddrv4($ipaddr)) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -330,48 +330,6 @@ function pprint_port($port) {
return $pport;
}
function firewall_check_for_advanced_options(&$item) {
$item_set = "";
if($item['os'])
$item_set .= "os {$item['os']} ";
if($item['dscp'])
$item_set .= "dscp {$item['dscp']} ";
if($item['max'])
$item_set .= "max {$item['max']} ";
if($item['max-src-nodes'])
$item_set .= "max-src-nodes {$item['max-src-nodes']} ";
if($item['max-src-conn'])
$item_set .= "max-src-conn {$item['max-src-conn']} ";
if($item['max-src-states'])
$item_set .= "max-src-states {$item['max-src-states']} ";
if(isset($item['nopfsync']))
$item_set .= "nopfsync ";
if($item['statetype'] != "keep state" && $item['statetype'] != "")
$item_set .= "statetype {$item['statetype']} ";
if($item['statetimeout'])
$item_set .= "statetimeout {$item['statetimeout']} ";
if(isset($item['nosync']))
$item_set .= "no XMLRPC Sync ";
if($item['max-src-conn-rate'])
$item_set .= "max-src-conn-rate {$item['max-src-conn-rate']} ";
if($item['max-src-conn-rates'])
$item_set .= "max-src-conn-rates {$item['max-src-conn-rates']} ";
if($item['gateway'])
$item_set .= "gateway {$item['gateway']} ";
if($item['tag'])
$item_set .= "tag {$item['tag']} ";
if($item['tagged'])
$item_set .= "tagged {$item['tagged']} ";
if(isset($item['allowopts']))
$item_set .= "allowopts ";
if(isset($item['disablereplyto']))
$item_set .= "disable reply-to ";
if($item['tcpflags_any'] || $item['tcpflags1'] || $item['tcpflags2'])
$item_set .= "tcpflags set";
return $item_set;
}
function gentitle($title) {
$navlevelsep = ": "; /* navigation level separator string */
if(!is_array($title))
......@@ -475,16 +433,19 @@ function update_if_changed($varname, & $orig, $new) {
function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendport) {
if (isset($adr['any']))
$padr = "any";
else if ($adr['network'])
else if (isset($adr['network']))
$padr = $adr['network'];
else if ($adr['address']) {
list($padr, $pmask) = explode("/", $adr['address']);
if (!$pmask) {
else if (isset($adr['address'])) {
if (strpos($adr['address'], '/') !== false) {
list($padr, $pmask) = explode("/", $adr['address']);
} else {
$padr = $adr['address'];
if (is_ipaddrv6($padr))
$pmask = 128;
else
$pmask = 32;
}
}
if (isset($adr['not']))
......@@ -492,10 +453,13 @@ function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendp
else
$pnot = 0;
if ($adr['port']) {
list($pbeginport, $pendport) = explode("-", $adr['port']);
if (!$pendport)
if (isset($adr['port'])) {
if (strpos($adr['port'], '-') !== false) {
list($pbeginport, $pendport) = explode("-", $adr['port']);
} else {
$pbeginport = $adr['port'];
$pendport = $pbeginport;
}
} else if (!is_alias($pbeginport) && !is_alias($pendport)) {
$pbeginport = "any";
$pendport = "any";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment