Skip to contentSkip to conversation

gdhcp: fix server address byte order

PATCH In review Ryan Smith 2 participants 2 messages Apr 11, 2022 – Apr 14, 2022

lore
Share & tools
lore

Ryan Smith

author
#0 lore raw

PATCH 1/1 gdhcp: fix server address byte order

The get_ip function calls inet_ntoa, which expects the IP address in network byte order.

---
 gdhcp/client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
gdhcp/client.c +1 -1
index 3016dfc2..7efa7e45 100644
@@ -3036,7 +3036,7 @@ char *g_dhcp_client_get_server_address(GDHCPClient *dhcp_client)
 	if (!dhcp_client)
 		return NULL;
 
-	return get_ip(dhcp_client->server_ip);
+	return get_ip(htonl(dhcp_client->server_ip));
 }
 
 char *g_dhcp_client_get_address(GDHCPClient *dhcp_client)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 2 lines · Ryan Smith

The get_ip function calls inet_ntoa, which expects the IP address in network byte order.

Patch applied.

Thanks,
Daniel