diff options
author | Chris Buechler <cmb@pfsense.org> | 2016-02-09 17:56:33 -0600 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-02-09 17:56:33 -0600 |
commit | d9901ff473dc86e70ae59b3070164ec6e99c7df9 (patch) | |
tree | c20939ea03c230d98022f8dd314c6813f1795b88 | |
parent | 6c3d8b4554388adc49b93d06f3f57477263b3a31 (diff) | |
download | pfsense-d9901ff473dc86e70ae59b3070164ec6e99c7df9.zip pfsense-d9901ff473dc86e70ae59b3070164ec6e99c7df9.tar.gz |
Fix style issues.
-rw-r--r-- | src/etc/inc/filter.inc | 6 | ||||
-rw-r--r-- | src/etc/inc/gwlb.inc | 9 | ||||
-rw-r--r-- | src/etc/inc/interfaces.inc | 32 | ||||
-rw-r--r-- | src/etc/inc/ipsec.inc | 13 | ||||
-rw-r--r-- | src/etc/inc/openvpn.inc | 3 | ||||
-rw-r--r-- | src/etc/inc/system.inc | 3 | ||||
-rw-r--r-- | src/etc/inc/upgrade_config.inc | 47 | ||||
-rw-r--r-- | src/etc/inc/util.inc | 17 | ||||
-rw-r--r-- | src/usr/local/www/firewall_virtual_ip.php | 4 | ||||
-rw-r--r-- | src/usr/local/www/firewall_virtual_ip_edit.php | 11 | ||||
-rw-r--r-- | src/usr/local/www/interfaces_gre.php | 5 | ||||
-rw-r--r-- | src/usr/local/www/status_carp.php | 12 | ||||
-rw-r--r-- | src/usr/local/www/system_gateway_groups_edit.php | 6 | ||||
-rw-r--r-- | src/usr/local/www/vpn_ipsec.php | 3 | ||||
-rw-r--r-- | src/usr/local/www/vpn_ipsec_phase1.php | 3 |
15 files changed, 111 insertions, 63 deletions
diff --git a/src/etc/inc/filter.inc b/src/etc/inc/filter.inc index 674bd0b..e16b35d 100644 --- a/src/etc/inc/filter.inc +++ b/src/etc/inc/filter.inc @@ -4092,10 +4092,12 @@ function filter_generate_ipsec_rules($log = array()) { if (substr($ph1ent['interface'], 0, 4) == "_vip") { $parentinterface = get_configured_vip_interface($ph1ent['interface']); /* IP Alias -> CARP */ - if (substr($parentinterface, 0, 4) == "_vip") + if (substr($parentinterface, 0, 4) == "_vip") { $parentinterface = get_configured_vip_interface($parentinterface); - } else + } + } else { $parentinterface = $ph1ent['interface']; + } if (empty($FilterIflist[$parentinterface]['descr'])) { $ipfrules .= "# Could not locate interface for IPsec: {$descr}\n"; continue; diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index 8c74d45..6ab8b8a 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -908,8 +908,9 @@ function return_gateway_groups_array() { list($gwname, $tier, $vipname) = explode("|", $item); if (is_ipaddr($viplist[$vipname])) { - if (!is_array($gwvip_arr[$group['name']])) + if (!is_array($gwvip_arr[$group['name']])) { $gwvip_arr[$group['name']] = array(); + } $gwvip_arr[$group['name']][$gwname] = $vipname; } @@ -1066,8 +1067,9 @@ function get_interface_gateway($interface, &$dynamic = false) { if (substr($interface, 0, 4) == '_vip') { $interface = get_configured_vip_interface($interface); - if (substr($interface, 0, 4) == '_vip') + if (substr($interface, 0, 4) == '_vip') { $interface = get_configured_vip_interface($interface); + } } $gw = NULL; @@ -1103,8 +1105,9 @@ function get_interface_gateway_v6($interface, &$dynamic = false) { if (substr($interface, 0, 4) == '_vip') { $interface = get_configured_vip_interface($interface); - if (substr($interface, 0, 4) == '_vip') + if (substr($interface, 0, 4) == '_vip') { $interface = get_configured_vip_interface($interface); + } } $gw = NULL; diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 05945d3..82771df 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -2324,8 +2324,9 @@ function interface_ipalias_configure(&$vip) { } $af = 'inet'; - if (is_ipaddrv6($vip['subnet'])) + if (is_ipaddrv6($vip['subnet'])) { $af = 'inet6'; + } $iface = $vip['interface']; $vhid = ''; if (substr($vip['interface'], 0, 4) == "_vip") { @@ -4729,8 +4730,9 @@ function get_real_interface($interface = "wan", $family = "all", $realv6iface = default: if (substr($interface, 0, 4) == '_vip') { $wanif = get_configured_vip_interface($interface); - if (!empty($wanif)) + if (!empty($wanif)) { $wanif = get_real_interface($wanif); + } break; } else if (substr($interface, 0, 5) == '_lloc') { $interface = substr($interface, 5); @@ -5265,8 +5267,9 @@ function get_possible_listen_ips($include_ipv6_link_local=false) { $viplist = get_configured_vip_list(); foreach ($viplist as $vip => $address) { $interfaces[$vip] = $address; - if (get_vip_descr($address)) + if (get_vip_descr($address)) { $interfaces[$vip] .= " (". get_vip_descr($address) .")"; + } } $interfaces['lo0'] = 'Localhost'; @@ -5361,8 +5364,9 @@ function get_interface_ipv6($interface = "wan", $flush = false) { } break; } - if (is_ipaddrv6($config['interfaces'][$interface]['ipaddrv6'])) + if (is_ipaddrv6($config['interfaces'][$interface]['ipaddrv6'])) { return ($config['interfaces'][$interface]['ipaddrv6']); + } } /* @@ -5411,34 +5415,40 @@ function get_interface_linklocal($interface = "wan") { function get_interface_subnet($interface = "wan") { - if (substr($interface, 0, 4) == '_vip') + if (substr($interface, 0, 4) == '_vip') { return (get_configured_vip_subnetv4($interface)); + } $realif = get_real_interface($interface); - if (!$realif) + if (!$realif) { return (NULL); + } $cursn = find_interface_subnet($realif); - if (!empty($cursn)) + if (!empty($cursn)) { return ($cursn); + } return (NULL); } function get_interface_subnetv6($interface = "wan") { - if (substr($interface, 0, 4) == '_vip') + if (substr($interface, 0, 4) == '_vip') { return (get_configured_vip_subnetv6($interface)); - else if (substr($interface, 0, 5) == '_lloc') + } else if (substr($interface, 0, 5) == '_lloc') { $interface = substr($interface, 5); + } $realif = get_real_interface($interface, 'inet6'); - if (!$realif) + if (!$realif) { return (NULL); + } $cursn = find_interface_subnetv6($realif); - if (!empty($cursn)) + if (!empty($cursn)) { return ($cursn); + } return (NULL); } diff --git a/src/etc/inc/ipsec.inc b/src/etc/inc/ipsec.inc index f3e8ef2..2b7ff4d 100644 --- a/src/etc/inc/ipsec.inc +++ b/src/etc/inc/ipsec.inc @@ -275,16 +275,19 @@ function ipsec_ikeid_next() { function ipsec_get_phase1_src(& $ph1ent) { if ($ph1ent['interface']) { - if (substr($ph1ent['interface'], 0, 4) == "_vip") + if (substr($ph1ent['interface'], 0, 4) == "_vip") { $if = $ph1ent['interface']; - else + } else { $if = get_failover_interface($ph1ent['interface']); - } else + } + } else { $if = "wan"; - if ($ph1ent['protocol'] == "inet6") + } + if ($ph1ent['protocol'] == "inet6") { $interfaceip = get_interface_ipv6($if); - else + } else { $interfaceip = get_interface_ip($if); + } return $interfaceip; } diff --git a/src/etc/inc/openvpn.inc b/src/etc/inc/openvpn.inc index 06f44c6..6a4f1df 100644 --- a/src/etc/inc/openvpn.inc +++ b/src/etc/inc/openvpn.inc @@ -274,8 +274,9 @@ function openvpn_build_bridge_list() { foreach ($viplist as $vip => $address) { $serverbridge_interface[$vip.'|'.$address] = $address; - if (get_vip_descr($address)) + if (get_vip_descr($address)) { $serverbridge_interface[$vip.'|'.$address] .= " (". get_vip_descr($address) .")"; + } } foreach ($serverbridge_interface as $iface => $ifacename) { diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index ca3af44..89d38cc 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -1796,8 +1796,9 @@ function system_ntp_configure($start_ntpd=true) { $ntpcfg .= "interface ignore all\n"; foreach ($interfaces as $interface) { $interface = get_real_interface($interface); - if (!empty($interface)) + if (!empty($interface)) { $finterfaces[] = $interface; + } } foreach ($finterfaces as $interface) { $ntpcfg .= "interface listen {$interface}\n"; diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index 9f0091e..d54cffd 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -4455,10 +4455,12 @@ function get_vip_from_ip_alias($ipalias) { global $config; foreach ($config['virtualip']['vip'] as $idx => $vip) { - if ($vip['mode'] != "ipalias") + if ($vip['mode'] != "ipalias") { continue; - if ($ipalias == $vip['subnet']) + } + if ($ipalias == $vip['subnet']) { return ("_vip{$vip['uniqid']}"); + } } return ($ipalias); @@ -4468,10 +4470,12 @@ function get_vip_from_oldcarp($carp) { global $config; foreach ($config['virtualip']['vip'] as $idx => $vip) { - if ($vip['mode'] != "carp") + if ($vip['mode'] != "carp") { continue; - if ($carp == "{$vip['interface']}_vip{$vip['vhid']}") + } + if ($carp == "{$vip['interface']}_vip{$vip['vhid']}") { return ("_vip{$vip['uniqid']}"); + } } return ($carp); @@ -4493,32 +4497,37 @@ function upgrade_143_to_144() { /* Convert IPsec phase 1 entries. */ if (is_array($config['ipsec']['phase1'])) { foreach ($config['ipsec']['phase1'] as $idx => $ph1ent) { - if (is_ipaddr($ph1ent['interface']) || is_ipaddrv6($ph1ent['interface'])) + if (is_ipaddr($ph1ent['interface']) || is_ipaddrv6($ph1ent['interface'])) { $config['ipsec']['phase1'][$idx]['interface'] = get_vip_from_ip_alias($ph1ent['interface']); - else if (strpos($ph1ent['interface'], "_vip")) + } else if (strpos($ph1ent['interface'], "_vip")) { $config['ipsec']['phase1'][$idx]['interface'] = get_vip_from_oldcarp($ph1ent['interface']); + } } } /* Convert openvpn. */ if (is_array($config['openvpn']['openvpn-server'])) { foreach ($config['openvpn']['openvpn-server'] as $idx => $ovpn) { - if (empty($ovpn['interface'])) + if (empty($ovpn['interface'])) { continue; - if (is_ipaddr($ovpn['interface']) || is_ipaddrv6($ovpn['interface'])) + } + if (is_ipaddr($ovpn['interface']) || is_ipaddrv6($ovpn['interface'])) { $config['openvpn']['openvpn-server'][$idx]['interface'] = get_vip_from_ip_alias($ovpn['interface']); - else if (strpos($ovpn['interface'], "_vip")) + } else if (strpos($ovpn['interface'], "_vip")) { $config['openvpn']['openvpn-server'][$idx]['interface'] = get_vip_from_oldcarp($ovpn['interface']); + } } } if (is_array($config['openvpn']['openvpn-client'])) { foreach ($config['openvpn']['openvpn-client'] as $idx => $ovpn) { - if (empty($ovpn['interface'])) + if (empty($ovpn['interface'])) { continue; - if (is_ipaddr($ovpn['interface']) || is_ipaddrv6($ovpn['interface'])) + } + if (is_ipaddr($ovpn['interface']) || is_ipaddrv6($ovpn['interface'])) { $config['openvpn']['openvpn-client'][$idx]['interface'] = get_vip_from_ip_alias($ovpn['interface']); - else if (strpos($ovpn['interface'], "_vip")) + } else if (strpos($ovpn['interface'], "_vip")) { $config['openvpn']['openvpn-client'][$idx]['interface'] = get_vip_from_oldcarp($ovpn['interface']); + } } } @@ -4527,12 +4536,13 @@ function upgrade_143_to_144() { $active_ifs = explode(",", $config['unbound']['active_interface']); $ifs = array(); foreach ($active_ifs as $if) { - if (is_ipaddr($if) || is_ipaddrv6($if)) + if (is_ipaddr($if) || is_ipaddrv6($if)) { $ifs[] = get_vip_from_ip_alias($if); - else if (strpos($if, "_vip")) + } else if (strpos($if, "_vip")) { $ifs[] = get_vip_from_oldcarp($if); - else + } else { $ifs[] = $if; + } } $config['unbound']['active_interface'] = implode(",", $ifs); } @@ -4542,12 +4552,13 @@ function upgrade_143_to_144() { $active_ifs = explode(",", $config['dnsmasq']['interface']); $ifs = array(); foreach ($active_ifs as $if) { - if (is_ipaddr($if) || is_ipaddrv6($if)) + if (is_ipaddr($if) || is_ipaddrv6($if)) { $ifs[] = get_vip_from_ip_alias($if); - else if (strpos($if, "_vip")) + } else if (strpos($if, "_vip")) { $ifs[] = get_vip_from_oldcarp($if); - else + } else { $ifs[] = $if; + } } $config['dnsmasq']['interface'] = implode(",", $ifs); } diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 3ec908f..76cc0d1 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -1136,13 +1136,15 @@ function get_configured_vip_list($family = 'all') { global $config; $list = array(); - if (!is_array($config['virtualip']['vip']) || empty($config['virtualip']['vip'])) + if (!is_array($config['virtualip']['vip']) || empty($config['virtualip']['vip'])) { return ($list); + } $viparr = &$config['virtualip']['vip']; foreach ($viparr as $vip) { - if ($vip['mode'] != "carp" && $vip['mode'] != "ipalias") + if ($vip['mode'] != "carp" && $vip['mode'] != "ipalias") { continue; + } if ($family == 'all' || ($family == 'inet' && is_ipaddrv4($vip['subnet'])) || @@ -1193,11 +1195,13 @@ function get_configured_vip_detail($vipinterface = '', $family = 'inet', $what = $viparr = &$config['virtualip']['vip']; foreach ($viparr as $vip) { - if ($vip['mode'] != "carp" && $vip['mode'] != "ipalias") + if ($vip['mode'] != "carp" && $vip['mode'] != "ipalias") { continue; + } - if ($vipinterface != "_vip{$vip['uniqid']}") + if ($vipinterface != "_vip{$vip['uniqid']}") { continue; + } switch ($what) { case 'subnet': @@ -1214,10 +1218,11 @@ function get_configured_vip_detail($vipinterface = '', $family = 'inet', $what = break; case 'ip': default: - if ($family == 'inet' && is_ipaddrv4($vip['subnet'])) + if ($family == 'inet' && is_ipaddrv4($vip['subnet'])) { return ($vip['subnet']); - else if ($family == 'inet6' && is_ipaddrv6($vip['subnet'])) + } else if ($family == 'inet6' && is_ipaddrv6($vip['subnet'])) { return ($vip['subnet']); + } break; } break; diff --git a/src/usr/local/www/firewall_virtual_ip.php b/src/usr/local/www/firewall_virtual_ip.php index 4e8226c..945f48a 100644 --- a/src/usr/local/www/firewall_virtual_ip.php +++ b/src/usr/local/www/firewall_virtual_ip.php @@ -307,9 +307,9 @@ $viplist = get_configured_vip_list(); foreach ($viplist as $vipname => $address) { $interfaces[$vipname] = $address; $interfaces[$vipname] .= " ("; - if (get_vip_descr($address)) + if (get_vip_descr($address)) { $interfaces[$vipname] .= get_vip_descr($address); - else { + } else { $vip = get_configured_vip($vipname); $interfaces[$vipname] .= "vhid: {$vip['vhid']}"; } diff --git a/src/usr/local/www/firewall_virtual_ip_edit.php b/src/usr/local/www/firewall_virtual_ip_edit.php index d3beb92..b9a49c3 100644 --- a/src/usr/local/www/firewall_virtual_ip_edit.php +++ b/src/usr/local/www/firewall_virtual_ip_edit.php @@ -260,8 +260,9 @@ if ($_POST) { } /* IPalias specific fields */ - if ($_POST['mode'] === "ipalias") + if ($_POST['mode'] === "ipalias") { $vipent['uniqid'] = $_POST['uniqid']; + } /* Common fields */ $vipent['descr'] = $_POST['descr']; @@ -327,15 +328,17 @@ function build_if_list() { foreach ($carplist as $vipname => $address) { $vip = get_configured_vip($vipname); - if ($vip['mode'] != 'carp') + if ($vip['mode'] != 'carp') { continue; + } $interfaces[$vipname] = $address; $interfaces[$vipname] .= " ("; - if (get_vip_descr($address)) + if (get_vip_descr($address)) { $interfaces[$vipname] .= get_vip_descr($address); - else + } else { $interfaces[$vipname] .= "vhid: {$vip['vhid']}"; + } $interfaces[$vipname] .= ")"; } diff --git a/src/usr/local/www/interfaces_gre.php b/src/usr/local/www/interfaces_gre.php index 0acbf1e..a677a23 100644 --- a/src/usr/local/www/interfaces_gre.php +++ b/src/usr/local/www/interfaces_gre.php @@ -136,10 +136,11 @@ display_top_tabs($tab_array); </thead> <tbody> <?php foreach ($a_gres as $i => $gre): - if (substr($gre['if'], 0, 4) == "_vip") + if (substr($gre['if'], 0, 4) == "_vip") { $if = convert_real_interface_to_friendly_descr(get_real_interface($gre['if'])); - else + } else { $if = $gre['if']; + } ?> <tr> <td> diff --git a/src/usr/local/www/status_carp.php b/src/usr/local/www/status_carp.php index 748c36b..15bf5f4 100644 --- a/src/usr/local/www/status_carp.php +++ b/src/usr/local/www/status_carp.php @@ -72,10 +72,12 @@ function find_ipalias($carpif) { $ips = array(); foreach ($config['virtualip']['vip'] as $vip) { - if ($vip['mode'] != "ipalias") + if ($vip['mode'] != "ipalias") { continue; - if ($vip['interface'] != $carpif) + } + if ($vip['interface'] != $carpif) { continue; + } $ips[] = "{$vip['subnet']}/{$vip['subnet_bits']}"; } @@ -130,8 +132,9 @@ if ($_POST['disablecarp'] != "") { interface_carp_configure($vip); break; case 'ipalias': - if (substr($vip['interface'], 0, 4) == "_vip") + if (substr($vip['interface'], 0, 4) == "_vip") { interface_ipalias_configure($vip); + } break; } } @@ -252,8 +255,9 @@ if ($carpcount == 0) { <td> <?php printf("{$carp['subnet']}/{$carp['subnet_bits']}"); - for ($i = 0; $i < count($aliases); $i++) + for ($i = 0; $i < count($aliases); $i++) { printf("<br>{$aliases[$i]}"); + } ?> </td> <td><i class="fa fa-<?=$icon?>"></i> <?=$status?></td> diff --git a/src/usr/local/www/system_gateway_groups_edit.php b/src/usr/local/www/system_gateway_groups_edit.php index c083794..3d4054b 100644 --- a/src/usr/local/www/system_gateway_groups_edit.php +++ b/src/usr/local/www/system_gateway_groups_edit.php @@ -196,8 +196,9 @@ function build_vip_list($family = 'all') { $viplist = get_configured_vip_list($family); foreach ($viplist as $vip => $address) { $list[$vip] = "$address"; - if (get_vip_descr($address)) + if (get_vip_descr($address)) { $list[$vip] .= " (". get_vip_descr($address) .")"; + } } return($list); @@ -251,8 +252,9 @@ foreach ($a_gateways as $gwname => $gateway) { $itemsplit = explode("|", $item); if ($itemsplit[0] == $gwname) { $selected = $itemsplit[1]; - if (count($itemsplit) >= 3) + if (count($itemsplit) >= 3) { $vaddress = $itemsplit[2]; + } break; } } diff --git a/src/usr/local/www/vpn_ipsec.php b/src/usr/local/www/vpn_ipsec.php index 81f1dfe..196994c 100644 --- a/src/usr/local/www/vpn_ipsec.php +++ b/src/usr/local/www/vpn_ipsec.php @@ -326,8 +326,9 @@ display_top_tabs($tab_array); $viplist = get_configured_vip_list(); foreach ($viplist as $vip => $address) { $iflabels[$vip] = $address; - if (get_vip_descr($address)) + if (get_vip_descr($address)) { $iflabels[$vip] .= " (". get_vip_descr($address) .")"; + } } $grouplist = return_gateway_groups_array(); diff --git a/src/usr/local/www/vpn_ipsec_phase1.php b/src/usr/local/www/vpn_ipsec_phase1.php index aba06f3..05f0af9 100644 --- a/src/usr/local/www/vpn_ipsec_phase1.php +++ b/src/usr/local/www/vpn_ipsec_phase1.php @@ -527,8 +527,9 @@ function build_interface_list() { $viplist = get_configured_vip_list(); foreach ($viplist as $vip => $address) { $interfaces[$vip] = $address; - if (get_vip_descr($address)) + if (get_vip_descr($address)) { $interfaces[$vip] .= " (". get_vip_descr($address) .")"; + } } $grouplist = return_gateway_groups_array(); |