Hi Jukka,

> Convert to network byte order just before sending the packet.
> ---
>  gdhcp/client.c | 47 +++++++++++++++++++++--------------------------
>  gdhcp/common.c | 20 +++++++++++++++-----
>  gdhcp/common.h | 17 +----------------
>  gdhcp/ipv4ll.c |  4 ++--
>  gdhcp/server.c | 41 +++++++++++++++++++----------------------
>  5 files changed, 58 insertions(+), 71 deletions(-)
> 
> diff --git a/gdhcp/client.c b/gdhcp/client.c
> index cf04ced..7340f3a 100644
> --- a/gdhcp/client.c
> +++ b/gdhcp/client.c
> @@ -367,7 +367,7 @@ static int send_discover(GDHCPClient *dhcp_client, 
> uint32_t requested)
>  
>       /* Explicitly saying that we want RFC-compliant packets helps
>        * some buggy DHCP servers to NOT send bigger packets */
> -     dhcp_add_simple_option(&packet, DHCP_MAX_SIZE, htons(576));
> +     dhcp_add_simple_option(&packet, DHCP_MAX_SIZE, 576);
>  
>       add_request_options(dhcp_client, &packet);
>  
> @@ -410,7 +410,7 @@ static int send_renew(GDHCPClient *dhcp_client)
>  
>       init_packet(dhcp_client , &packet, DHCPREQUEST);
>       packet.xid = dhcp_client->xid;
> -     packet.ciaddr = dhcp_client->requested_ip;
> +     packet.ciaddr = htonl(dhcp_client->requested_ip);
>  
>       add_request_options(dhcp_client, &packet);
>  
> @@ -429,7 +429,7 @@ static int send_rebound(GDHCPClient *dhcp_client)
>  
>       init_packet(dhcp_client , &packet, DHCPREQUEST);
>       packet.xid = dhcp_client->xid;
> -     packet.ciaddr = dhcp_client->requested_ip;
> +     packet.ciaddr = htonl(dhcp_client->requested_ip);
>  
>       add_request_options(dhcp_client, &packet);
>  
> @@ -449,7 +449,7 @@ static int send_release(GDHCPClient *dhcp_client,
>  
>       init_packet(dhcp_client, &packet, DHCPRELEASE);
>       packet.xid = rand();
> -     packet.ciaddr = ciaddr;
> +     packet.ciaddr = htonl(ciaddr);
>  
>       dhcp_add_simple_option(&packet, DHCP_SERVER_ID, server);
>  
> @@ -1134,7 +1134,7 @@ static int ipv4ll_recv_arp_packet(GDHCPClient 
> *dhcp_client)
>                       arp.arp_op != htons(ARPOP_REQUEST))
>               return -EINVAL;
>  
> -     ip_requested = ntohl(dhcp_client->requested_ip);
> +     ip_requested = htonl(dhcp_client->requested_ip);

so why is this patch correct?

Regards

Marcel


_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to