src: style sweep

This commit is contained in:
Franco Fichtner 2019-03-16 15:15:24 +01:00
parent 429efafd8c
commit 4a46f7a09f
6 changed files with 26 additions and 21 deletions

View File

@ -1472,11 +1472,11 @@ EOD;
for ($idx = 0; $idx < count($leftsubnet_spec); ++$idx) {
if (count($leftsubnet_spec) == 1) {
$tmpconf = str_replace('<<connectionId>>', "{$ph1ent['ikeid']}", $connEntry);
$tmpconf .= sprintf("\treqid = %d\n", (int)$ph1ent['ikeid'] * 1000 );
$tmpconf .= sprintf("\treqid = %d\n", (int)$ph1ent['ikeid'] * 1000);
} else {
// suffix connection with sequence number
$tmpconf = str_replace('<<connectionId>>', sprintf('%s-%03d', $ph1ent['ikeid'], $idx), $connEntry);
$tmpconf .= sprintf("\treqid = %d\n", (int)$ph1ent['ikeid'] * 1000 + $idx );
$tmpconf .= sprintf("\treqid = %d\n", (int)$ph1ent['ikeid'] * 1000 + $idx);
}
$tmpconf .= "\trightsubnet = " . $rightsubnet_spec[$idx]. "\n";
$tmpconf .= "\tleftsubnet = " . $leftsubnet_spec[$idx] . "\n";
@ -1500,7 +1500,7 @@ EOD;
// name from the first configured tunnel ($idx == 0):
$conn_suffix = $idx ? sprintf('-%03d', $idx) : '';
$tmpconf[] = "conn con{$ph1ent['ikeid']}{$conn_suffix}";
$tmpconf[] = sprintf("\treqid = %d\n", (int)$ph1ent['ikeid'] * 1000 + $idx );
$tmpconf[] = sprintf("\treqid = %d\n", (int)$ph1ent['ikeid'] * 1000 + $idx);
if (!empty($rightsubnet_spec[$idx])) {
$tmpconf[] = "\trightsubnet = {$rightsubnet_spec[$idx]}";
}
@ -1519,7 +1519,7 @@ EOD;
}
} else {
$tmpconf = str_replace('<<connectionId>>', "{$ph1ent['ikeid']}", $connEntry);
$tmpconf .= sprintf("\treqid = %d\n", (int)$ph1ent['ikeid'] * 1000 );
$tmpconf .= sprintf("\treqid = %d\n", (int)$ph1ent['ikeid'] * 1000);
if (!empty($rightsubnet_spec)) {
$tmpconf .= "\trightsubnet = " . join(',', array_unique($rightsubnet_spec)) . "\n";
}
@ -1682,12 +1682,15 @@ function ipsec_configure_vti()
}
}
if (!$isfound) {
log_error(sprintf(
"remove tunnel %s %s from interface %s", $addr['ipaddr'], $addr['endpoint'], $intf
));
mwexecf('/sbin/ifconfig %s %s %s delete', array(
log_error(sprintf(
"remove tunnel %s %s from interface %s",
$addr['ipaddr'],
$addr['endpoint'],
$intf
));
mwexecf('/sbin/ifconfig %s %s %s delete', array(
$intf, $proto == 'ipv6' ? 'inet6' : 'inet', $addr['ipaddr'], $addr['endpoint']
));
));
}
}
}
@ -1701,8 +1704,9 @@ function ipsec_configure_vti()
$inet = is_ipaddrv6($intf_details['local']) ? 'inet6' : 'inet';
if (empty($current_interfaces[$intf])) {
if (mwexecf('/sbin/ifconfig %s create reqid %s', array($intf, $intf_details['reqid'])) == 0) {
mwexecf('/sbin/ifconfig %s %s tunnel %s %s up',
array($intf, $inet, $intf_details['local'], $intf_details['remote'])
mwexecf(
'/sbin/ifconfig %s %s tunnel %s %s up',
array($intf, $inet, $intf_details['local'], $intf_details['remote'])
);
}
}

View File

@ -187,7 +187,7 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
} else {
// XXX remove user-config-readonly in some future release
throw new UserException(
sprintf("User %s denied for write access (user-config-readonly set)", $this->getUserName())
sprintf("User %s denied for write access (user-config-readonly set)", $this->getUserName())
);
}
}
@ -288,7 +288,7 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
* @throws \Phalcon\Validation\Exception on validation issues
* @throws \ReflectionException when binding to the model class fails
*/
public function addBase($post_field, $path, $overlay=null)
public function addBase($post_field, $path, $overlay = null)
{
$result = array("result" => "failed");
if ($this->request->isPost() && $this->request->hasPost($post_field)) {
@ -359,7 +359,7 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
* @throws \Phalcon\Validation\Exception on validation issues
* @throws \ReflectionException when binding to the model class fails
*/
public function setBase($post_field, $path, $uuid, $overlay=null)
public function setBase($post_field, $path, $uuid, $overlay = null)
{
if ($this->request->isPost() && $this->request->hasPost($post_field)) {
$mdl = $this->getModel();

View File

@ -44,10 +44,10 @@ class SettingsController extends ApiMutableModelControllerBase
* @param $uuid item unique id
* @return array
*/
public function getZoneAction($uuid = null)
{
return $this->getBase("zone", "zones.zone", $uuid);
}
public function getZoneAction($uuid = null)
{
return $this->getBase("zone", "zones.zone", $uuid);
}
/**
* update zone with given properties

View File

@ -404,7 +404,7 @@ class LDAP extends Base implements IAuthConnector
} else {
$user['email'] = '';
}
$result[] = $user ;
$result[] = $user;
break;
}
}

View File

@ -336,7 +336,8 @@ class Plugin
* iterate through registered rules
* @return Iterator
*/
public function iterateFilterRules() {
public function iterateFilterRules()
{
foreach ($this->filterRules as $prio => $ruleset) {
foreach ($ruleset as $rule) {
yield $rule;

View File

@ -78,7 +78,7 @@ class InterfaceField extends BaseField
/**
* @var bool allow dynamic interfaces
*/
private $internalAllowDynamic = false;
private $internalAllowDynamic = false;
/**
* collect parents for lagg interfaces