FS#23293 - [netcfg] Please terminate 'dhcpcd' using the correct '-k' option
Attached to Project:
Arch Linux
Opened by Xavion (Xavion) - Wednesday, 16 March 2011, 03:26 GMT
Last edited by Rémy Oudompheng (remyoudompheng) - Friday, 08 July 2011, 05:25 GMT
Opened by Xavion (Xavion) - Wednesday, 16 March 2011, 03:26 GMT
Last edited by Rémy Oudompheng (remyoudompheng) - Friday, 08 July 2011, 05:25 GMT
|
Details
This bug report is intended for the maintainer of the
'netcfg' package. It is not a duplicate of "
----- 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 Rémy Oudompheng (remyoudompheng)
Friday, 08 July 2011, 05:25 GMT
Reason for closing: Implemented
Friday, 08 July 2011, 05:25 GMT
Reason for closing: Implemented
This works for Ethernet and wireless, provided that users call 'netcfg' directly or use "net-auto-wired". If they use "net-auto-wireless" instead, 'dhcpcd' is killed without the '-k' option. This is probably because "/usr/lib/network/connections/ethernet" isn't used.
Rather than doing so directly, it's probably better to use your framework. You can add something like "/usr/bin/netcfg iface-down "$interface"" directly above "stop_wpa $2" in "/usr/bin/netcfg-wpa_actiond". Doing this ensures that the stale ".lease" file is removed when the "net-auto-wireless" daemon is stopped.
You guys might have a better idea, since you know your code better than I do. Since it's a significant addition, you might wanna check that everything works as expected at your end before committing this change to the repository.
I see that your "ethernet_up()" function in "/usr/lib/network/connections/ethernet" contains support for 'dhclient', but your "ethernet_down()" function in the same file does not.
This means that instances of 'dhclient' remain running after disconnecting and their stale leases aren't removed either. I might see if I can figure out a solution to this problem relatively soon.
You can probably just replace the "ethernet_down()" function of your "/usr/lib/network/connections/ethernet" file with what I've included in the attachment. It works fine here, but you should probably test it at your end too.
BTW, I just opened "
FS#23308", since 'dhclient' can't create the lease files at all right now. You might wonder why I'm complaining, since it fixes my problem. It's the horribly dodgy nature of such an accidental workaround that I couldn't condone :-).This new wiki section would advise users with routers like mine to add either of the following lines to a "/etc/network.d/interfaces/eth0" file:
PRE_DOWN="dhcpcd -qk eth0 &>/dev/null || true"
PRE_DOWN="dhclient -q -r eth0 &>/dev/null || true"
Two of the lines in my above attachment of the new "ethernet_down()" function could then be softened to retain lease files as follows:
dhcpcd -qx "$INTERFACE" &>/dev/null
dhclient -q -x "$INTERFACE" &>/dev/null
This compromised method might be better, assuming that users with dodgy routers are wise enough to read the wiki article. I dunno if that'll be the case, given that I lived with this problem for months before finally deciding to do something about it.
Another point to note is that I recently convinced the 'dhcpcd' author to fix the problem that my "ethernet.patch" file works around at his end. I then submitted the same request to the authors of 'dhclient'. They initially acknowledged the problem, but I haven't heard anything back from them since.