Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 519944 - net-misc/netifrc-0.2.2 - additional action required to terminate =net-misc/dhcpcd-6.4.3 when dhcp_ethX="release"
Summary: net-misc/netifrc-0.2.2 - additional action required to terminate =net-misc/dh...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: netifrc (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: netifrc Team
URL:
Whiteboard: netifrc:dhcpcd, git:merged:42aa703
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-14 23:16 UTC by Nuno Silva
Modified: 2016-10-24 21:25 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to use dhcpcd -k instead of SIGHUP in netifrc (netifrc-0.2.2-release.patch,962 bytes, patch)
2014-09-20 07:37 UTC, Nuno Silva
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nuno Silva 2014-08-14 23:16:07 UTC
=net-misc/netifrc-0.2.2 will send SIGHUP to net-misc/dhcpcd if the interface configuration in /etc/conf.d/net includes "release".

According to /lib/netifrc/net/dhcpcd.sh, this will make the init script send SIGHUP to dhcpcd.

In previous versions, dhcpcd would terminate when it received SIGHUP:

  dhcpcd[21870]: received SIGHUP from PID 24162, releasing
  dhcpcd[21870]: eth1: removing interface
  dhcpcd[21870]: exited

But =net-misc/dhcpcd-6.4.3 will only drop the current lease, and it will actually try to get a lease again:

  dhcpcd[22281]: received signal HUP from PID 22448, rebinding
  dhcpcd[22281]: eth0: IAID XX:XX:XX:XX
  dhcpcd[22281]: eth0: rebinding lease of 82.130.X.X
  dhcpcd[22281]: eth0: soliciting an IPv6 router
  dhcpcd[22281]: eth0: Router Advertisement from fe80::1
  [...]

According to the manpage, invoking "dhcpcd -k ethX" will release the lease and cause the running dhcpcd instance to exit:

  dhcpcd[10227]: sending signal ARLM to pid 10150
  dhcpcd[10150]: received signal ALRM from PID 10227, releasing
  dhcpcd[10150]: eth0: removing interface
  dhcpcd[10150]: eth0: deleting address 2001:708:X:X:X:X:X:X/64
[...]
  dhcpcd[10150]: eth0: releasing lease of 82.130.X.X
[...]
  dhcpcd[10150]: exited

I have tested "dhcpcd -k ethX" with =net-misc/dhcpcd-6.2.0-r1, and it seems to work in the same way (it releases the lease and then terminates). But, in this case, "dhcpcd -k [...]" will actually send SIGHUP to the running dhcpcd process:

  dhcpcd[10516]: sending signal 1 to pid 10356
  dhcpcd[10516]: waiting for pid 10356 to exit
  dhcpcd[10356]: received SIGHUP from PID 10516, releasing


Reproducible: Always

Steps to Reproduce:
1. Configure the network interface to use DHCP via dhcpcd
2. Include "release" in the DHCP options
3. Start and then stop the network interface openrc script
Actual Results:  
dhcpcd is left running and the DHCP lease is not released.

Expected Results:  
dhcpcd should not be running anymore and the DHCP lease should have been released.

Portage 2.2.8-r1 (default/linux/x86/13.0, gcc-4.7.3, glibc-2.19-r1, 3.10.17-gentoo-ir1-20131213 i686)
=================================================================
System uname: Linux-3.10.17-gentoo-ir1-20131213-i686-Intel-R-_Pentium-R-_M_processor_1.73GHz-with-gentoo-2.2
KiB Mem:      762996 total,    112572 free
KiB Swap:     996024 total,    871116 free
Timestamp of tree: Mon, 11 Aug 2014 16:00:01 +0000
ld GNU gold (GNU Binutils 2.23.2) 1.11
distcc 3.1 i686-pc-linux-gnu [disabled]
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.7, 3.3.5-r1
dev-util/cmake:           2.8.12.2-r1
dev-util/pkgconfig:       0.28-r1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.13.4
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.7.3-r1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.13 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo lisp finnish emacs poly-c steam-overlay x-portage
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=native -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -march=i686 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch usersandbox usersync"
FFLAGS="-O2 -march=i686 -pipe"
GENTOO_MIRRORS="ftp://trumpetti.atm.tut.fi/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS=""
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/lisp /var/lib/layman/finnish /var/lib/layman/emacs /var/lib/layman/poly-c /var/lib/layman/steam /usr/local/portage"
USE="X acl alsa berkdb bzip2 cli cracklib crypt cxx djvu dri dvi emacs fortran gdbm iconv ipv6 mmx modules ncurses nls nptl opengl openmp pam pcre ppp qt3support readline session sse sse2 ssl steamruntime tcpd unicode x86 zlib" ABI_X86="32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="sq905 canon ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse synaptics evdev aiptek" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en pt fi" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" SANE_BACKENDS="net" USERLAND="GNU" VIDEO_CARDS="vesa intel i915" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
Comment 1 Nuno Silva 2014-08-15 13:33:22 UTC
eroen pointed on IRC that netifrc used to issue "dhcpcd -k" for dhcp_ethX="release", but this was changed to send SIGHUP through start-stop-daemon:

http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commitdiff;h=58bea85f922549b88efb8fc163ad8c82de4fdfd1

Meanwhile, dhcpcd was changed so that, while -k maintains the same meaning, it now uses SIGALRM instead of SIGHUP, 

"HUP now rebinds, ALRM now releases - the -x and -k flags work as they used to", 
http://mail-index.netbsd.org/source-changes/2014/03/14/msg052733.html
Comment 2 Jochen Schlick 2014-08-28 20:07:03 UTC
I have the same problem with my wlan devices when switching from one network to another...

dhcpcd[12106]: received signal HUP from PID 6759, rebinding
dhcpcd[12106]: wlan0: IAID 64:3e:9d:d8
dhcpcd[12106]: wlan0: soliciting an IPv6 router
dhcpcd[12106]: wlan0: rebinding lease of 10.1.2.29
/etc/init.d/net.wlan0[6759]: start-stop-daemon: 1 process refused to stop
dhcpcd[12106]: wlan0: removing IP address 10.1.2.29/24
dhcpcd[12106]: wlan0: deleting route to 10.1.2.0/24
dhcpcd[12106]: wlan0: deleting default route via 10.1.2.1
dhcpcd[12106]: wlan0: carrier lost
Comment 3 Roy Marples 2014-09-11 13:58:25 UTC
Please use dhcpcd -k if you want to release.

You can use SIGTERM or dhcpcd -x to exit normally.
Comment 4 Nuno Silva 2014-09-20 07:37:03 UTC
Created attachment 385158 [details, diff]
Patch to use dhcpcd -k instead of SIGHUP in netifrc

With this patch, dhcpcd.sh will use dhcpcd -k when the option "release" is set; otherwise start-stop-daemon is used to send SIGTERM.

Tested with netifrc-0.2.2 on amd64 (without "release") and x86 (with "release").
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2014-09-24 06:20:53 UTC
committed to the repo, commit 42aa703, watch for it in the next release
Comment 6 Jochen Schlick 2014-11-05 19:34:01 UTC
next release ? next year ?
Comment 7 Matthew Schultz 2014-11-05 20:41:01 UTC
(In reply to Jochen Schlick from comment #6)
> next release ? next year ?

I'm using 0.2.4 and I've confirmed it's in there.  You'll just need to keyword netifrc to install it since it's not stable yet.
Comment 8 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2016-10-24 21:25:18 UTC
in 0.3.0