Fix DHCP not woking for routers that hand out very long leases.
As can be seen on https://github.com/Quarx2k/android_device_motorola_umts_jordan/issues/209, there are routers that hand out leases with extremely long lease times (in that bug report: 180 years) instead of using 0xffffffff (infinite). In those cases, the renewal timer calculations could overflow (as DhcpInfo.leaseDuration is int), with the result becoming negative and renewal being re-started because of that. The router ignored that renewal (too short time inbetween requests), making the second DHCP attempt fail. Avoid that scenario by properly casting leaseDuration to long. Also reduce code duplication to prevent making the same mistake twice ;-)
Loading
Please register or sign in to comment