Skip to content

DHCP infinite lease + ethernet.maintain() [imported] #985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cmaglie opened this issue Nov 15, 2012 · 1 comment
Closed

DHCP infinite lease + ethernet.maintain() [imported] #985

cmaglie opened this issue Nov 15, 2012 · 1 comment
Assignees
Labels
Library: Ethernet The Ethernet Arduino library Type: Bug
Milestone

Comments

@cmaglie
Copy link
Member

cmaglie commented Nov 15, 2012

This is Issue 985 moved from a Google Code project.
Added by 2012-07-16T13:09:48.000Z by mik...@gmail.com.
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Defect, Priority-Medium, Component-Ethernet

Original description

What steps will reproduce the problem?
Ethernet shield + DHCP. If the DHCP server gives you lease with "infinite" lease time (0xFFFFFFFF) the method calculating rebind time (_dhcpT2 = _dhcpT1 << 1;) gives you wrong time forcing Ethernet.maintain() to rebind every time it's called.

What is the expected output? What do you see instead?
PROBLEM ROW #104:_dhcpT2 = _dhcpT1 << 1;
I'm expecting positive integer but I'm seeing -2. Calculation method gives 2147483647 for renew timer(_dhcpT1) and -2 for rebind timer(_dhcpT2). Ethernet.maintain() sees this like it would be always 2 seconds "late" and forces it to rebind. This creates huge amount of traffic inside LAN as DHCP uses broadcast messages for request etc.

If I'm correct the calculation method should be something else for example the one I used in my scenario (see below).

What version of the Arduino software are you using? On what operating
system? Which Arduino board are you using?
IDE 1.0.1, Windows 7 SP1, Arduino Mega2560+ Ethernet shield with SD

Please provide any additional information below.
In my own scenario I fixed the problem by changing the row used to calculate rebind time to not use bitwise left shift. Instead the row is now like this: "_dhcpT2 = _dhcpLeaseTime*7/8;".

@ffissore ffissore added the New label Feb 27, 2014
@cmaglie cmaglie removed the New label Feb 27, 2014
@cmaglie cmaglie self-assigned this Feb 4, 2015
cmaglie added a commit to cmaglie/Arduino that referenced this issue Jun 4, 2015
The signed math doesn't handle correctly cases where the lease
time is set to infinity (0xFFFFFFFF).

Fixes arduino#2571
Fixes arduino#2601
Fixes arduino#2642
Fixes arduino#985
@cmaglie
Copy link
Member Author

cmaglie commented Jun 4, 2015

A proposed fix is in #3287 please follow up there.

@cmaglie cmaglie closed this as completed Jun 4, 2015
@ffissore ffissore added this to the Release 1.6.5 milestone Jun 4, 2015
cmaglie added a commit to cmaglie/Arduino that referenced this issue Jul 14, 2015
The signed math doesn't handle correctly cases where the lease
time is set to infinity (0xFFFFFFFF).

Fixes arduino#2571
Fixes arduino#2601
Fixes arduino#2642
Fixes arduino#985
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Library: Ethernet The Ethernet Arduino library Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants