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
pull/1640/head
Richard Fuchs 3 years ago
parent 244399eb62
commit 83c7336e89

@ -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;

Loading…
Cancel
Save