Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLDPd integrated switch workaround. Issue #9635 #860

Merged
merged 1 commit into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion net-mgmt/pfSense-pkg-lldpd/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# $FreeBSD$

PORTNAME= pfSense-pkg-lldpd
PORTVERSION= 0.9.10
PORTVERSION= 0.9.11
CATEGORIES= net-mgmt
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
21 changes: 19 additions & 2 deletions net-mgmt/pfSense-pkg-lldpd/files/usr/local/pkg/lldpd/lldpd.inc
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,24 @@ function lldpd_sync_config() {

/* Interface list */
$interfaces = array();
$int_switch = array();
if (file_exists("/etc/inc/switch.inc")) {
require_once('switch.inc');
if (!empty(switch_get_devices())) {
$int_switch = switch_get_uplink_ports();
}
}
foreach (explode(',', $lldpd_config['interfaces']) as $i) {
foreach (get_parent_physical_interface($i) as $p) {
$interfaces[$p] = $p;
if (!empty($int_switch) && in_array($p, $int_switch)) {
$int = get_real_interface($i);
$interfaces[$int] = $int;
} else {
$interfaces[$p] = $p;
}
}
}
$interfaces = array_unique($interfaces);
if (count($interfaces)) {
$cmd .= ' -I ' . escapeshellarg(implode(',', $interfaces));
}
Expand All @@ -134,7 +147,11 @@ function lldpd_sync_config() {
$cmd .= ' -r';
} else {
/* Chassis interface */
$chassis = implode(',', get_parent_physical_interface($lldpd_config['chassis']));
$chassis_int = get_parent_physical_interface($lldpd_config['chassis']);
if (!empty($int_switch) && empty(array_diff($int_switch, $chassis_int))) {
$chassis_int = array(get_real_interface($lldpd_config['chassis']));
}
$chassis = implode(',', $chassis_int);
if (isset($chassis)) {
$cmd .= ' -C ' . escapeshellarg($chassis);
}
Expand Down