FS#31916 - [netcfg] netcfg not close properly dhclient

Attached to Project: Arch Linux
Opened by Igor (igvek) - Friday, 12 October 2012, 18:30 GMT
Last edited by Jouke Witteveen (jouke) - Monday, 15 October 2012, 08:53 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Jouke Witteveen (jouke)
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
netcfg not close properly dhclient (netcfg options -d or -r) (profile with IP='dhcp', DHCLIENT='yes')

Problem:
(log file netcfg_before.txt)

--------------------------------------------
iLaptop ~ # NETCFG_DEBUG="yes" netcfg -r lte
...
:: lte down
DEBUG: ethernet_down dhclient -q -x lte0
...
:: lte up
...
DEBUG: ethernet_up dhclient -q -e TIMEOUT=30 -pf /run/dhclient-lte0.pid lte0
...
--------------------------------------------

On up profile (lte0), dhclient options "... -pf /run/dhclient-lte0.pid', but on down, dhclient options without pid file name. -> Default dhclient pid-file = RUNDIR/dhclient.pid (from man 8 dhclient).

To fix problem, suggest:
In file:
/usr/lib/network/connections/ethernet
in function ethernet_down()
change:
---
229 if [[ "$IP" == "dhcp" ]]; then
230 if checkyesno "${DHCLIENT:-no}"; then
231 if [[ -f "/run/dhclient-$INTERFACE.pid" ]]; then
232 report_debug ethernet_down dhclient -q -x "$INTERFACE"
233 dhclient -q -x "$INTERFACE" &>/dev/null
234 #dhclient -q -r "$INTERFACE" &>/dev/null
235 fi
236 else
---

on:
+++
229 if [[ "$IP" == "dhcp" ]]; then
230 _DHCLIENT_PIDFILE="/run/dhclient-${INTERFACE}.pid"
231 if checkyesno "${DHCLIENT:-no}"; then
232 if [[ -f "$_DHCLIENT_PIDFILE" ]]; then
233 report_debug ethernet_down dhclient -q -x -pf "$_DHCLIENT_PIDFILE" "$INTERFACE"
234 dhclient -q -x -pf "$_DHCLIENT_PIDFILE" "$INTERFACE" &>/dev/null
235 #dhclient -q -r "$INTERFACE" &>/dev/null
236 fi
237 else
+++

^^^--- add variable _DHCLIENT_PIDFILE, and add it to dhclient params (-pf).

also confuses line:
246 report_debug ethernet_down dhclient -6 -q -x "$INTERFACE"
247 dhclient -6 -q -x "$INTERFACE" &>/dev/null
248 report_debug ethernet_down /bin/kill $(< /run/dhclient6-$INTERFACE.pid)
249 /bin/kill $(< /run/dhclient6-$INTERFACE.pid) &>/dev/null
strange way to stop dhclient (but I have not worked with IPv6, perhaps this is the right code). However, I think it is better to close, indicating the PID file, as done above.


(sorry for my english)

Additional info:
* package version(s)
netcfg 2.8.11-1
dhclient 4.2.4.1-2

* config and/or log files etc.
netcfg_before.txt log working netcfg before fix
netcfg_after.txt log working netcfg after fix dhclient problem.

Steps to reproduce:
This task depends upon

Closed by  Jouke Witteveen (jouke)
Monday, 15 October 2012, 08:53 GMT
Reason for closing:  Fixed
Additional comments about closing:  326cf
Comment by Igor (igvek) - Friday, 12 October 2012, 20:17 GMT
Here's a patch I can, but was only able to check IPv4.
Comment by Igor (igvek) - Friday, 12 October 2012, 21:45 GMT
And patch include correct stop dhclient and remove dhclient-interface.pid file after down interface (option -d). (check for IPv4)

Loading...