From 8ad4a831a2bc1d8d1a3e7266bd92869a0dbe8a32 Mon Sep 17 00:00:00 2001
From: Ryan Izard <ryan.izard@bigswitch.com>
Date: Wed, 10 Aug 2016 18:04:39 -0400
Subject: [PATCH] Check special ports using loxi, not using bitmasks

---
 .../topology/TopologyManager.java                | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
index 77dcc9651..8192e3366 100644
--- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
+++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
@@ -297,8 +297,20 @@ ITopologyManagerBackend, ILinkDiscoveryListener, IOFMessageListener {
             return false;
 
         // Check whether the port is a physical port. We should not learn
-        // attachment points on "special" ports.
-        if ((port.getShortPortNumber() & 0xff00) == 0xff00 && port.getShortPortNumber() != (short)0xfffe) return false;
+        // attachment points on "special" ports. Exclude LOCAL, where devices
+        // might live if they are on the switch OS itself
+        if (port.equals(OFPort.ALL) || 
+                port.equals(OFPort.CONTROLLER) || 
+                port.equals(OFPort.ANY) ||
+                port.equals(OFPort.FLOOD) ||
+                port.equals(OFPort.ZERO) ||
+                port.equals(OFPort.NO_MASK) ||
+                port.equals(OFPort.IN_PORT) ||
+                port.equals(OFPort.NORMAL) ||
+                port.equals(OFPort.TABLE)
+                ) {
+            return false;
+        }
 
         // Make sure that the port is enabled.
         IOFSwitch sw = switchService.getActiveSwitch(switchid);
-- 
GitLab