From f93f5e8e2c908f295f29b439ca1f1628def251cf Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 27 Sep 2017 22:31:30 -0400 Subject: [PATCH] Workaround switches that report ifindex in bridge (#4019) Some switches report ifindex instead of bridge index. This is not compliant behavior. However, we can detect that every last mac was a dead end, and assume this is the case to try to get better result. This won't work if there is overlap in interface and bridge indexes, so in that case, the spec compliant behavior is assumed. --- perl-xCAT/xCAT/MacMap.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index 103ef87d4..fe58b585e 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -878,6 +878,21 @@ sub refresh_switch { } return; } + my $bridgeifvalid = 0; + foreach (keys %$mactoindexmap) { + my $index = $mactoindexmap->{$_}; + if (defined($bridgetoifmap->{$index})) { + $bridgeifvalid = 1; + last; + } + } + unless ($bridgeifvalid) { + # create a dummy bridgetoifmap to cover switches that thing it should go straight to ifindex + $bridgetoifmap = {}; + foreach (keys %$namemap) { + $bridgetoifmap->{$_} = $_; + } + } if (defined($self->{collect_mac_info})) { my %index_to_mac = (); my %index_to_vlan = ();