Skip to content
Snippets Groups Projects
Commit c5e61ead authored by Shudong Zhou's avatar Shudong Zhou
Browse files

Warn if programming a flow with broadcast as destination

parent 8cac6a2e
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@ package net.floodlightcontroller.core.internal;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -150,6 +151,18 @@ public class OFSwitchImpl implements IOFSwitch {
}
public void write(OFMessage m, FloodlightContext bc) throws IOException {
if (m instanceof OFFlowMod) {
byte[] bcast = new byte[] {-1, -1, -1, -1, -1, -1};
OFFlowMod fm = (OFFlowMod) m;
OFMatch match = fm.getMatch();
// Warn if programming a flow matching broadcast destination
if ((match.getWildcards() & OFMatch.OFPFW_DL_DST) == 0 &&
Arrays.equals(match.getDataLayerDestination(), bcast)) {
log.warn("Programming flow with -1 destination addr");
log.warn("swId {}, stack trace {}",
stringId, new Exception().getStackTrace());
}
}
Map<OFSwitchImpl,List<OFMessage>> msg_buffer_map = local_msg_buffer.get();
List<OFMessage> msg_buffer = msg_buffer_map.get(this);
if (msg_buffer == null) {
......
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