From 34f7bb31eb213bfb775d82d685f3c1af90e75a28 Mon Sep 17 00:00:00 2001
From: Saurav Das <saurav.das@bigswitch.com>
Date: Fri, 1 Mar 2013 09:31:42 -0800
Subject: [PATCH] Small bug fixes in link discovery

---
 .../linkdiscovery/internal/LinkDiscoveryManager.java      | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index 1b321a99c..53cbb3ac8 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -595,9 +595,9 @@ public class LinkDiscoveryManager implements IOFMessageListener,
         if (!isIncomingDiscoveryAllowed(sw, inPort, isStandard))
             return Command.STOP;
 
-        // If this is a malformed LLDP, or not from us, exit
+        // If this is a malformed LLDP exit
         if (lldp.getPortId() == null || lldp.getPortId().getLength() != 3) {
-            return Command.CONTINUE;
+            return Command.STOP;
         }
 
         long myId = ByteBuffer.wrap(controllerTLV.getValue()).getLong();
@@ -636,8 +636,7 @@ public class LinkDiscoveryManager implements IOFMessageListener,
         if (myLLDP == false) {
             // This is not the LLDP sent by this controller.
             // If the LLDP message has multicast bit set, then we need to
-            // broadcast
-            // the packet as a regular packet.
+            // broadcast the packet as a regular packet (after checking IDs)
             if (isStandard) {
                 if (log.isTraceEnabled()) {
                     log.trace("Got a standard LLDP=[{}]. Not fowarding it.", lldp.toString());
@@ -650,6 +649,7 @@ public class LinkDiscoveryManager implements IOFMessageListener,
                 }
                 return Command.CONTINUE;
             }
+            return Command.STOP;
         }
 
         if (remoteSwitch == null) {
-- 
GitLab