From 44cb860224de5c23922a4984b153fa3f365c901f Mon Sep 17 00:00:00 2001
From: Srinivasan Ramasubramanian <srini@bigswitch.com>
Date: Thu, 21 Jun 2012 12:16:24 -0700
Subject: [PATCH] If a standard LLDP comes from a different network, we should
 drop it.  The standard LLDP mac address could be :00, :03, :0e.

---
 .../internal/LinkDiscoveryManager.java        | 23 ++++++++++++++-----
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index 306f97029..294f0935b 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -144,6 +144,12 @@ public class LinkDiscoveryManager
     protected SingletonTask sendLLDPTask;
     private static final byte[] LLDP_STANDARD_DST_MAC_STRING = 
     		HexString.fromHexString("01:80:c2:00:00:0e");
+    private static final byte[] LLDP_STANDARD_DST_MAC_STRING_00 =
+            HexString.fromHexString("01:80:c2:00:00:00");
+    private static final byte[] LLDP_STANDARD_DST_MAC_STRING_03 =
+            HexString.fromHexString("01:80:c2:00:00:03");
+    private static final byte[] LLDP_STANDARD_DST_MAC_STRING_0E =
+            HexString.fromHexString("01:80:c2:00:00:0e");
     // BigSwitch OUI is 5C:16:C7, so 5D:16:C7 is the multicast version
     // private static final String LLDP_BSN_DST_MAC_STRING = "5d:16:c7:00:00:01";
     private static final String LLDP_BSN_DST_MAC_STRING = "ff:ff:ff:ff:ff:ff";
@@ -548,13 +554,18 @@ public class LinkDiscoveryManager
             return handleLldp((LLDP) eth.getPayload(), sw, pi, false, cntx);
         } else if (eth.getEtherType() == Ethernet.TYPE_LLDP)  {
             return handleLldp((LLDP) eth.getPayload(), sw, pi, true, cntx);
-        } else if (eth.getEtherType() < 1500 &&
-        		   Arrays.equals(eth.getDestinationMACAddress(),
-        				   	     LLDP_STANDARD_DST_MAC_STRING)) {
-        	// drop any other link discovery/spanning tree protocols
-        	return Command.STOP;
+        } else if (eth.getEtherType() < 1500) {
+            if (Arrays.equals(eth.getDestinationMACAddress(),
+                              LLDP_STANDARD_DST_MAC_STRING_00) ||
+                Arrays.equals(eth.getDestinationMACAddress(),
+                              LLDP_STANDARD_DST_MAC_STRING_03) ||
+                Arrays.equals(eth.getDestinationMACAddress(),
+                              LLDP_STANDARD_DST_MAC_STRING_0E)) {
+                // drop any other link discovery/spanning tree protocols
+                return Command.STOP;
+            }
         }
-        
+
         return Command.CONTINUE;
     }
 
-- 
GitLab