Skip to content

Commit e5f19d7

Browse files
author
Adam Young
committed
req and response are no longer expected to be symmetrical
1 parent be1802f commit e5f19d7

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/mctp-req.c

+14-8
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ static int mctp_req(unsigned int net, mctp_eid_t eid,
8787
(struct sockaddr *)&addr, &addrlen);
8888
if (rc < 0)
8989
err(EXIT_FAILURE, "recvfrom");
90-
else if ((size_t)rc != len)
90+
91+
//For a real query, the reponse will likely be longer than
92+
//The request.
93+
else if ((size_t)rc < len)
9194
errx(EXIT_FAILURE, "unexpected length: got %d, exp %zd",
9295
rc, len);
9396

@@ -109,14 +112,17 @@ static int mctp_req(unsigned int net, mctp_eid_t eid,
109112
addr.smctp_haddr[0], addr.smctp_halen);
110113
}
111114

112-
for (i = 0; i < len; i++) {
113-
uint8_t exp = data ? data[i] : i & 0xff;
114-
if (rxbuf[i] != exp)
115-
errx(EXIT_FAILURE,
116-
"payload mismatch at byte 0x%zx; "
117-
"sent 0x%02x, received 0x%02x",
118-
i, exp, rxbuf[i]);
115+
for (int j = 0; j < rc; j++) {
116+
//uint8_t exp = data ? data[i] : i & 0xff;
117+
118+
printf("0x%02x ", rxbuf[j]);
119+
//if (rxbuf[i] != exp)
120+
// errx(EXIT_FAILURE,
121+
// "payload mismatch at byte 0x%zx; "
122+
// "sent 0x%02x, received 0x%02x",
123+
// i, exp, rxbuf[i]);
119124
}
125+
printf("\n");
120126

121127
return 0;
122128
}

0 commit comments

Comments
 (0)