Merge "Fix bug 171. EchoReply payload must be the same as the correspoding EchoReques...
authorEd Warnicke <eaw@cisco.com>
Thu, 28 Nov 2013 20:28:26 +0000 (20:28 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 28 Nov 2013 20:28:26 +0000 (20:28 +0000)
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java

index 6fddef06a8388a80a5278ce2f9a3234ae4461982..ed79d5c5a8f88a585dac9363478e6870bc77889c 100644 (file)
@@ -38,6 +38,7 @@ import org.opendaylight.controller.protocol_plugin.openflow.core.ISwitch;
 import org.openflow.protocol.OFBarrierReply;
 import org.openflow.protocol.OFBarrierRequest;
 import org.openflow.protocol.OFEchoReply;
+import org.openflow.protocol.OFEchoRequest;
 import org.openflow.protocol.OFError;
 import org.openflow.protocol.OFFeaturesReply;
 import org.openflow.protocol.OFFlowMod;
@@ -371,6 +372,12 @@ public class SwitchHandler implements ISwitch {
                 break;
             case ECHO_REQUEST:
                 OFEchoReply echoReply = (OFEchoReply) factory.getMessage(OFType.ECHO_REPLY);
+
+                // the EchoReply must have the same payload as the request
+                byte []payload = ((OFEchoRequest)msg).getPayload();
+                echoReply.setPayload(payload);
+                echoReply.setLength( (short) (echoReply.getLength() + payload.length ));
+
                 // respond immediately
                 asyncSendNow(echoReply, msg.getXid());