commit 5c9de0cf23f9f98d89012633b97f3272bd6ef64a
parent 541dca499ad81d074e7db9a8bc8bf5ab8ad2a8d8
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date: Sat, 7 Aug 2021 04:10:40 +0200
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.
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/eapol.c b/src/eapol.c
@@ -1356,11 +1356,11 @@ static void eapol_send_ptk_3_of_4(struct eapol_sm *sm)
key_data_buf[key_data_len++] = 4 + 12;
l_put_be32(HANDSHAKE_KDE_IP_ADDRESS_ALLOC,
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);
- l_put_be32(sm->handshake->subnet_mask,
+ l_put_u32(sm->handshake->subnet_mask,
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_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;
if (ip_alloc_kde) {
- hs->client_ip_addr = l_get_be32(ip_alloc_kde);
- hs->subnet_mask = l_get_be32(ip_alloc_kde + 4);
- hs->go_ip_addr = l_get_be32(ip_alloc_kde + 8);
+ hs->client_ip_addr = l_get_u32(ip_alloc_kde);
+ hs->subnet_mask = l_get_u32(ip_alloc_kde + 4);
+ hs->go_ip_addr = l_get_u32(ip_alloc_kde + 8);
} else
l_debug("Authenticator ignored our IP Address Request");
}
diff --git a/src/p2p.c b/src/p2p.c
@@ -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)
{
- struct in_addr ia = { .s_addr = L_CPU_TO_BE32(addr) };
+ struct in_addr ia = { .s_addr = addr };
return inet_ntoa(ia);
}