summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-02-14 17:27:31 -0500
committerStephen Beaver <sbeaver@netgate.com>2016-02-14 17:27:31 -0500
commite1346a0ca9ca1110c2f377fcac830a67d5d95767 (patch)
treec3f3c26d399d2a21c55aef4c3e5b89f833a61070 /src
parent02342d8c9fa4fe988c101427bd02096ba9ac686f (diff)
parent47cc723a7d45e82ec2076a9b3271fb7d2fb43f78 (diff)
downloadpfsense-e1346a0ca9ca1110c2f377fcac830a67d5d95767.zip
pfsense-e1346a0ca9ca1110c2f377fcac830a67d5d95767.tar.gz
Merge pull request #2638 from phil-davis/patch-1
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/functions.inc36
-rw-r--r--src/etc/inc/interfaces.inc9
-rw-r--r--src/usr/local/www/interfaces_bridge_edit.php148
3 files changed, 114 insertions, 79 deletions
diff --git a/src/etc/inc/functions.inc b/src/etc/inc/functions.inc
index 026d7fb..07760e0 100644
--- a/src/etc/inc/functions.inc
+++ b/src/etc/inc/functions.inc
@@ -106,7 +106,7 @@ if (!function_exists("get_menu_messages")) {
## Get Query Arguments from URL ###
foreach ($_REQUEST as $key => $value) {
if ($key != "PHPSESSID") {
- $requests[] = $key.'='.$value;
+ $requests[] = $key . '=' . $value;
}
}
if (is_array($requests)) {
@@ -115,31 +115,31 @@ if (!function_exists("get_menu_messages")) {
if (is_array($notices)) {
$notice_msgs = "<table colspan=\'6\' id=\'notice_table\'>";
- $alert_style="style=\'color:#ffffff; filter:Glow(color=#ff0000, strength=12);\' ";
- $notice = "<a href=\'#\' onclick=notice_action(\'acknowledge\',\'all\');domTT_close(this); {$alert_style}>".gettext("Acknowledge All Notices")."</a>";
- $alert_link="title=\'".gettext("Click to Acknowledge")."\' {$alert_style}";
- $domtt_width=500;
+ $alert_style = "style=\'color:#ffffff; filter:Glow(color=#ff0000, strength=12);\' ";
+ $notice = "<a href=\'#\' onclick=notice_action(\'acknowledge\',\'all\');domTT_close(this); {$alert_style}>" . gettext("Acknowledge All Notices") . "</a>";
+ $alert_link = "title=\'" . gettext("Click to Acknowledge") . "\' {$alert_style}";
+ $domtt_width = 500;
foreach ($notices as $key => $value) {
$date = date("m-d-y H:i:s", $key);
$noticemsg = ($value['notice'] != "" ? $value['notice'] : $value['id']);
$noticemsg = strip_tags(preg_replace("/(\"|\'|\n|<.?\w+>)/i", "", $noticemsg));
if ((strlen($noticemsg)* 8) > $domtt_width) {
- $domtt_width=(strlen($noticemsg) *8);
+ $domtt_width = (strlen($noticemsg) *8);
}
if ((strlen($noticemsg)* 8) > 900) {
- $domtt_width= 900;
+ $domtt_width = 900;
}
- $alert_action ="onclick=notice_action(\'acknowledge\',\'{$key}\');domTT_close(this);jQuery(this).parent().parent().remove();";
- $notice_msgs .= "<tr><td valign=\'top\' width=\'120\'><a href=\'#\' {$alert_link} {$alert_action}>{$date}</a></td><td valign=\'top\'><a href=\'#\' {$alert_link} {$alert_action}>[ ".htmlspecialchars($noticemsg)."]</a></td></tr>";
+ $alert_action = "onclick=notice_action(\'acknowledge\',\'{$key}\');domTT_close(this);jQuery(this).parent().parent().remove();";
+ $notice_msgs .= "<tr><td valign=\'top\' width=\'120\'><a href=\'#\' {$alert_link} {$alert_action}>{$date}</a></td><td valign=\'top\'><a href=\'#\' {$alert_link} {$alert_action}>[ " . htmlspecialchars($noticemsg) . "]</a></td></tr>";
}
- $notice_msgs .="</table>";
+ $notice_msgs .= "</table>";
- $domtt= "onclick=\"domTT_activate(this, event, 'caption', '{$notice}','content', '<br />{$notice_msgs}', 'trail', false, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle','width','{$domtt_width}','y',5,'type', 'sticky');\"";
- $menu_messages="<div id='alerts'>\n";
+ $domtt = "onclick=\"domTT_activate(this, event, 'caption', '{$notice}','content', '<br />{$notice_msgs}', 'trail', false, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle','width','{$domtt_width}','y',5,'type', 'sticky');\"";
+ $menu_messages = "<div id='alerts'>\n";
if (count($notices) == 1) {
- $msg= sprintf("%1$02d", count($notices)) . " " . gettext("unread notice");
+ $msg = sprintf("%1$02d", count($notices)) . " " . gettext("unread notice");
} else {
- $msg= sprintf("%1$02d", count($notices)) . " " . gettext("unread notices");
+ $msg = sprintf("%1$02d", count($notices)) . " " . gettext("unread notices");
}
$menu_messages .= "<div id='marquee-text' style='z-index:1001;'><a href='#' {$domtt}><b> .:. {$msg} .:. </b></a></div>\n";
$menu_messages .= "</div>\n";
@@ -155,13 +155,13 @@ if (!function_exists("get_menu_messages")) {
if (!function_exists("dom_title")) {
function dom_title($title_msg, $width=NULL) {
- $width=preg_replace("/\D+/", "", $width);
+ $width = preg_replace("/\D+/", "", $width);
if (!empty($width)) {
- $width=",'width',$width";
+ $width = ",'width',$width";
}
if (!empty($title_msg)) {
- $title_msg=preg_replace("/\s+/", " ", $title_msg);
- $title_msg=preg_replace("/'/", "\'", $title_msg);
+ $title_msg = preg_replace("/\s+/", " ", $title_msg);
+ $title_msg = preg_replace("/'/", "\'", $title_msg);
return "onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\" onmouseover=\"domTT_activate(this, event, 'content', '{$title_msg}', 'trail', true, 'delay', 250, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle' $width);\"";
}
}
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index fb9a766..800ff42 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -617,9 +617,12 @@ function interface_bridge_configure(&$bridge, $checkmember = 0) {
if ($bridge['timeout'] <> "") {
mwexec("/sbin/ifconfig {$bridgeif} timeout " . escapeshellarg($bridge['timeout']));
}
- if ($bridge['span'] <> "") {
- $realif = get_real_interface($bridge['span']);
- mwexec("/sbin/ifconfig {$bridgeif} span {$realif}");
+ if (!empty($bridge['span'])) {
+ $spanifs = explode(",", $bridge['span']);
+ foreach ($spanifs as $spanif) {
+ $realif = get_real_interface($spanif);
+ mwexec("/sbin/ifconfig {$bridgeif} span {$realif}");
+ }
}
if (!empty($bridge['edge'])) {
$edgeifs = explode(',', $bridge['edge']);
diff --git a/src/usr/local/www/interfaces_bridge_edit.php b/src/usr/local/www/interfaces_bridge_edit.php
index af49aac..2fa5573 100644
--- a/src/usr/local/www/interfaces_bridge_edit.php
+++ b/src/usr/local/www/interfaces_bridge_edit.php
@@ -90,15 +90,6 @@ if (isset($id) && $a_bridges[$id]) {
$pconfig['members'] = $a_bridges[$id]['members'];
$pconfig['maxaddr'] = $a_bridges[$id]['maxaddr'];
$pconfig['timeout'] = $a_bridges[$id]['timeout'];
- if ($a_bridges[$id]['static']) {
- $pconfig['static'] = $a_bridges[$id]['static'];
- }
- if ($a_bridges[$id]['private']) {
- $pconfig['private'] = $a_bridges[$id]['private'];
- }
- if (isset($a_bridges[$id]['stp'])) {
- $pconfig['stp'] = $a_bridges[$id]['stp'];
- }
$pconfig['maxage'] = $a_bridges[$id]['maxage'];
$pconfig['fwdelay'] = $a_bridges[$id]['fwdelay'];
$pconfig['hellotime'] = $a_bridges[$id]['hellotime'];
@@ -132,7 +123,18 @@ if (isset($id) && $a_bridges[$id]) {
$pconfig['ifpathcost'] = $ifpathcost;
}
- $pconfig['span'] = $a_bridges[$id]['span'];
+ if (isset($a_bridges[$id]['static'])) {
+ $pconfig['static'] = $a_bridges[$id]['static'];
+ }
+ if (isset($a_bridges[$id]['private'])) {
+ $pconfig['private'] = $a_bridges[$id]['private'];
+ }
+ if (isset($a_bridges[$id]['stp'])) {
+ $pconfig['stp'] = $a_bridges[$id]['stp'];
+ }
+ if (isset($a_bridges[$id]['span'])) {
+ $pconfig['span'] = $a_bridges[$id]['span'];
+ }
if (isset($a_bridges[$id]['edge'])) {
$pconfig['edge'] = $a_bridges[$id]['edge'];
}
@@ -197,6 +199,65 @@ if ($_POST) {
$input_errors[] = gettext("You must select at least one member interface for a bridge.");
}
+ if (is_array($_POST['static'])) {
+ foreach ($_POST['static'] as $ifstatic) {
+ if (is_array($_POST['members']) && !in_array($ifstatic, $_POST['members'])) {
+ $input_errors[] = gettext("Sticky interface ($ifstatic) is not part of the bridge. Remove the sticky interface to continue.");
+ }
+ }
+ $pconfig['static'] = implode(',', $_POST['static']);
+ }
+ if (is_array($_POST['private'])) {
+ foreach ($_POST['private'] as $ifprivate) {
+ if (is_array($_POST['members']) && !in_array($ifprivate, $_POST['members'])) {
+ $input_errors[] = gettext("Private interface ($ifprivate) is not part of the bridge. Remove the private interface to continue.");
+ }
+ }
+ $pconfig['private'] = implode(',', $_POST['private']);
+ }
+ if (is_array($_POST['stp'])) {
+ foreach ($_POST['stp'] as $ifstp) {
+ if (is_array($_POST['members']) && !in_array($ifstp, $_POST['members'])) {
+ $input_errors[] = gettext("STP interface ($ifstp) is not part of the bridge. Remove the STP interface to continue.");
+ }
+ }
+ $pconfig['stp'] = implode(',', $_POST['stp']);
+ }
+ if (is_array($_POST['span'])) {
+ $pconfig['span'] = implode(',', $_POST['span']);
+ }
+ if (is_array($_POST['edge'])) {
+ foreach ($_POST['edge'] as $ifedge) {
+ if (is_array($_POST['members']) && !in_array($ifedge, $_POST['members'])) {
+ $input_errors[] = gettext("Edge interface ($ifedge) is not part of the bridge. Remove the edge interface to continue.");
+ }
+ }
+ $pconfig['edge'] = implode(',', $_POST['edge']);
+ }
+ if (is_array($_POST['autoedge'])) {
+ foreach ($_POST['autoedge'] as $ifautoedge) {
+ if (is_array($_POST['members']) && !in_array($ifautoedge, $_POST['members'])) {
+ $input_errors[] = gettext("Auto Edge interface ($ifautoedge) is not part of the bridge. Remove the auto edge interface to continue.");
+ }
+ }
+ $pconfig['autoedge'] = implode(',', $_POST['autoedge']);
+ }
+ if (is_array($_POST['ptp'])) {
+ foreach ($_POST['ptp'] as $ifptp) {
+ if (is_array($_POST['members']) && !in_array($ifptp, $_POST['members'])) {
+ $input_errors[] = gettext("PTP interface ($ifptp) is not part of the bridge. Remove the PTP interface to continue.");
+ }
+ }
+ $pconfig['ptp'] = implode(',', $_POST['ptp']);
+ }
+ if (is_array($_POST['autoptp'])) {
+ foreach ($_POST['autoptp'] as $ifautoptp) {
+ if (is_array($_POST['members']) && !in_array($ifautoptp, $_POST['members'])) {
+ $input_errors[] = gettext("Auto PTP interface ($ifautoptp) is not part of the bridge. Remove the auto PTP interface to continue.");
+ }
+ }
+ $pconfig['autoptp'] = implode(',', $_POST['autoptp']);
+ }
if (is_array($_POST['members'])) {
foreach ($_POST['members'] as $ifmembers) {
if (empty($config['interfaces'][$ifmembers])) {
@@ -206,8 +267,8 @@ if ($_POST) {
$config['interfaces'][$ifmembers]['wireless']['mode'] != "hostap") {
$input_errors[] = gettext("Bridging a wireless interface is only possible in hostap mode.");
}
- if ($_POST['span'] != "none" && $_POST['span'] == $ifmembers) {
- $input_errors[] = gettext("Span interface cannot be part of the bridge. Remove the span interface from bridge members to continue.");
+ if (is_array($_POST['span']) && in_array($ifmembers, $_POST['span'])) {
+ $input_errors[] = gettext("Span interface ($ifmembers) cannot be part of the bridge. Remove the span interface from bridge members to continue.");
}
foreach ($a_bridges as $a_bridge) {
if ($_POST['bridgeif'] === $a_bridge['bridgeif']) {
@@ -231,15 +292,6 @@ if ($_POST) {
$bridge['descr'] = $_POST['descr'];
$bridge['maxaddr'] = $_POST['maxaddr'];
$bridge['timeout'] = $_POST['timeout'];
- if ($_POST['static']) {
- $bridge['static'] = implode(',', $_POST['static']);
- }
- if ($_POST['private']) {
- $bridge['private'] = implode(',', $_POST['private']);
- }
- if (isset($_POST['stp'])) {
- $bridge['stp'] = implode(',', $_POST['stp']);
- }
$bridge['maxage'] = $_POST['maxage'];
$bridge['fwdelay'] = $_POST['fwdelay'];
$bridge['hellotime'] = $_POST['hellotime'];
@@ -269,10 +321,17 @@ if ($_POST) {
$bridge['ifpriority'] = $ifpriority;
$bridge['ifpathcost'] = $ifpathcost;
- if ($_POST['span'] != "none") {
- $bridge['span'] = $_POST['span'];
- } else {
- unset($bridge['span']);
+ if (isset($_POST['static'])) {
+ $bridge['static'] = implode(',', $_POST['static']);
+ }
+ if (isset($_POST['private'])) {
+ $bridge['private'] = implode(',', $_POST['private']);
+ }
+ if (isset($_POST['stp'])) {
+ $bridge['stp'] = implode(',', $_POST['stp']);
+ }
+ if (isset($_POST['span'])) {
+ $bridge['span'] = implode(',', $_POST['span']);
}
if (isset($_POST['edge'])) {
$bridge['edge'] = implode(',', $_POST['edge']);
@@ -287,7 +346,6 @@ if ($_POST) {
$bridge['autoptp'] = implode(',', $_POST['autoptp']);
}
-
$bridge['bridgeif'] = $_POST['bridgeif'];
interface_bridge_configure($bridge);
if ($bridge['bridgeif'] == "" || !stristr($bridge['bridgeif'], "bridge")) {
@@ -312,35 +370,6 @@ if ($_POST) {
}
}
-function build_spanport_list() {
- global $ifacelist;
-
- $splist = array('none' => gettext('None'));
-
- foreach ($ifacelist as $ifn => $ifdescr) {
- $splist[$ifn] = $ifdescr;
- }
-
- return($splist);
-}
-
-function build_member_list() {
- global $pconfig, $ifacelist;
-
- $memberlist = array('list' => array(), 'selected' => array());
-
- $members_array = explode(',', $pconfig['members']);
- foreach ($ifacelist as $ifn => $ifinfo) {
- $memberlist['list'][$ifn] = $ifinfo;
-
- if (in_array($ifn, $members_array)) {
- array_push($memberlist['selected'], $ifn);
- }
- }
- unset($members_array);
- return($memberlist);
-}
-
function build_port_list($selecton) {
global $ifacelist;
@@ -369,7 +398,7 @@ $form = new Form();
$section = new Form_Section('Bridge Configuration');
-$memberslist = build_member_list();
+$memberslist = build_port_list($pconfig['members']);
$section->addInput(new Form_Select(
'members',
@@ -418,11 +447,14 @@ $section->addInput(new Form_Input(
$pconfig['timeout']
))->setHelp('Set the timeout of address cache entries to this number of seconds. If seconds is zero, then address cache entries will not be expired. The default is 240 seconds');
+$spanlist = build_port_list($pconfig['span']);
+
$section->addInput(new Form_Select(
'span',
'Span Port',
- $pconfig['span'],
- build_spanport_list()
+ $spanlist['selected'],
+ $spanlist['list'],
+ true
))->setHelp('Add the interface named by interface as a span port on the bridge. Span ports transmit a copy of every frame received by the bridge.' .
'This is most useful for snooping a bridged network passively on another host connected to one of the span ports of the bridge. <br />' .
'%sThe span interface cannot be part of the bridge member interfaces.%s', ['<strong>', '</strong>']);
OpenPOWER on IntegriCloud