mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
This reverts commit 81ddab86af
.
This commit is contained in:
@@ -126,7 +126,6 @@ if (dbFetchCell("SELECT 1 from `packages` LIMIT 1")) {
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'ipv6'))); ?>"><i class="fa fa-search fa-fw fa-lg" aria-hidden="true"></i> IPv6 Address</a></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'mac'))); ?>"><i class="fa fa-search fa-fw fa-lg" aria-hidden="true"></i> MAC Address</a></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'arp'))); ?>"><i class="fa fa-search fa-fw fa-lg" aria-hidden="true"></i> ARP Tables</a></li>
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'fdb'))); ?>"><i class="fa fa-search fa-fw fa-lg" aria-hidden="true"></i> FDB Tables</a></li>
|
||||
<?php
|
||||
if (is_module_enabled('poller', 'mib')) {
|
||||
?>
|
||||
|
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
$param = array();
|
||||
|
||||
$sql .= ' FROM `ports_fdb` AS F, `ports` AS P, `devices` AS D, `vlans` as V ';
|
||||
|
||||
if (is_admin() === false && is_read() === false) {
|
||||
$sql .= ' LEFT JOIN `devices_perms` AS `DP` ON `D`.`device_id` = `DP`.`device_id`';
|
||||
$where .= ' AND `DP`.`user_id`=?';
|
||||
$param[] = $_SESSION['user_id'];
|
||||
}
|
||||
|
||||
$sql .= " WHERE F.port_id = P.port_id AND P.device_id = D.device_id AND F.vlan_id = V.vlan_id $where ";
|
||||
|
||||
if (is_numeric($_POST['device_id'])) {
|
||||
$sql .= ' AND P.device_id = ?';
|
||||
$param[] = $_POST['device_id'];
|
||||
}
|
||||
|
||||
if (is_numeric($_POST['port_id'])) {
|
||||
$sql .= ' AND P.port_id = ?';
|
||||
$param[] = $_POST['port_id'];
|
||||
}
|
||||
|
||||
if (isset($_POST['searchPhrase']) && !empty($_POST['searchPhrase'])) {
|
||||
$vlan_search = mres(trim($_POST['searchPhrase']));
|
||||
$mac_search = '%'.str_replace(array(':', ' ', '-', '.', '0x'), '', mres($_POST['searchPhrase'])).'%';
|
||||
|
||||
if (isset($_POST['searchby']) && $_POST['searchby'] == 'vlan') {
|
||||
$sql .= ' AND `vlan_vlan` LIKE ?';
|
||||
$param[] = $vlan_search;
|
||||
} elseif (isset($_POST['searchby']) && $_POST['searchby'] == 'mac') {
|
||||
$sql .= ' AND `mac_address` LIKE ?';
|
||||
$param[] = $mac_search;
|
||||
} else {
|
||||
$sql .= ' AND (`vlan_vlan` LIKE ? OR `mac_address` LIKE ?)';
|
||||
$param[] = $vlan_search;
|
||||
$param[] = $mac_search;
|
||||
}
|
||||
}
|
||||
|
||||
$count_sql = "SELECT COUNT(`F`.`port_id`) $sql";
|
||||
|
||||
$total = dbFetchCell($count_sql, $param);
|
||||
if (empty($total)) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
if (!isset($sort) || empty($sort)) {
|
||||
$sort = '`hostname` ASC';
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY $sort";
|
||||
|
||||
if (isset($current)) {
|
||||
$limit_low = (($current * $rowCount) - ($rowCount));
|
||||
$limit_high = $rowCount;
|
||||
}
|
||||
|
||||
if ($rowCount != -1) {
|
||||
$sql .= " LIMIT $limit_low,$limit_high";
|
||||
}
|
||||
|
||||
$sql = "SELECT *,`P`.`ifDescr` AS `interface`,`V`.`vlan_vlan` $sql";
|
||||
|
||||
foreach (dbFetchRows($sql, $param) as $entry) {
|
||||
$entry = cleanPort($entry);
|
||||
if (!$ignore) {
|
||||
if ($entry['ifInErrors'] > 0 || $entry['ifOutErrors'] > 0) {
|
||||
$error_img = generate_port_link($entry, "<i class='fa fa-flag fa-lg' style='color:red' aria-hidden='true'></i>", port_errors);
|
||||
} else {
|
||||
$error_img = '';
|
||||
}
|
||||
|
||||
$fdb_host = dbFetchRow('SELECT * FROM ports_fdb AS F, ipv4_mac AS M WHERE F.mac_address = ? AND M.mac_address = F.mac_address', array($entry['mac_address']));
|
||||
$response[] = array(
|
||||
'os' => $entry['os'],
|
||||
'mac_address' => formatMac($entry['mac_address']),
|
||||
'ipv4_address' => $fdb_host['ipv4_address'],
|
||||
'hostname' => generate_device_link($entry),
|
||||
'interface' => generate_port_link($entry, makeshortif(fixifname(cleanPort($entry['label'])))).' '.$error_img,
|
||||
'vlan' => $entry['vlan_vlan'],
|
||||
);
|
||||
}//end if
|
||||
|
||||
unset($ignore);
|
||||
}//end foreach
|
||||
|
||||
$output = array(
|
||||
'current' => $current,
|
||||
'rowCount' => $rowCount,
|
||||
'rows' => $response,
|
||||
'total' => $total,
|
||||
);
|
||||
echo _json_encode($output);
|
@@ -72,7 +72,6 @@ $menu_options['graphs'] = 'Graphs';
|
||||
$menu_options['realtime'] = 'Real time';
|
||||
// FIXME CONDITIONAL
|
||||
$menu_options['arp'] = 'ARP Table';
|
||||
$menu_options['fdb'] = 'FDB Table';
|
||||
$menu_options['events'] = 'Eventlog';
|
||||
$menu_options['notes'] = 'Notes';
|
||||
|
||||
|
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
$no_refresh = true;
|
||||
?>
|
||||
<table id="port-fdb" class="table table-condensed table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="mac_address">MAC address</th>
|
||||
<th data-column-id="ipv4_address">IPv4 Address</th>
|
||||
<th data-column-id="interface" data-sortable="false">Port</th>
|
||||
<th data-column-id="vlan" data-sortable="false">Vlan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
|
||||
var grid = $("#port-fdb").bootgrid({
|
||||
ajax: true,
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "fdb-search",
|
||||
device_id: "<?php echo $device['device_id']; ?>"
|
||||
};
|
||||
},
|
||||
url: "ajax_table.php"
|
||||
});
|
||||
</script>
|
||||
|
@@ -23,7 +23,6 @@ print_optionbar_start();
|
||||
$menu_options['basic'] = 'Basic';
|
||||
$menu_options['details'] = 'Details';
|
||||
$menu_options['arp'] = 'ARP Table';
|
||||
$menu_options['fdb'] = 'FDB Table';
|
||||
|
||||
if (dbFetchCell("SELECT * FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.port_id = L.local_port_id")) {
|
||||
$menu_options['neighbours'] = 'Neighbours';
|
||||
@@ -119,7 +118,7 @@ if ($vars['view'] == 'minigraphs') {
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
} elseif ($vars['view'] == 'arp' || $vars['view'] == 'adsl' || $vars['view'] == 'neighbours' || $vars['view'] == 'fdb') {
|
||||
} elseif ($vars['view'] == 'arp' || $vars['view'] == 'adsl' || $vars['view'] == 'neighbours') {
|
||||
include 'ports/'.$vars['view'].'.inc.php';
|
||||
} else {
|
||||
if ($vars['view'] == 'details') {
|
||||
|
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
$no_refresh = true;
|
||||
?>
|
||||
<table id="ports-fdb" class="table table-condensed table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="mac_address">MAC address</th>
|
||||
<th data-column-id="ipv4_address">IPv4 Address</th>
|
||||
<th data-column-id="interface">Port</th>
|
||||
<th data-column-id="vlan" data-sortable="false">Vlan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
|
||||
var grid = $("#ports-fdb").bootgrid({
|
||||
ajax: true,
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "fdb-search",
|
||||
device_id: "<?php echo $device['device_id']; ?>"
|
||||
};
|
||||
},
|
||||
url: "ajax_table.php"
|
||||
});
|
||||
</script>
|
||||
|
@@ -9,7 +9,6 @@ $sections = array(
|
||||
'ipv6' => 'IPv6 Address',
|
||||
'mac' => 'MAC Address',
|
||||
'arp' => 'ARP Table',
|
||||
'fdb' => 'FDB Table'
|
||||
);
|
||||
|
||||
if (dbFetchCell('SELECT 1 from `packages` LIMIT 1')) {
|
||||
|
@@ -1,97 +0,0 @@
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>FDB Entries</strong>
|
||||
</div>
|
||||
<table id="fdb-search" class="table table-hover table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="hostname" data-order="asc">Device</th>
|
||||
<th data-column-id="os" data-width="15%">Device OS</th>
|
||||
<th data-column-id="mac_address">MAC Address</th>
|
||||
<th data-column-id="ipv4_address" data-sortable="false">IPv4 Address</th>
|
||||
<th data-column-id="interface">Port</th>
|
||||
<th data-column-id="vlan">Vlan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var grid = $("#fdb-search").bootgrid({
|
||||
ajax: true,
|
||||
templates: {
|
||||
header: "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"><div class=\"row\">"+
|
||||
"<div class=\"col-sm-9 actionBar\"><span class=\"pull-left\">"+
|
||||
"<form method=\"post\" action=\"\" class=\"form-inline\" role=\"form\">"+
|
||||
"<div class=\"form-group\">"+
|
||||
"<select name=\"device_id\" id=\"device_id\" class=\"form-control input-sm\">"+
|
||||
"<option value=\"\">All Devices</option>"+
|
||||
<?php
|
||||
|
||||
// Select the devices only with FDB tables
|
||||
$sql = 'SELECT D.device_id AS device_id, `hostname` FROM `ports_fdb` AS F, `ports` AS P, `devices` AS D';
|
||||
|
||||
if (is_admin() === false && is_read() === false) {
|
||||
$sql .= ' LEFT JOIN `devices_perms` AS `DP` ON `D`.`device_id` = `DP`.`device_id`';
|
||||
$where .= ' AND `DP`.`user_id`=?';
|
||||
$param[] = $_SESSION['user_id'];
|
||||
}
|
||||
|
||||
$sql .= " WHERE F.port_id = P.port_id AND P.device_id = D.device_id $where GROUP BY `D`.`device_id`, `D`.`hostname` ORDER BY `hostname`";
|
||||
foreach (dbFetchRows($sql, $param) as $data) {
|
||||
echo '"<option value=\"'.$data['device_id'].'\""+';
|
||||
if ($data['device_id'] == $_POST['device_id']) {
|
||||
echo '" selected "+';
|
||||
}
|
||||
|
||||
echo '">'.format_hostname($data, $data['hostname']).'</option>"+';
|
||||
}
|
||||
?>
|
||||
"</select>"+
|
||||
"</div>"+
|
||||
"<div class=\"form-group\">"+
|
||||
"<select name=\"searchby\" id=\"searchby\" class=\"form-control input-sm\">"+
|
||||
"<option value=\"mac\" "+
|
||||
<?php
|
||||
if ($_POST['searchby'] == 'mac') {
|
||||
echo '" selected "+';
|
||||
}
|
||||
?>
|
||||
|
||||
">MAC Address</option>"+
|
||||
"<option value=\"vlan\" "+
|
||||
<?php
|
||||
if ($_POST['searchby'] == 'vlan') {
|
||||
echo '" selected "+';
|
||||
}
|
||||
?>
|
||||
|
||||
">Vlan</option>"+
|
||||
"</select>"+
|
||||
"</div>"+
|
||||
"<div class=\"form-group\">"+
|
||||
"<input type=\"text\" name=\"searchPhrase\" id=\"address\" value=\""+
|
||||
<?php
|
||||
echo '"'.$_POST['searchPhrase'].'"+';
|
||||
?>
|
||||
|
||||
"\" class=\"form-control input-sm\" placeholder=\"Value\" />"+
|
||||
"</div>"+
|
||||
"<button type=\"submit\" class=\"btn btn-default input-sm\">Search</button>"+
|
||||
"</form></span></div>"+
|
||||
"<div class=\"col-sm-3 actionBar\"><p class=\"{{css.actions}}\"></p></div></div></div>"
|
||||
},
|
||||
post: function ()
|
||||
{
|
||||
return {
|
||||
id: "fdb-search",
|
||||
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
|
||||
searchby: '<?php echo mres($_POST['searchby']); ?>',
|
||||
searchPhrase: '<?php echo mres($_POST['searchPhrase']); ?>'
|
||||
};
|
||||
},
|
||||
url: "ajax_table.php"
|
||||
});
|
||||
|
||||
</script>
|
@@ -783,7 +783,7 @@ $config['discovery_modules']['ntp'] = 1;
|
||||
$config['discovery_modules']['loadbalancers'] = 0;
|
||||
$config['discovery_modules']['mef'] = 0;
|
||||
$config['discovery_modules']['wireless'] = 1;
|
||||
$config['discovery_modules']['fdb-table'] = 1;
|
||||
|
||||
// Enable daily updates
|
||||
$config['update'] = 1;
|
||||
|
||||
|
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
|
||||
$os_filename = 'includes/discovery/fdb-table/' . $device['os'] . '.inc.php';
|
||||
|
||||
if (is_file($os_filename)) {
|
||||
// Build ifIndex to port_id dictionary
|
||||
$ifIndex_dict = array();
|
||||
foreach (dbFetchRows("SELECT `ifIndex`,`port_id` FROM `ports` WHERE `device_id` = ?", array($device['device_id'])) as $port_entry) {
|
||||
$ifIndex_dict[$port_entry['ifIndex']] = $port_entry['port_id'];
|
||||
}
|
||||
|
||||
// Build dot1dBasePort to port_id dictionary
|
||||
$portid_dict = array();
|
||||
|
||||
// Build a dictionary of vlans in database
|
||||
$vlans_dict = array();
|
||||
foreach (dbFetchRows("SELECT `vlan_id`, `vlan_vlan` from `vlans` WHERE `device_id` = ?", array($device['device_id'])) as $vlan_entry) {
|
||||
$vlans_dict[$vlan_entry['vlan_vlan']] = $vlan_entry['vlan_id'];
|
||||
}
|
||||
$vlans_by_id = array_flip($vlans_dict);
|
||||
|
||||
// Build table of existing vlan/mac table
|
||||
$existing_fdbs = array();
|
||||
$sql_result = dbFetchRows("SELECT * FROM `ports_fdb` WHERE `device_id` = ?", array($device['device_id']));
|
||||
foreach ($sql_result as $entry) {
|
||||
$existing_fdbs[$entry['vlan_id']][$entry['mac_address']] = $entry;
|
||||
}
|
||||
|
||||
// Include all fdb-table discovery modules
|
||||
$insert = array();
|
||||
include $os_filename;
|
||||
|
||||
$valid_fdb = array();
|
||||
|
||||
// synchronize with the database
|
||||
foreach ($insert as $vlan_id => $mac_address_table) {
|
||||
echo " {$vlans_by_id[$vlan_id]}: ";
|
||||
|
||||
foreach ($mac_address_table as $mac_address_entry => $entry) {
|
||||
if ($existing_fdbs[$vlan_id][$mac_address_entry]) {
|
||||
$new_port = $entry['port_id'];
|
||||
|
||||
if ($existing_fdbs[$vlan_id][$mac_address_entry]['port_id'] != $new_port) {
|
||||
$port_fdb_id = $existing_fdbs[$vlan_id][$mac_address_entry]['ports_fdb_id'];
|
||||
$valid_fdb[] = $port_fdb_id;
|
||||
|
||||
dbUpdate(
|
||||
array('port_id' => $new_port),
|
||||
'ports_fdb',
|
||||
'`ports_fdb_id` = ?',
|
||||
array($port_fdb_id)
|
||||
);
|
||||
echo 'U';
|
||||
} else {
|
||||
echo '.';
|
||||
}
|
||||
unset($existing_fdbs[$vlan_id][$mac_address_entry]);
|
||||
} else {
|
||||
$new_entry = array(
|
||||
'port_id' => $entry['port_id'],
|
||||
'mac_address' => $mac_address_entry,
|
||||
'vlan_id' => $vlan_id,
|
||||
'device_id' => $device['device_id'],
|
||||
);
|
||||
|
||||
$valid_fdb = dbInsert($new_entry, 'ports_fdb');
|
||||
echo '+';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($existing_fdbs[$vlan_id] as $entry) {
|
||||
dbDelete('ports_fdb', '`ports_fdb_id` = ?', array($entry['ports_fdb_id']));
|
||||
echo '-';
|
||||
}
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
unset($existing_fdbs, $ifIndex_dict, $portid_dict, $vlans_dict);
|
||||
}
|
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
echo 'Comware:';
|
||||
|
||||
// find fdb entries, output like
|
||||
// dot1qTpFdbPort[507][0:24:c4:fd:a1:c7] 1
|
||||
$fdbPort_table = snmp_walk($device, 'dot1qTpFdbEntry', '-OqsX', 'Q-BRIDGE-MIB');
|
||||
|
||||
// find port ids, output like
|
||||
// dot1dBasePortIfIndex[1] 1
|
||||
$dot1dBasePortIfIndex = snmp_walk($device, 'dot1dBasePortIfIndex', '-OqsX', 'BRIDGE-MIB');
|
||||
|
||||
foreach (explode("\n", $dot1dBasePortIfIndex) as $dot1dBasePortIfIndex_entry) {
|
||||
if (!empty($dot1dBasePortIfIndex_entry)) {
|
||||
$port = explode(' ', $dot1dBasePortIfIndex_entry);
|
||||
$strTemp = explode('[', $port[0]);
|
||||
$portLocal = rtrim($strTemp[1], ']');
|
||||
$portid_dict[$portLocal] = $ifIndex_dict[$port[1]];
|
||||
}
|
||||
}
|
||||
|
||||
foreach (explode("\n", $fdbPort_table) as $fdbPort_entry) {
|
||||
preg_match('~(?P<oid>\w+)\[(?P<vlan>\d+)]\[(?P<mac>[\w:-]+)]\s(?P<port>\d+)~', $fdbPort_entry, $matches);
|
||||
if (!empty($matches)) {
|
||||
$port = $matches['port'];
|
||||
$mac = $matches['mac'];
|
||||
$vlan = $matches['vlan'];
|
||||
$vlan_id = $vlans_dict[$vlan];
|
||||
echo " $vlan";
|
||||
|
||||
if (!empty($mac)) {
|
||||
list($oct_1, $oct_2, $oct_3, $oct_4, $oct_5, $oct_6) = explode(':', $mac);
|
||||
$mac_address = zeropad($oct_1) . zeropad($oct_2) . zeropad($oct_3) . zeropad($oct_4) . zeropad($oct_5) . zeropad($oct_6);
|
||||
if (strlen($mac_address) != 12) {
|
||||
echo 'Mac Address padding failed';
|
||||
continue;
|
||||
} else {
|
||||
$dot1dBasePort = $port;
|
||||
$insert[$vlan_id][$mac_address]['port_id'] = $portid_dict[$dot1dBasePort];
|
||||
d_echo("vlan $vlan mac $mac_address port ($port) " . $portid_dict[$dot1dBasePort] . PHP_EOL);
|
||||
}
|
||||
} // end if on empty mac
|
||||
} // end if on matches
|
||||
} // end loop on fdbPort_entry
|
||||
|
||||
echo PHP_EOL;
|
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
$vtpdomains = snmpwalk_cache_oid($device, 'vlanManagementDomains', array(), 'CISCO-VTP-MIB');
|
||||
$vlans = snmpwalk_cache_twopart_oid($device, 'vtpVlanEntry', array(), 'CISCO-VTP-MIB');
|
||||
|
||||
foreach ($vtpdomains as $vtpdomain_id => $vtpdomain) {
|
||||
echo "VTP Domain $vtpdomain_id {$vtpdomain['managementDomainName']}> ";
|
||||
foreach ($vlans[$vtpdomain_id] as $vlan_raw => $vlan) {
|
||||
echo "$vlan_raw ";
|
||||
if (!array_key_exists($vlan_raw, $vlans_dict)) {
|
||||
$newvlan_id = dbInsert(array(
|
||||
'device_id' => $device['device_id'],
|
||||
'vlan_domain' => $vtpdomain_id,
|
||||
'vlan_vlan' => $vlan_raw,
|
||||
'vlan_name' => $vlan['vtpVlanName'],
|
||||
'vlan_type' => $vlan['vtpVlanType']
|
||||
), 'vlans');
|
||||
$vlans_dict[$vlan_raw] = $newvlan_id;
|
||||
}
|
||||
|
||||
if ($vlan['vtpVlanState'] == 'operational') {
|
||||
$device_vlan = $device;
|
||||
$device_vlan['context_name'] = $vlan_raw;
|
||||
$FdbPort_table = snmp_walk($device_vlan, 'dot1dTpFdbPort', '-OqsX', 'BRIDGE-MIB');
|
||||
if (empty($FdbPort_table)) {
|
||||
// If there are no entries for the vlan, continue
|
||||
unset($device_vlan);
|
||||
continue;
|
||||
}
|
||||
|
||||
$dot1dBasePortIfIndex = snmp_walk($device_vlan, 'dot1dBasePortIfIndex', '-OqsX', 'BRIDGE-MIB');
|
||||
|
||||
foreach (explode("\n", $dot1dBasePortIfIndex) as $dot1dBasePortIfIndex_entry) {
|
||||
if (!empty($dot1dBasePortIfIndex_entry)) {
|
||||
preg_match('~dot1dBasePortIfIndex\[(\d+)]\s(\d+)~', $dot1dBasePortIfIndex_entry, $matches);
|
||||
$portid_dict[$matches[1]] = $ifIndex_dict[$matches[2]];
|
||||
}
|
||||
}
|
||||
|
||||
foreach (explode("\n", $FdbPort_table) as $FdbPort_entry) {
|
||||
preg_match('~(?P<oid>\w+)\[(?P<mac>[\w:-]+)]\s(?P<result>\w.*)~', $FdbPort_entry, $matches);
|
||||
if (! empty($matches)) {
|
||||
list($oct_1, $oct_2, $oct_3, $oct_4, $oct_5, $oct_6) = explode(':', $matches['mac']);
|
||||
$mac_address = zeropad($oct_1) . zeropad($oct_2) . zeropad($oct_3) . zeropad($oct_4) . zeropad($oct_5) . zeropad($oct_6);
|
||||
if (strlen($mac_address) != 12) {
|
||||
echo 'Mac Address padding failed';
|
||||
continue;
|
||||
} else {
|
||||
$vlan_id = $vlans_dict[$vlan_raw];
|
||||
$dot1dBasePort = $matches['result'];
|
||||
$insert[$vlan_id][$mac_address]['port_id'] = $portid_dict[$dot1dBasePort];
|
||||
d_echo("vlan $vlan_raw - mac $mac_address - port ($port) ".$portid_dict[$dot1dBasePort]."\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($device_vlan);
|
||||
} //end if operational
|
||||
} // end for each vlan
|
||||
echo PHP_EOL;
|
||||
} // end for each vlan domain
|
@@ -666,6 +666,7 @@ function snmp_cache_port_oids($oids, $port, $device, $array, $mib = 0)
|
||||
return $array;
|
||||
}//end snmp_cache_port_oids()
|
||||
|
||||
|
||||
function snmp_gen_auth(&$device)
|
||||
{
|
||||
global $debug, $vdebug;
|
||||
@@ -702,9 +703,6 @@ function snmp_gen_auth(&$device)
|
||||
} elseif ($device['snmpver'] === 'v2c' or $device['snmpver'] === 'v1') {
|
||||
$cmd = " -".$device['snmpver'];
|
||||
$cmd .= " -c '".$device['community']."'";
|
||||
if (isset($device['context_name'])) {
|
||||
$cmd .= '@' . $device['context_name'];
|
||||
}
|
||||
} else {
|
||||
if ($debug) {
|
||||
print 'DEBUG: '.$device['snmpver']." : Unsupported SNMP Version (shouldn't be possible to get here)\n";
|
||||
|
@@ -1126,16 +1126,6 @@ ports_adsl:
|
||||
port_id: { Field: port_id, Type: int(11), 'Null': false, Default: null, Extra: '' }
|
||||
Indexes:
|
||||
interface_id: { Name: interface_id, Columns: [port_id], Unique: true, Type: BTREE }
|
||||
ports_fdb:
|
||||
Columns:
|
||||
device_id: { Field: device_id, Type: 'int(11) unsigned', 'Null': false, Default: null, Extra: '' }
|
||||
mac_address: { Field: mac_address, Type: varchar(32), 'Null': false, Default: null, Extra: '' }
|
||||
ports_fdb_id: { Field: ports_fdb_id, Type: bigint(20), 'Null': false, Default: null, Extra: auto_increment }
|
||||
port_id: { Field: port_id, Type: 'int(11) unsigned', 'Null': false, Default: null, Extra: '' }
|
||||
vlan_id: { Field: vlan_id, Type: 'int(11) unsigned', 'Null': false, Default: null, Extra: '' }
|
||||
Indexes:
|
||||
PRIMARY: { Name: PRIMARY, Columns: [ports_fdb_id], Unique: true, Type: BTREE }
|
||||
mac_address: { Name: mac_address, Columns: [mac_address], Unique: false, Type: BTREE }
|
||||
ports_perms:
|
||||
Columns:
|
||||
access_level: { Field: access_level, Type: int(11), 'Null': false, Default: null, Extra: '' }
|
||||
|
@@ -1,2 +0,0 @@
|
||||
CREATE TABLE `ports_fdb` ( `ports_fdb_id` BIGINT(20) PRIMARY KEY NOT NULL AUTO_INCREMENT, `port_id` INT(11) unsigned NOT NULL, `mac_address` VARCHAR(32) NOT NULL, `vlan_id` INT(11) unsigned NOT NULL, `device_id` INT(11) unsigned NOT NULL);
|
||||
ALTER TABLE `ports_fdb` ADD INDEX ( `mac_address` );
|
Reference in New Issue
Block a user