mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge #19658
19658: sys/posix/sockets: fix code style & set sin6_scope_id in _ep_to_sockaddr() r=benpicco a=maribu ### Contribution description - Fix double indent of switch cases to single indent, as per coding convention. (Whitespace only change.) - Set sin6_scope_id to netif in `_ep_to_sockaddr()` Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
This commit is contained in:
commit
e93d597510
@ -214,9 +214,9 @@ static inline socklen_t _addr_truncate(struct sockaddr *out, socklen_t out_len,
|
||||
static int _ep_to_sockaddr(const struct _sock_tl_ep *ep,
|
||||
struct sockaddr_storage *out)
|
||||
{
|
||||
assert((ep->family == AF_INET) || (ep->family == AF_INET6));
|
||||
switch (ep->family) {
|
||||
case AF_INET: {
|
||||
case AF_INET:
|
||||
{
|
||||
struct sockaddr_in *in_addr = (struct sockaddr_in *)out;
|
||||
|
||||
in_addr->sin_family = AF_INET;
|
||||
@ -225,17 +225,20 @@ static int _ep_to_sockaddr(const struct _sock_tl_ep *ep,
|
||||
return sizeof(struct sockaddr_in);
|
||||
}
|
||||
#ifdef SOCK_HAS_IPV6
|
||||
case AF_INET6: {
|
||||
case AF_INET6:
|
||||
{
|
||||
struct sockaddr_in6 *in6_addr = (struct sockaddr_in6 *)out;
|
||||
|
||||
in6_addr->sin6_family = AF_INET6;
|
||||
memcpy(&in6_addr->sin6_addr, &ep->addr.ipv6, sizeof(ep->addr.ipv6));
|
||||
in6_addr->sin6_port = htons(ep->port);
|
||||
in6_addr->sin6_scope_id = ep->netif;
|
||||
return sizeof(struct sockaddr_in6);
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
/* should not happen */
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -982,7 +985,8 @@ static ssize_t socket_recvfrom(socket_t *s, void *restrict buffer,
|
||||
res = _getpeername(s, address, address_len);
|
||||
break;
|
||||
#endif
|
||||
default: {
|
||||
default:
|
||||
{
|
||||
struct sockaddr_storage sa;
|
||||
socklen_t sa_len;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user