Skip to content
Snippets Groups Projects
Commit e24b8ce5 authored by Srinivasan Ramasubramanian's avatar Srinivasan Ramasubramanian
Browse files

Merge pull request #185 from sriniram/master

Link discovery must ignore all externally-generated link-local frames.
parents 8671b6af 4cca8f3e
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,6 @@ import java.net.NetworkInterface;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
......@@ -140,16 +139,13 @@ public class LinkDiscoveryManager
protected IFloodlightProviderService floodlightProvider;
protected IStorageSourceService storageSource;
protected IThreadPoolService threadPool;
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");
private static final long LINK_LOCAL_MASK = 0xfffffffffff0L;
private static final long LINK_LOCAL_VALUE = 0x0180c2000000L;
// 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";
......@@ -555,17 +551,15 @@ public class LinkDiscoveryManager
} else if (eth.getEtherType() == Ethernet.TYPE_LLDP) {
return handleLldp((LLDP) eth.getPayload(), sw, pi, true, cntx);
} 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
long destMac = eth.getDestinationMAC().toLong();
if ((destMac & LINK_LOCAL_MASK) == LINK_LOCAL_VALUE){
if (log.isTraceEnabled()) {
log.trace("Ignoring packet addressed to 802.1D/Q " +
"reserved address.");
}
return Command.STOP;
}
}
return Command.CONTINUE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment