3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 01:19:23 +01:00

eapol: Store IP address in network byte order

Switch handshake_state's .client_ip_addr, .subnet_mask and .go_ip_addr
from host byte order to network by order.
This commit is contained in:
Andrew Zaborowski 2021-08-07 04:10:40 +02:00 committed by Denis Kenzior
parent 541dca499a
commit 5c9de0cf23
2 changed files with 7 additions and 7 deletions

View File

@ -1356,11 +1356,11 @@ static void eapol_send_ptk_3_of_4(struct eapol_sm *sm)
key_data_buf[key_data_len++] = 4 + 12; key_data_buf[key_data_len++] = 4 + 12;
l_put_be32(HANDSHAKE_KDE_IP_ADDRESS_ALLOC, l_put_be32(HANDSHAKE_KDE_IP_ADDRESS_ALLOC,
key_data_buf + key_data_len + 0); key_data_buf + key_data_len + 0);
l_put_be32(sm->handshake->client_ip_addr, l_put_u32(sm->handshake->client_ip_addr,
key_data_buf + key_data_len + 4); key_data_buf + key_data_len + 4);
l_put_be32(sm->handshake->subnet_mask, l_put_u32(sm->handshake->subnet_mask,
key_data_buf + key_data_len + 8); key_data_buf + key_data_len + 8);
l_put_be32(sm->handshake->go_ip_addr, l_put_u32(sm->handshake->go_ip_addr,
key_data_buf + key_data_len + 12); key_data_buf + key_data_len + 12);
key_data_len += 4 + 12; key_data_len += 4 + 12;
} }
@ -1810,9 +1810,9 @@ static void eapol_handle_ptk_3_of_4(struct eapol_sm *sm,
hs->support_ip_allocation = ip_alloc_kde != NULL; hs->support_ip_allocation = ip_alloc_kde != NULL;
if (ip_alloc_kde) { if (ip_alloc_kde) {
hs->client_ip_addr = l_get_be32(ip_alloc_kde); hs->client_ip_addr = l_get_u32(ip_alloc_kde);
hs->subnet_mask = l_get_be32(ip_alloc_kde + 4); hs->subnet_mask = l_get_u32(ip_alloc_kde + 4);
hs->go_ip_addr = l_get_be32(ip_alloc_kde + 8); hs->go_ip_addr = l_get_u32(ip_alloc_kde + 8);
} else } else
l_debug("Authenticator ignored our IP Address Request"); l_debug("Authenticator ignored our IP Address Request");
} }

View File

@ -1441,7 +1441,7 @@ static void p2p_netdev_event(struct netdev *netdev, enum netdev_event event,
static const char *p2p_ip_to_string(uint32_t addr) static const char *p2p_ip_to_string(uint32_t addr)
{ {
struct in_addr ia = { .s_addr = L_CPU_TO_BE32(addr) }; struct in_addr ia = { .s_addr = addr };
return inet_ntoa(ia); return inet_ntoa(ia);
} }