From: Patrik Flykt Date: Mon, 11 Feb 2013 07:26:35 +0000 (+0200) Subject: gdhcp: DHCP server IP address is stored in host order X-Git-Tag: 1.12~128 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b475cc29272254b2ab71540b2bf0fac57d0b0816;p=platform%2Fupstream%2Fconnman.git 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. --- 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) { close(fd); return -errno;