Hi Justin,

On ma, 2014-07-14 at 10:27 -0700, Justin Maggard wrote:
> We need to specify a requested IP address when our DHCP client state
> is REBINDING as well as REQUESTING and REBOOTING; or else we end up
> sending a DHCP request for 0.0.0.0, which generally just gets ignored.
> ---
>  gdhcp/client.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/gdhcp/client.c b/gdhcp/client.c
> index 47ce2e8..86c0c58 100644
> --- a/gdhcp/client.c
> +++ b/gdhcp/client.c
> @@ -470,11 +470,13 @@ static int send_request(GDHCPClient *dhcp_client)
>       packet.xid = dhcp_client->xid;
>       packet.secs = dhcp_attempt_secs(dhcp_client);
>  
> -     if (dhcp_client->state == REQUESTING || dhcp_client->state == REBOOTING)
> +     if (dhcp_client->state == REQUESTING ||
> +                     dhcp_client->state == REBOOTING ||
> +                             dhcp_client->state == REBINDING)
>               dhcp_add_option_uint32(&packet, DHCP_REQUESTED_IP,
>                               dhcp_client->requested_ip);

The RFC 2131 ch 4.4.5 says this for REBINDING state

"If no DHCPACK arrives before time T2, the client moves to REBINDING
   state and sends (via broadcast) a DHCPREQUEST message to extend its
   lease.  The client sets the 'ciaddr' field in the DHCPREQUEST to its
   current network address.  The client MUST NOT include a 'server
   identifier' in the DHCPREQUEST message."

so we should not set the requested ip option but the ciaddr. This should
be done the same way as the RENEWING (see few lines below) except the
REBINDING is sent to broadcast address.


>  
> -     if (dhcp_client->state == REQUESTING)
> +     if (dhcp_client->state == REQUESTING || dhcp_client->state == REBINDING)
>               dhcp_add_option_uint32(&packet, DHCP_SERVER_ID,
>                               dhcp_client->server_ip);
>  

According to RFC 2131 chapter 4.4.5 Reacquisition and expiration,

"The client MUST NOT include a 'server identifier' in the DHCPREQUEST
message."

so the latter part of the patch would be not ok in this case.


Cheers,
Jukka


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

Reply via email to