Bugfix for all broadcast packet-ins being dropped.
Device manager was changed to drop packet-ins with a broadcast destination
address, but the correct behaviour is to drop packet-ins with a broadcast
source address.
Change-Id: Ie6a15486d6447ab0570e3e027732bde323af5e02
diff --git a/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java b/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java
index f1cc8f7..2f56682 100644
--- a/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java
+++ b/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java
@@ -253,19 +253,17 @@
protected OnosDevice getSourceDeviceFromPacket(Ethernet eth,
long swdpid,
short port) {
- byte[] dlAddrArr = eth.getSourceMACAddress();
- long dlAddr = Ethernet.toLong(dlAddrArr);
+ long dlAddr = Ethernet.toLong(eth.getSourceMACAddress());
+ MACAddress sourceMac = eth.getSourceMAC();
- /*
- * Ignore broadcast/multicast source
- */
- if (eth.isMulticast() || eth.isBroadcast()) {
+ // Ignore broadcast/multicast source
+ if (sourceMac.isBroadcast() || sourceMac.isBroadcast()) {
return null;
}
short vlan = eth.getVlanID();
int nwSrc = getSrcNwAddr(eth, dlAddr);
- return new OnosDevice(MACAddress.valueOf(dlAddr),
+ return new OnosDevice(sourceMac,
((vlan >= 0) ? vlan : null),
((nwSrc != 0) ? nwSrc : null),
swdpid,
diff --git a/src/test/java/net/onrc/onos/core/devicemanager/OnosDeviceManagerTest.java b/src/test/java/net/onrc/onos/core/devicemanager/OnosDeviceManagerTest.java
index fc0a008..b87badc 100644
--- a/src/test/java/net/onrc/onos/core/devicemanager/OnosDeviceManagerTest.java
+++ b/src/test/java/net/onrc/onos/core/devicemanager/OnosDeviceManagerTest.java
@@ -109,11 +109,11 @@
odm = new OnosDeviceManager();
/*
- * Broadcast address
+ * Broadcast source address
*/
this.pkt0 = new Ethernet()
- .setDestinationMACAddress("FF:FF:FF:FF:FF:FF")
- .setSourceMACAddress("00:44:33:22:11:33")
+ .setDestinationMACAddress("00:44:33:22:11:33")
+ .setSourceMACAddress("FF:FF:FF:FF:FF:FF")
.setEtherType(Ethernet.TYPE_IPV4)
.setPayload(
new IPv4()