From 83c7336e892bac50ebec68bc1e86653ba0afe429 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Sat, 11 Mar 2023 12:52:56 -0500 Subject: [PATCH] MT#55283 fix address conversion Use the address family of the address object to do the conversion, not the family of the socket. This allows for v4-in-v6 socket usage. Change-Id: I4d23b7036207e71f5e70706d621d8ec2b7ca0934 --- lib/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/socket.c b/lib/socket.c index 3dd769aeb..e1c9a707c 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -359,8 +359,8 @@ static ssize_t __ip_sendmsg(socket_t *s, struct msghdr *mh, const endpoint_t *ep static ssize_t __ip_sendto(socket_t *s, const void *buf, size_t len, const endpoint_t *ep) { struct sockaddr_storage sin; - s->family->endpoint2sockaddr(&sin, ep); - return sendto(s->fd, buf, len, 0, (void *) &sin, s->family->sockaddr_size); + ep->address.family->endpoint2sockaddr(&sin, ep); + return sendto(s->fd, buf, len, 0, (void *) &sin, ep->address.family->sockaddr_size); } static int __ip4_tos(socket_t *s, unsigned int tos) { unsigned char ctos;