path: root/gdhcp
diff options
authorPatrik Flykt <>2013-02-11 07:26:35 (GMT)
committerPatrik Flykt <>2013-02-11 11:42:47 (GMT)
commitb475cc29272254b2ab71540b2bf0fac57d0b0816 (patch)
tree23d9608dc527b83bbb7f5a633751cf9fa28acd6b /gdhcp
parentdcf9406d4338c58c627b0c54e508a65e624bde38 (diff)
gdhcp: DHCP server IP address is stored in host order
This change affects unicasted DHCP renew and release messages. A DHCP server receiving packets via a raw socket will get all packets destined to port 67. If the DHCP server checks the intended server IP address, the request will fail. If the server does not care about the IP address being used, it will send a reply. The reply is not recognized by ConnMan since it is coming from another IP address than what it was sent to. ConnMan will retry quite a few times, but eventually settle down and use the address even without a proper response from the server.
Diffstat (limited to 'gdhcp')
1 files changed, 1 insertions, 1 deletions
diff --git a/gdhcp/common.c b/gdhcp/common.c
index ed27e43..e8676f8 100644
--- a/gdhcp/common.c
+++ b/gdhcp/common.c
@@ -629,7 +629,7 @@ int dhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt,
memset(&client, 0, sizeof(client));
client.sin_family = AF_INET;
client.sin_port = htons(dest_port);
- client.sin_addr.s_addr = dest_ip;
+ client.sin_addr.s_addr = htonl(dest_ip);
if (connect(fd, (struct sockaddr *) &client, sizeof(client)) < 0) {
return -errno;