netutils/rexecd: fix rpname mismatch with rexec when using AF_RPMSG

When using AF_RPMSG (-r option), rexecd was setting the rp_name
to the raw port number, while rexec was using htons(port). This
caused a mismatch where rexec couldn't connect to rexecd.

This commit fixes the issue by applying htons() to REXECD_PORT
when setting rp_name in the AF_RPMSG case, making it consistent
with the rexec client implementation.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
This commit is contained in:
fangpeina 2025-05-08 22:10:40 +08:00 committed by Xiang Xiao
parent b2d4ad67b1
commit eb9b9a2d60

View file

@ -223,7 +223,7 @@ int main(int argc, FAR char **argv)
case AF_RPMSG:
((FAR struct sockaddr_rpmsg *)&addr)->rp_family = AF_RPMSG;
snprintf(((FAR struct sockaddr_rpmsg *)&addr)->rp_name,
RPMSG_SOCKET_NAME_SIZE, "%d", REXECD_PORT);
RPMSG_SOCKET_NAME_SIZE, "%d", htons(REXECD_PORT));
ret = sizeof(struct sockaddr_rpmsg);
}