Skip to content
Snippets Groups Projects
Commit 0da98ce4 authored by Ryan Izard's avatar Ryan Izard
Browse files

Fixed a tough bug in MatchUtils. OFPorts are integers in OF1.3, but those who...

Fixed a tough bug in MatchUtils. OFPorts are integers in OF1.3, but those who specify local, controller, etc. as 65534, etc. will not work with OF1.3. This is a temporary fix and should be fixed properly to allow the full range of ports.
parent 71fa2c26
No related branches found
No related tags found
No related merge requests found
......@@ -431,7 +431,8 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
try {
fmb.setMatch(MatchUtils.fromString(match, fmb.getVersion()));
} catch (IllegalArgumentException e) {
log.debug("Ignoring flow entry {} on switch {} with illegal OFMatch() key: " + match, entryName, switchName);
log.error(e.toString());
log.error("Ignoring flow entry {} on switch {} with illegal OFMatch() key: " + match, entryName, switchName);
return;
} catch (Exception e) {
log.error("OF version incompatible for the match: " + match);
......
......@@ -24,6 +24,7 @@ import org.projectfloodlight.openflow.types.OFPort;
import org.projectfloodlight.openflow.types.OFVlanVidMatch;
import org.projectfloodlight.openflow.types.OFVlanVidMatchWithMask;
import org.projectfloodlight.openflow.types.TransportPort;
import org.projectfloodlight.openflow.types.U16;
import org.projectfloodlight.openflow.types.U32;
import org.projectfloodlight.openflow.types.U64;
import org.projectfloodlight.openflow.types.U8;
......@@ -387,10 +388,10 @@ public class MatchUtils {
switch (key_value[0]) {
case STR_IN_PORT:
if (dataMask.length == 1) {
mb.setExact(MatchField.IN_PORT, OFPort.of(dataMask[0].contains("0x") ? Integer.valueOf(dataMask[0].replaceFirst("0x", ""), 16) : Integer.valueOf(dataMask[0])));
mb.setExact(MatchField.IN_PORT, OFPort.ofShort(dataMask[0].contains("0x") ? U16.of(Integer.valueOf(dataMask[0].replaceFirst("0x", ""), 16)).getRaw() : U16.of(Integer.valueOf(dataMask[0])).getRaw()));
} else {
mb.setMasked(MatchField.IN_PORT, OFPort.of(dataMask[0].contains("0x") ? Integer.valueOf(dataMask[0].replaceFirst("0x", ""), 16) : Integer.valueOf(dataMask[0])),
OFPort.of(dataMask[1].contains("0x") ? Integer.valueOf(dataMask[1].replaceFirst("0x", ""), 16) : Integer.valueOf(dataMask[1])));
mb.setMasked(MatchField.IN_PORT, OFPort.ofShort(dataMask[0].contains("0x") ? U16.of(Integer.valueOf(dataMask[0].replaceFirst("0x", ""), 16)).getRaw() : U16.of(Integer.valueOf(dataMask[0])).getRaw()),
OFPort.ofShort(dataMask[1].contains("0x") ? U16.of(Integer.valueOf(dataMask[1].replaceFirst("0x", ""), 16)).getRaw() : U16.of(Integer.valueOf(dataMask[1])).getRaw()));
}
break;
case STR_DL_DST: /* Only accept hex-string for MAC addresses */
......
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