Skip to content

Commit 51e76e4

Browse files
mctpd: always reply to physical addresses
All the usages of reply_message currently have access to the peer physical addresses. Doing this by default should avoid an unnecessary kernel routing table lookup in most cases. Signed-off-by: Khang D Nguyen <khangng@os.amperecomputing.com>
1 parent 9c2adf0 commit 51e76e4

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/mctpd.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -570,20 +570,18 @@ static int read_message(struct ctx *ctx, int sd, uint8_t **ret_buf, size_t *ret_
570570
return rc;
571571
}
572572

573-
/* Replies to a real EID, not physical addressing */
574573
static int reply_message(struct ctx *ctx, int sd, const void *resp, size_t resp_len,
575574
const struct sockaddr_mctp_ext *addr)
576575
{
577576
ssize_t len;
578-
struct sockaddr_mctp reply_addr;
577+
struct sockaddr_mctp_ext reply_addr = *addr;
579578

580-
memcpy(&reply_addr, &addr->smctp_base, sizeof(reply_addr));
581-
reply_addr.smctp_tag &= ~MCTP_TAG_OWNER;
579+
reply_addr.smctp_base.smctp_tag &= ~MCTP_TAG_OWNER;
582580

583-
if (reply_addr.smctp_addr.s_addr == 0 ||
584-
reply_addr.smctp_addr.s_addr == 0xff) {
581+
if (reply_addr.smctp_base.smctp_addr.s_addr == 0 ||
582+
reply_addr.smctp_base.smctp_addr.s_addr == 0xff) {
585583
bug_warn("reply_message can't take EID %d",
586-
reply_addr.smctp_addr.s_addr);
584+
reply_addr.smctp_base.smctp_addr.s_addr);
587585
return -EPROTO;
588586
}
589587

0 commit comments

Comments
 (0)