From a10de38e324eee14e38f7b9a4b9b265343b2f96d Mon Sep 17 00:00:00 2001
From: Mike Hibler <hibler@cs.utah.edu>
Date: Tue, 16 Oct 2012 13:45:34 -0600
Subject: [PATCH] Fix getTrunkHash to return switch+card+port info in the
 traditional format.

Also, a little more debug in switchmac.
---
 tbsetup/snmpit_test/snmpit_lib.pm | 3 ++-
 tbsetup/switchmac.in              | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tbsetup/snmpit_test/snmpit_lib.pm b/tbsetup/snmpit_test/snmpit_lib.pm
index 1a92ee36de..395fc8bda8 100644
--- a/tbsetup/snmpit_test/snmpit_lib.pm
+++ b/tbsetup/snmpit_test/snmpit_lib.pm
@@ -1606,7 +1606,8 @@ sub getTrunkHash() {
     foreach my $switch1 (keys %trunks) {
         foreach my $switch2 (keys %{$trunks{$switch1}}) {
             foreach my $port (@{$trunks{$switch1}{$switch2}}) {
-                my $portstr = "$switch1/$port";
+                # XXX backward compat
+                my $portstr = "$switch1/".$port->card().".".$port->port();
                 $trunkhash{$portstr} = 1;
             }
         }
diff --git a/tbsetup/switchmac.in b/tbsetup/switchmac.in
index c1ee6a2559..3e71cf4466 100644
--- a/tbsetup/switchmac.in
+++ b/tbsetup/switchmac.in
@@ -156,6 +156,7 @@ if (@test_switches > 0) {
 # Get trunk ports so that we can skip MACs learned on them
 #
 my %trunks = getTrunkHash();
+DEBUG "found trunk ports: ", join(' ', keys(%trunks)), "\n";
 
 if (@control_switches > 0) {
     if ($control_switches[0] eq "none") {
-- 
GitLab