From 0cb6c957acb4241d2e4ec123a51abaead7b29be7 Mon Sep 17 00:00:00 2001 From: Adam Young Date: Thu, 2 Nov 2023 08:27:13 -0700 Subject: [PATCH] req and response are no longer expected to be symmetrical Signed-off-by: Adam Young --- src/mctp-req.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/mctp-req.c b/src/mctp-req.c index 45226ef..88a4e5d 100644 --- a/src/mctp-req.c +++ b/src/mctp-req.c @@ -87,7 +87,10 @@ static int mctp_req(unsigned int net, mctp_eid_t eid, (struct sockaddr *)&addr, &addrlen); if (rc < 0) err(EXIT_FAILURE, "recvfrom"); - else if ((size_t)rc != len) + + //For a real query, the reponse will likely be longer than + //The request. + else if ((size_t)rc < len) errx(EXIT_FAILURE, "unexpected length: got %d, exp %zd", rc, len); @@ -109,14 +112,17 @@ static int mctp_req(unsigned int net, mctp_eid_t eid, addr.smctp_haddr[0], addr.smctp_halen); } - for (i = 0; i < len; i++) { - uint8_t exp = data ? data[i] : i & 0xff; - if (rxbuf[i] != exp) - errx(EXIT_FAILURE, - "payload mismatch at byte 0x%zx; " - "sent 0x%02x, received 0x%02x", - i, exp, rxbuf[i]); + for (int j = 0; j < rc; j++) { + //uint8_t exp = data ? data[i] : i & 0xff; + + printf("0x%02x ", rxbuf[j]); + //if (rxbuf[i] != exp) + // errx(EXIT_FAILURE, + // "payload mismatch at byte 0x%zx; " + // "sent 0x%02x, received 0x%02x", + // i, exp, rxbuf[i]); } + printf("\n"); return 0; }