projects
/
dell-switch
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f75770b
)
warning about switches with same mac, take first one
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sun, 31 Jul 2022 07:19:34 +0000
(09:19 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sun, 31 Jul 2022 07:19:34 +0000
(09:19 +0200)
neighbours.pl
patch
|
blob
|
history
diff --git
a/neighbours.pl
b/neighbours.pl
index
b99a352
..
8e42b9c
100755
(executable)
--- a/
neighbours.pl
+++ b/
neighbours.pl
@@
-19,7
+19,13
@@
while(<$f>) {
#my ( $ip, $name, $mac ) = split(/ /,$_);
my ( $name, $mac ) = split(/ /,$_);
$mac = lc($mac);
- $mac2name->{$mac} = $name;
+ if ( defined $mac2name->{$mac} ) {
+ if ( $mac2name->{$mac} ne $name ) {
+ warn "ERROR: GOT $mac with $mac2name->{$mac} and now trying to overwrite it with $name\n";
+ }
+ } else {
+ $mac2name->{$mac} = $name;
+ }
}
sub mac2name {