Skip to content

Commit 09b561f

Browse files
committed
zephyr/modusocket: Update struct sockaddr family field name.
Was changed to "sa_family" for POSIX compatibility.
1 parent 0aa1d3f commit 09b561f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

zephyr/modusocket.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,16 @@ STATIC mp_obj_t format_inet_addr(struct sockaddr *addr, mp_obj_t port) {
8888
// We employ the fact that port and address offsets are the same for IPv4 & IPv6
8989
struct sockaddr_in6 *sockaddr_in6 = (struct sockaddr_in6*)addr;
9090
char buf[40];
91-
net_addr_ntop(addr->family, &sockaddr_in6->sin6_addr, buf, sizeof(buf));
92-
mp_obj_tuple_t *tuple = mp_obj_new_tuple(addr->family == AF_INET ? 2 : 4, NULL);
91+
net_addr_ntop(addr->sa_family, &sockaddr_in6->sin6_addr, buf, sizeof(buf));
92+
mp_obj_tuple_t *tuple = mp_obj_new_tuple(addr->sa_family == AF_INET ? 2 : 4, NULL);
9393

9494
tuple->items[0] = mp_obj_new_str(buf, strlen(buf), false);
9595
// We employ the fact that port offset is the same for IPv4 & IPv6
9696
// not filled in
9797
//tuple->items[1] = mp_obj_new_int(ntohs(((struct sockaddr_in*)addr)->sin_port));
9898
tuple->items[1] = port;
9999

100-
if (addr->family == AF_INET6) {
100+
if (addr->sa_family == AF_INET6) {
101101
tuple->items[2] = MP_OBJ_NEW_SMALL_INT(0); // flow_info
102102
tuple->items[3] = MP_OBJ_NEW_SMALL_INT(sockaddr_in6->sin6_scope_id);
103103
}

0 commit comments

Comments
 (0)