Re: clamping issue in dhcp lease

2015-10-08 Thread Patrik Flykt
On Wed, 2015-10-07 at 00:33 -0700, Naveen Singh wrote:
> lease_seconds &= 0x0fff;

This seems to be a bug and at the same time very old code. I'll try to
find time to fix this.

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


clamping issue in dhcp lease

2015-10-07 Thread Naveen Singh
Hi
This is the current code of get_lease in client.c file:

lease_seconds = get_be32(option);
/* paranoia: must not be prone to overflows */
lease_seconds &= 0x0fff;

If first 28 bits are a small number (but lease_seconds is larger than
0xfff) this would make lease_seconds a very low value and we will be
renewing when we should not.

Even if it is a very big number but above arithmetic probably is not
correct. Is the intention really to take first 28 bits or to ensure that if
it is greater than a certain value cap it to that value.

Regards
Naveen
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman