diff --git a/src/mctpd.c b/src/mctpd.c index cd2b527..4d532e3 100644 --- a/src/mctpd.c +++ b/src/mctpd.c @@ -1233,6 +1233,10 @@ handle_control_endpoint_discovery(struct ctx *ctx, int sd, return 0; } + req = (void *)buf; + resp = (void *)resp; + mctp_ctrl_msg_hdr_init_resp(&resp->ctrl_hdr, *req); + if (link_data->discovered == DISCOVERY_UNSUPPORTED) { resp->completion_code = MCTP_CTRL_CC_ERROR_INVALID_DATA; return reply_message(ctx, sd, resp, @@ -1244,10 +1248,6 @@ handle_control_endpoint_discovery(struct ctx *ctx, int sd, return 0; } - req = (void *)buf; - resp = (void *)resp; - mctp_ctrl_msg_hdr_init_resp(&resp->ctrl_hdr, *req); - // we need to send using physical addressing, no entry in routing table yet return reply_message_phys(ctx, sd, resp, sizeof(*resp), addr); }