Skip to content
Snippets Groups Projects
Commit cc27f929 authored by Alex Reimers's avatar Alex Reimers
Browse files

Check for the correct MAC address size when getting a device from DeviceManager.

parent 74001a2c
No related branches found
No related tags found
No related merge requests found
...@@ -1242,6 +1242,7 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe ...@@ -1242,6 +1242,7 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe
@Override @Override
public Device getDeviceByDataLayerAddress(byte[] address) { public Device getDeviceByDataLayerAddress(byte[] address) {
if (address.length != Ethernet.DATALAYER_ADDRESS_LENGTH) return null;
return getDeviceByDataLayerAddress(Ethernet.toLong(address)); return getDeviceByDataLayerAddress(Ethernet.toLong(address));
} }
......
...@@ -37,6 +37,7 @@ public class Ethernet extends BasePacket { ...@@ -37,6 +37,7 @@ public class Ethernet extends BasePacket {
public static final short TYPE_BSN = (short) 0x8950; // Not officially assigned public static final short TYPE_BSN = (short) 0x8950; // Not officially assigned
public static final short VLAN_UNTAGGED = (short)0xffff; public static final short VLAN_UNTAGGED = (short)0xffff;
public static final short TYPE_BDDP = (short) 0x8999; public static final short TYPE_BDDP = (short) 0x8999;
public static final short DATALAYER_ADDRESS_LENGTH = 6; // bytes
public static Map<Short, Class<? extends IPacket>> etherTypeClassMap; public static Map<Short, Class<? extends IPacket>> etherTypeClassMap;
static { static {
......
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