mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
interfaces: allow link-local address on bridges; closes #926
This commit is contained in:
parent
4335b1cda7
commit
db2b0ff27c
@ -390,6 +390,8 @@ function interface_bridge_configure(&$bridge, $checkmember = 0)
|
||||
$bridge['bridgeif'] = $bridgeif;
|
||||
}
|
||||
|
||||
mwexecf('/sbin/ifconfig %s inet6 %sauto_linklocal', array($bridgeif, isset($bridge['linklocal']) ? '' : '-'));
|
||||
|
||||
$checklist = get_configured_interface_with_descr();
|
||||
|
||||
/* Add interfaces to bridge */
|
||||
|
||||
@ -1,36 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2014-2015 Deciso B.V.
|
||||
Copyright (C) 2008 Ermal Luçi
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
* Copyright (C) 2014-2015 Deciso B.V.
|
||||
* Copyright (C) 2008 Ermal Luçi
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
require_once("interfaces.inc");
|
||||
|
||||
|
||||
$a_bridges = &config_read_array('bridges', 'bridged') ;
|
||||
|
||||
function bridge_inuse($bridge_if) {
|
||||
@ -42,7 +41,6 @@ function bridge_inuse($bridge_if) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$input_errors = array();
|
||||
if (!empty($a_bridges[$_POST['id']])) {
|
||||
@ -121,6 +119,7 @@ $main_buttons = array(
|
||||
<th><?=gettext("Interface");?></th>
|
||||
<th><?=gettext("Members");?></th>
|
||||
<th><?=gettext("Description");?></th>
|
||||
<th><?=gettext("Link-local");?></th>
|
||||
<th class="text-nowrap"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -130,7 +129,7 @@ $main_buttons = array(
|
||||
$ifdescrs = get_configured_interface_with_descr();
|
||||
foreach ($a_bridges as $bridge): ?>
|
||||
<tr>
|
||||
<td><?=strtoupper($bridge['bridgeif']);?></td>
|
||||
<td><?= $bridge['bridgeif'] ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$members = explode(',', $bridge['members']);
|
||||
@ -146,6 +145,7 @@ $main_buttons = array(
|
||||
}?>
|
||||
</td>
|
||||
<td><?=$bridge['descr'];?></td>
|
||||
<td><?= !empty($bridge['linklocal']) ? gettext('On') : gettext('Off') ?></td>
|
||||
<td class="text-nowrap">
|
||||
<a href="interfaces_bridge_edit.php?id=<?=$i;?>" class="btn btn-xs btn-default" data-toggle="tooltip" title="<?= html_safe(gettext('Edit')) ?>">
|
||||
<i class="fa fa-pencil fa-fw"></i>
|
||||
@ -167,4 +167,7 @@ $main_buttons = array(
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php include("foot.inc"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
include 'foot.inc';
|
||||
|
||||
@ -42,7 +42,6 @@ foreach (get_configured_interface_with_descr() as $bif => $bdescr) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// read form data
|
||||
if (!empty($a_bridges[$_GET['id']])) {
|
||||
@ -57,8 +56,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$pconfig[$fieldname] = null;
|
||||
}
|
||||
}
|
||||
|
||||
// bool fields
|
||||
$pconfig['enablestp'] = isset($a_bridges[$id]['enablestp']);
|
||||
$pconfig['enablestp'] = !empty($a_bridges[$id]['enablestp']);
|
||||
$pconfig['linklocal'] = !empty($a_bridges[$id]['linklocal']);
|
||||
|
||||
// simple array fields
|
||||
$array_fields = array('members', 'stp', 'edge', 'autoedge', 'ptp', 'autoptp', 'static', 'private');
|
||||
@ -144,7 +145,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
|
||||
if (count($input_errors) == 0) {
|
||||
$bridge = array();
|
||||
$bridge['enablestp'] = !empty($pconfig['enablestp']);
|
||||
// booleans
|
||||
foreach (['enablestp', 'linklocal'] as $fieldname) {
|
||||
if (!empty($pconfig[$fieldname])) {
|
||||
$bridge[$fieldname] = true;
|
||||
}
|
||||
}
|
||||
// 1 on 1 copy
|
||||
$copy_fields = array('descr', 'maxaddr', 'timeout', 'bridgeif', 'maxage','fwdelay', 'hellotime', 'priority', 'proto', 'holdcnt');
|
||||
foreach ($copy_fields as $fieldname) {
|
||||
@ -272,6 +278,18 @@ $(document).ready(function() {
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_linklocal" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext('Link-local address') ?></td>
|
||||
<td>
|
||||
<input type="checkbox" name="linklocal" <?= !empty($pconfig['linklocal']) ? 'checked="checked"' : '' ?> />
|
||||
<?= gettext('Enable link-local address') ?>
|
||||
<div class="hidden" data-for="help_for_linklocal">
|
||||
<?= gettext('By default, link-local addresses for bridges are disabled. You can enable them manually using this option. ' .
|
||||
'However, when a bridge interface has IPv6 addresses, IPv6 addresses on a member interface will be automatically ' .
|
||||
'removed before the interface is added.') ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="show_advanced_opt">
|
||||
<td></td>
|
||||
<td>
|
||||
@ -636,4 +654,7 @@ $(document).ready(function() {
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php include("foot.inc"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
include 'foot.inc';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user