diff --git a/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java b/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
index 068db2550716a1a68e210d851175ddcdc56aea62..9b8299466a966b556ea17676e14025b93b7e0aa1 100644
--- a/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
+++ b/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java
@@ -250,7 +250,9 @@ public abstract class ForwardingBase implements IOFMessageListener {
             // set input and output ports on the switch
             OFPort outPort = switchPortList.get(indx).getPortId();
             OFPort inPort = switchPortList.get(indx - 1).getPortId();
-            mb.setExact(MatchField.IN_PORT, inPort);
+            if (FLOWMOD_DEFAULT_MATCH_IN_PORT) {
+                mb.setExact(MatchField.IN_PORT, inPort);
+            }
             aob.setPort(outPort);
             aob.setMaxLen(Integer.MAX_VALUE);
             actions.add(aob.build());