X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Fcore%2Finternal%2FSwitchHandler.java;h=7a177fa078c8607e41bb2fa62f9ea6c2c8b7d032;hb=cdeca662c72dd78f39d7503c3c06ccfde9e4c51b;hp=6fddef06a8388a80a5278ce2f9a3234ae4461982;hpb=d542617f3486541cf9937009fb6aa1e3f2c9f0e2;p=controller.git diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java index 6fddef06a8..7a177fa078 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java @@ -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; @@ -60,6 +61,7 @@ import org.openflow.util.HexString; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + public class SwitchHandler implements ISwitch { private static final Logger logger = LoggerFactory.getLogger(SwitchHandler.class); private static final int SWITCH_LIVENESS_TIMER = 5000; @@ -371,6 +373,14 @@ public class SwitchHandler implements ISwitch { break; case ECHO_REQUEST: OFEchoReply echoReply = (OFEchoReply) factory.getMessage(OFType.ECHO_REPLY); + + byte []payload = ((OFEchoRequest)msg).getPayload(); + if (payload != null && payload.length != 0 ) { + // the response must have the same payload as the request + echoReply.setPayload(payload); + echoReply.setLength( (short)(echoReply.getLength() + payload.length) ); + } + // respond immediately asyncSendNow(echoReply, msg.getXid());