FS#23282 - [initscripts] terminate 'dhcpcd' using the correct '-k' option

Attached to Project: Arch Linux
Opened by Xavion (Xavion) - Tuesday, 15 March 2011, 09:12 GMT
Last edited by Andrea Scarpino (BaSh) - Wednesday, 16 March 2011, 15:12 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Aaron Griffin (phrakture)
Thomas Bächler (brain0)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

This bug report is intended for the maintainer of the 'initscripts' package and relates to his "/etc/rc.d/network" script. I just posted the following to the 'NetworkManager' bug databases, as it suffers from the same problem.

-----

If my modem/router is switched off (e.g. overnight), I can't reconnect - via Ethernet or wireless - the next time it's switched on, without having to mess around first.

This is because your script doesn't terminate 'dhcpcd' via the '-k' option. The effect is that the stale ".lease" file from the previous session (day) remains in "/var/lib/dhcpcd/".

This ".lease" file is automatically reused when reconnecting, but my modem/router forgot about it while switched off (e.g. overnight). This means that initial connection attempts are rejected until I delete it.

I'm guessing that all users with NetComm modem/routers - and probably others - would be facing this problem every time they switch theirs on. Will you please terminate 'dhcpcd' using the '-k' option in future releases?

For example, instead of using "/usr/bin/killall dhcpcd", you would use "/sbin/dhcpcd -k [interface]". I have already tested this here and I can confirm that the stale ".lease" file is deleted as expected.
This task depends upon

Closed by  Andrea Scarpino (BaSh)
Wednesday, 16 March 2011, 15:12 GMT
Reason for closing:  Fixed
Comment by Andrea Scarpino (BaSh) - Tuesday, 15 March 2011, 10:51 GMT
patch attached
Comment by Thomas Bächler (brain0) - Tuesday, 15 March 2011, 13:48 GMT
While the patch is probably the right thing to do, I must also note that your router is broken. If you try to re-use an existing lease, one of three things should happen:
1) The router sends DHCPACK, allowing you to use the old lease.
2) The router sends DHCPNAK, and dhcpcd will request a new lease using DHCPDISCOVER.
3) The router doesn't reply, and after a timeout dhcpcd will request a new lease using DHCPDISCOVER.
Comment by Xavion (Xavion) - Tuesday, 15 March 2011, 23:24 GMT
@Andrea
Thanks for submitting the patch. It's pretty much the same as what I added here yesterday. I'll now see if I can get the "/etc/rc.d/net-auto-wire{d,less}" scripts to terminate 'dhcpcd' cleanly too.

@Thomas
My router isn't 'broken', since its twin brother behaves identically interstate. Maybe its DHCP server code is buggy, but I wish to be clear that both routers work perfectly otherwise.

A NetworkManager developer provided me with a similar response, which you might be interested in reading here: https://bugzilla.gnome.org/show_bug.cgi?id=644798

I'll see if I can determine exactly how my NetComm NB6W handles the lease-rejection process. I'll post the details here once I've figured out what's happening.
Comment by Thomas Bächler (brain0) - Wednesday, 16 March 2011, 00:13 GMT
Would be interesting to know. From the report you linked: "So perhaps the solution is to figure out how to get dhcpcd to request a
completely new lease if the renew fails?" dhcpcd actually requests a new lease when renewing fails or times out, so I don't know what happens here.

Anyway, http://projects.archlinux.org/initscripts.git/commit/?id=4f9282efa03872c3e298156a21d524734e8f5ab1
Comment by Xavion (Xavion) - Wednesday, 16 March 2011, 02:04 GMT
Thanks for committing Andrea's patch to your official repository. This fix will no doubt help other users of NetComm modem/routers.

Okay, I've worked out what's going on at my end. You're right that my modem/router is behaving oddly. You can see from the attached output what happened when I then tried to reconnect. Instead of rejecting the (now) unrecognised lease, my modem/router acknowledged it and set the IP address to "0.0.0.0".

I just posted a more detailed description of this new information to the 'dhcpcd' mailing list. You can view my email here: http://roy.marples.name/archives/dhcpcd-discuss/2011/0310.html. I will also contact the technical support area of NetComm to see if they can provide any insight about the issue.

Loading...