Opened 11 years ago

Closed 10 years ago

#2531 closed bug (fixed)

DHCP changes IP address every 5 minutes

Reported by: idefix Owned by: axeld
Priority: normal Milestone: R1
Component: Network & Internet Version: R1/pre-alpha1
Keywords: Cc: adek336@…
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

When I connect my Haiku computer to my Windows XP computer (with Internet Connection Sharing enabled), Haiku gets a new IP-address every 5 minutes. BeOS R5 (on the Haiku computer) doesn't show this behaviour.

The network card Haiku uses is a 3Com Etherlink XL 3C900B.

Attachments (32)

Haiku DHCP requests (r27964).txt (99.6 KB) - added by idefix 11 years ago.
Wireshark log of DHCP requests by Haiku hrev27964. (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
Packet 259.txt (1.6 KB) - added by idefix 11 years ago.
Details of packet 259, showing various DHCP values.
BeOS DHCP requests.txt (1.2 KB) - added by idefix 11 years ago.
Wireshark log of DHCP requests by BeOS. (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
Haiku r28358 summary.txt (21.2 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by Haiku hrev28358 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
Haiku r28358 details.txt (168.2 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by Haiku hrev28358 (details). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
Haiku r28358.pcap (38.0 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by Haiku hrev28358 (pcap). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
BeOS R5 summary.txt (1.2 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by BeOS R5 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer)
BeOS R5 details.txt (9.7 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by BeOS R5 (details). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer)
BeOS R5.pcap (3.1 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by BeOS R5 (pcap). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer)
FreeBSD 7.0 summary.txt (7.9 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by FreeBSD 7.0 (summary).
FreeBSD 7.0 details.txt (72.4 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by FreeBSD 7.0 (details).
FreeBSD 7.0.pcap (23.0 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by FreeBSD 7.0 (pcap).
dhcp.1.diff (4.3 KB) - added by Adek336 10 years ago.
Haiku r28749 summary.txt (25.9 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by Haiku hrev28749 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
Haiku r28749 details.txt (209.7 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by Haiku hrev28749 (details). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
Haiku r28749.pcap (47.2 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by Haiku hrev28749 (pcap). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
Haiku r28749 v2 trace.txt (5.7 KB) - added by idefix 10 years ago.
Output of 'trac 0 80' in Haiku hrev28749.
Haiku r28749 v2 summary.txt (6.1 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by Haiku hrev28749 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
dhcp.2.diff (5.8 KB) - added by Adek336 10 years ago.
Haiku r28749 v3 trace.txt (15.7 KB) - added by idefix 10 years ago.
Output of 'trac 0 80' in Haiku hrev28749. (dhcp.2.diff applied)
Haiku r28749 v3 summary.txt (7.2 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by Haiku hrev28749 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
dhcp.3.diff (6.5 KB) - added by Adek336 10 years ago.
dhcp.3.2.diff (6.5 KB) - added by Adek336 10 years ago.
dhcp.4.diff (9.3 KB) - added by Adek336 10 years ago.
Haiku r28749 v4 trace.txt (18.4 KB) - added by idefix 10 years ago.
Output of 'trac 0 500' in Haiku hrev28749. (dhcp.4.diff applied)
Haiku r28749 v4 summary.txt (5.9 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by Haiku hrev28749 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
dhcp.5.diff (9.8 KB) - added by Adek336 10 years ago.
dhcp.5.2.diff (10.0 KB) - added by Adek336 10 years ago.
patch-dhcp.1.diff (713 bytes) - added by Adek336 10 years ago.
Haiku r28749 v5 trace.txt (30.9 KB) - added by idefix 10 years ago.
Output of 'trac 0 500' in Haiku hrev28749. (dhcp.5.2.diff applied)
Haiku r28749 v5 summary.txt (6.1 KB) - added by idefix 10 years ago.
Wireshark log of DHCP requests by Haiku hrev28749 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)
patch-dhcp.2.diff (470 bytes) - added by Adek336 10 years ago.

Download all attachments as: .zip

Change History (67)

comment:1 Changed 11 years ago by idefix

Normally this computer gets its IP from the ADSL-modem's DHCP-server, but it gives the same IP adddress every time. I still haven't found out how to get the modem to log DHCP requests...

comment:2 Changed 11 years ago by idefix

Summary: DHCP changes IP every 5 minutesDHCP changes IP address every 5 minutes

comment:3 Changed 11 years ago by idefix

Tested again on hrev27964, with RTL8139 network card.

DHCP requests captured on Windows XP with Wireshark. See 'Haiku DHCP requests (hrev27964).txt' (formatted the first couple of lines for readability).
(BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

Packet 259 shows the various DHCP-values. See 'Packet 259.txt'.

Changed 11 years ago by idefix

Wireshark log of DHCP requests by Haiku hrev27964. (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

Changed 11 years ago by idefix

Attachment: Packet 259.txt added

Details of packet 259, showing various DHCP values.

comment:4 Changed 11 years ago by idefix

Tested also on the same computer with BeOS. See 'BeOS DHCP requests.txt' (let the computer running for 45 minutes).

Changed 11 years ago by idefix

Attachment: BeOS DHCP requests.txt added

Wireshark log of DHCP requests by BeOS. (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

comment:5 Changed 10 years ago by axeld

At least the renewal time looks good :-)

Is it possible that you provide more detailed packet data such as 259? It would be interesting to get a DHCP request + the corresponding ack packet for Haiku (when it tries to renew the lease), and BeOS. Thanks so far!

comment:6 Changed 10 years ago by idefix

The first 25 minutes Haiku obeys the 5 minutes interval, but after that it uses an interval of 2 seconds. Tested with hrev28358:

Summary: 'Haiku hrev28358 summary.txt'
Details: 'Haiku hrev28358 details.txt'
Pcap: 'Haiku hrev28358.pcap'

Changed 10 years ago by idefix

Attachment: Haiku r28358 summary.txt added

Wireshark log of DHCP requests by Haiku hrev28358 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

Changed 10 years ago by idefix

Attachment: Haiku r28358 details.txt added

Wireshark log of DHCP requests by Haiku hrev28358 (details). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

Changed 10 years ago by idefix

Attachment: Haiku r28358.pcap added

Wireshark log of DHCP requests by Haiku hrev28358 (pcap). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

comment:7 Changed 10 years ago by idefix

To compare with BeOS R5:

Summary: 'BeOS R5 summary.txt'
Details: 'BeOS R5 details.txt'
Pcap: 'BeOS R5.pcap'

Changed 10 years ago by idefix

Attachment: BeOS R5 summary.txt added

Wireshark log of DHCP requests by BeOS R5 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer)

Changed 10 years ago by idefix

Attachment: BeOS R5 details.txt added

Wireshark log of DHCP requests by BeOS R5 (details). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer)

Changed 10 years ago by idefix

Attachment: BeOS R5.pcap added

Wireshark log of DHCP requests by BeOS R5 (pcap). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer)

comment:8 Changed 10 years ago by idefix

To compare with FreeBSD 7.0:

Summary: 'FreeBSD 7.0 summary.txt'
Details: 'FreeBSD 7.0 details.txt'
Pcap: 'FreeBSD 7.0.pcap'

Changed 10 years ago by idefix

Attachment: FreeBSD 7.0 summary.txt added

Wireshark log of DHCP requests by FreeBSD 7.0 (summary).

Changed 10 years ago by idefix

Attachment: FreeBSD 7.0 details.txt added

Wireshark log of DHCP requests by FreeBSD 7.0 (details).

Changed 10 years ago by idefix

Attachment: FreeBSD 7.0.pcap added

Wireshark log of DHCP requests by FreeBSD 7.0 (pcap).

comment:9 Changed 10 years ago by Adek336

Cc: adek336@… added

comment:10 Changed 10 years ago by Adek336

Would you care for debugging the problem by adding some diagnostic messages to the source code if I sent in a diff?

comment:11 Changed 10 years ago by idefix

Sure, no problem.

comment:12 Changed 10 years ago by Adek336

dhcp.1.diff: let's take a look at who calls DHCLient::DHCLient and DHCLient::_Negotiate.

If you haven't yet, please enable tracing:

mkdir build/user_config_headers
cp build/config_headers/tracing_config.h build/user_config_headers/

and edit build/user_config_headers/tracing_config.h so that you have "# define ENABLE_TRACING 1" instead of "# define ENABLE_TRACING 0".

Changed 10 years ago by Adek336

Attachment: dhcp.1.diff added

comment:13 Changed 10 years ago by Adek336

After rebooting and having Haiku send a few dhcp requests, please press F12 and type trac 0 80 and attach a screenshot of the result.

comment:14 Changed 10 years ago by idefix

Unfortunately my computer (400 MHz PII, 64 MB) is not really up to the task of building Haiku, but specific components can be build.
Which jam targets should I build after enabling kernel tracing?

comment:15 Changed 10 years ago by Adek336

These are kernel_x86 and net_server.

comment:16 Changed 10 years ago by Adek336

Also apply the patch.

comment:17 Changed 10 years ago by axeld

Did hrev28749 change anything?

comment:18 Changed 10 years ago by idefix

Unfortunately, no. Tested with hrev28749:

Summary: 'Haiku hrev28749 summary.txt'
Details: 'Haiku hrev28749 details.txt'
Pcap: 'Haiku hrev28749.pcap'

Changed 10 years ago by idefix

Attachment: Haiku r28749 summary.txt added

Wireshark log of DHCP requests by Haiku hrev28749 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

Changed 10 years ago by idefix

Attachment: Haiku r28749 details.txt added

Wireshark log of DHCP requests by Haiku hrev28749 (details). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

Changed 10 years ago by idefix

Attachment: Haiku r28749.pcap added

Wireshark log of DHCP requests by Haiku hrev28749 (pcap). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

comment:19 in reply to:  13 Changed 10 years ago by idefix

Replying to Adek336:

After rebooting and having Haiku send a few dhcp requests, please press F12 and type trac 0 80 and attach a screenshot of the result.

I must have done something wrong, as haiku hrev28749 won't send any DHCP request after enabling kernel tracing. The system is also behaving strange: slow booting; Tracker won't show the desktop-icons; ProcessController is not shown in the Desktop; applications won't start from the start menu. I think the amount of memory reserved for kernel tracing is a bit high for this machine.

'trac 0 80' gives:

kdebug> trac 0 80
    1. [    49]   63575839: user: DHCP: src/servers/net/NetServer.cpp: _BringUpInterfaces: 830
    2. [    49]   63575857: user: DHCP: src/servers/net/NetServer.cpp: _ConfigureInterface: 490
    3. [    49]   63993595: user: DHCP: src/servers/net/NetServer.cpp: _ConfigureInterface: 682
printed 3 entries within range 1 to 3 (3 of 3 total, 3 ever)

comment:20 Changed 10 years ago by idefix

I think I found the culprit: MAX_TRACE_SIZE defaults to 20 MB.
I thought it was 1 MB.

comment:21 Changed 10 years ago by idefix

Setting MAX_TRACE_SIZE to 1 MB got it working:

Trace: 'Haiku hrev28749 v2 trace.txt'
Summary: 'Haiku hrev28749 v2 summary.txt'

Changed 10 years ago by idefix

Attachment: Haiku r28749 v2 trace.txt added

Output of 'trac 0 80' in Haiku hrev28749.

Changed 10 years ago by idefix

Attachment: Haiku r28749 v2 summary.txt added

Wireshark log of DHCP requests by Haiku hrev28749 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

Changed 10 years ago by Adek336

Attachment: dhcp.2.diff added

comment:22 Changed 10 years ago by Adek336

Hah, 20 megs, that's the third of what you have, no wonder it didn't work very well :-)

So DHCP acks are sent, but _Negotiate loops many times trying to fetch one. Btw, how did you manage to save the trace output to a text file? I hope you didn't have to write it down by hand...

Attached is dhcp.2.diff, which will show what happens in the loop. You have to rebuild only the net_server target. Again, trac 0 80 is of interest.

comment:23 in reply to:  22 ; Changed 10 years ago by idefix

I hope 'trac 0 200' is ok with you? (Why limit yourself to 80 if you can have it all?) :)

Trace: 'Haiku hrev28749 v3 trace.txt'
Summary: 'Haiku hrev28749 v3 summary.txt'


[...] Btw, how did you manage to save the trace output to a text file? I hope you didn't have to write it down by hand...

No, my null modem cable and HyperTerminal do all the hard work for me. :)

Changed 10 years ago by idefix

Attachment: Haiku r28749 v3 trace.txt added

Output of 'trac 0 80' in Haiku hrev28749. (dhcp.2.diff applied)

Changed 10 years ago by idefix

Attachment: Haiku r28749 v3 summary.txt added

Wireshark log of DHCP requests by Haiku hrev28749 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

Changed 10 years ago by Adek336

Attachment: dhcp.3.diff added

Changed 10 years ago by Adek336

Attachment: dhcp.3.2.diff added

comment:24 in reply to:  23 Changed 10 years ago by Adek336

Thanks! Replying to idefix:

I hope 'trac 0 200' is ok with you? (Why limit yourself to 80 if you can have it all?) :)

The more the merrier:)

It looks like it's getting an ACK but rejects it because it finds the value of "state" disheartening.

dhcp.3.diff dhcp.3.2.diff same files. They will trace the value of "state".

Changed 10 years ago by Adek336

Attachment: dhcp.4.diff added

comment:25 Changed 10 years ago by Adek336

Skip dhcp.3.diff, go for dhcp.4.diff.

comment:26 Changed 10 years ago by idefix

Haiku hrev28749 with dhcp.4.diff applied:

Trace: 'Haiku hrev28749 v4 trace.txt'
Summary: 'Haiku hrev28749 v4 summary.txt'

Changed 10 years ago by idefix

Attachment: Haiku r28749 v4 trace.txt added

Output of 'trac 0 500' in Haiku hrev28749. (dhcp.4.diff applied)

Changed 10 years ago by idefix

Attachment: Haiku r28749 v4 summary.txt added

Wireshark log of DHCP requests by Haiku hrev28749 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

Changed 10 years ago by Adek336

Attachment: dhcp.5.diff added

comment:27 Changed 10 years ago by Adek336

this line comes from _CurrentState:
        78. [    64]  709288070: user: DHCP: now 709288017, fLeaseTime 605209288055, fRebindingTime 454009288055, fRenewalTime 709288055
this line means we are supposed to get a new lease:
        79. [    64]  709288089: user: DHCP: src/servers/net/DHCPClient.cpp: MessageReceived: 888
this line should read "RENEWAL"
        80. [    64]  709288099: user: DHCP: state BOUND

It looks like if the message sent from _RestartLease comes ~30 usec early ("now 709288017" < "fRenewalTime 709288055); that sets "state" to BOUND, which _Negotiate doesn't handle very well.

patch.1.diff is proposed patch: send the message 1ms later
dhcp.5.diff is some new debugging code + proposed patch

Apply dhcp.5.diff so if the patch doesn't help, we get some debugging output.

Changed 10 years ago by Adek336

Attachment: dhcp.5.2.diff added

Changed 10 years ago by Adek336

Attachment: patch-dhcp.1.diff added

comment:28 Changed 10 years ago by Adek336

Use dhcp.5.2.diff, which includes the patch, instead of dhcp.5.diff which doesn't.

comment:29 Changed 10 years ago by idefix

Looks like your patch fixed the bug.
Haiku hrev28749 with dhcp.5.2.diff applied:

Trace: 'Haiku hrev28749 v5 trace.txt'
Summary: 'Haiku hrev28749 v5 summary.txt'

Changed 10 years ago by idefix

Attachment: Haiku r28749 v5 trace.txt added

Output of 'trac 0 500' in Haiku hrev28749. (dhcp.5.2.diff applied)

Changed 10 years ago by idefix

Attachment: Haiku r28749 v5 summary.txt added

Wireshark log of DHCP requests by Haiku hrev28749 (summary). (BellTech_b5:d0:d1 is network card in 'Windows XP'-computer, SurecomT_52:3d:c3 is network card in Haiku-computer)

comment:30 Changed 10 years ago by Adek336

That's great !

I wonder if it's acceptable for BMessageRunner to be early, isn't it supposed to guarantee not being early.

Changed 10 years ago by Adek336

Attachment: patch-dhcp.2.diff added

comment:31 Changed 10 years ago by Adek336

Hello, it looks like BMessageRunner is all well and the problem is that fRenewalTime is fed with system_time() after registering a BMessageRunner which makes the message come early in comparison to fRenewalTime.

Please revert DHCPClient.cpp and then apply patch-dhcp.2.diff, I'm pretty sure that this will help, and we'll call it a day !

comment:32 Changed 10 years ago by idefix

patch-dhcp.2.diff also fixed the bug. Thanks for fixing!

Can't upload any logs as Trac is broken.

comment:33 Changed 10 years ago by Adek336

Can this patch be commited now?

comment:34 Changed 10 years ago by anevilyak

Assuming no one beats me to it, I can commit once I'm back home friday evening. Sorry this sort of slipped under the radar!

comment:35 Changed 10 years ago by anevilyak

Resolution: fixed
Status: newclosed

Applied in hrev28817, thanks!

Note: See TracTickets for help on using tickets.