Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 349305 - net-misc/dhcpcd-5.2.* ignores the -r command line option
Summary: net-misc/dhcpcd-5.2.* ignores the -r command line option
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-21 17:46 UTC by Simone Scanzoni
Modified: 2011-01-06 01:20 UTC (History)
3 users (show)

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


Attachments
Fix request (dhcpcd-request.diff,2.85 KB, text/plain)
2010-12-23 22:03 UTC, Roy Marples
Details
tcpdump -s0 -w/tmp/dhcpcd-5.2.9.raw -ieth0 (dhcpcd-5.2.9.raw,3.97 KB, application/octet-stream)
2010-12-25 01:59 UTC, Simone Scanzoni
Details
After dhcpcd -k eth0 (dhcpcd-5.2.9-2.raw,3.46 KB, application/octet-stream)
2010-12-25 18:42 UTC, Simone Scanzoni
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simone Scanzoni 2010-12-21 17:46:16 UTC
With dhcpcd-4.0.15 using -r works, with 5.2.8 and 5.2.9 it seems to be ignored and I get the wrong IP address. Downgrading to 4.0.15 solved the problem.
When I activate the interface with 4.0.15 there's a line saying:
eth0: broadcasting for a lease of "address"
(where "address" is the one I've chosen) while with versions 5.2.[89] it says:
eth0: broadcasting for a lease
The configuration I used is always the same, the default installed with dhcpcd-5.2.8 but with clientid enabled in /etc/dhcpcd.conf .

Reproducible: Always

Steps to Reproduce:
1. Choose an "interface" and an available "address".
2. dhcpcd -r "address" "interface"
Actual Results:  
I receive a random address from the available ones.

Expected Results:  
I should receive the address I requested.

emerge --info :
Portage 2.1.9.25 (default/linux/amd64/10.0, gcc-4.4.4, glibc-2.11.2-r3, 2.6.36-gentoo-r5 x86_64)
=================================================================
System uname: Linux-2.6.36-gentoo-r5-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4200+-with-gentoo-2.0.1
Timestamp of tree: Mon, 20 Dec 2010 13:45:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.1_p7
dev-java/java-config: 2.1.11-r1
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1-r1
sys-apps/openrc:     0.6.6
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13::<unknown repository>, 2.65-r1
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA PUEL Q3AEULA skype-eula ut2003 Introversion googleearth @EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=athlon64 -mfpmath=sse -pipe -fomit-frame-pointer -msse3 -fpredictive-commoning -fgcse-after-reload"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/games/angband/edit/ /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /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=athlon64 -mfpmath=sse -pipe -fomit-frame-pointer -msse3 -fpredictive-commoning -fgcse-after-reload"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs ccache distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="it_IT.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="it"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/gnustep /var/lib/layman/roslin /var/lib/layman/sunrise /var/lib/layman/gamerlay /var/lib/layman/x11 /usr/local/portage/nonno"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext R S3TC X a52 aac acpi additions aiglx alsa amd64 amr apache2 archive artworkextra automount bash-completion bdf bittorrent blas blender-game branding bullet bzip2 cairo caps ccache cdio cdr cli cracklib cups curl cxx dbus device-mapper disk-partition djvu dri dts dvb dvd dvdr dvdread dvi edb encode escreen exif expat extensions extra-dark faac fam fasttrack ffmpeg fftw flac fontconfig fontforge fortran ftp gd gdbm gif gimp gimpprint glib glibc-omitfp glitz gnet gnutella gnutls gpm gsl gstreamer gtk gtkhtml gzip-el hou hpn ical iconv icu imagemagick imap imlib inkjar inotify inquisitio iproute2 ithreads java java6 javascript joystick jpeg jpeg2k kdehiddenvisibility kqemu lapack laptop latex lcdfilter lcms liblockfile libmpd libnotify libsamplerate libyaml linuxthreads-tls lirc llvm lua lzma lzo mad maildir matroska mbrola mercurial midi mikmod mmap mmx mmxext mng modules moznocompose moznoirc moznomail mp3 mpeg mplayer msn mudflap multilib musicbrainz netplay network nfs nls nntp no-old-linux nokia nowin nptl nptlonly nsplugin ntp oav objc ods ogg opengl openmp optimized-qmake pam pccts pch pcre pdf perl plotutils png policykit portage postproc ppds pppd python python3 qt3support quicktime readline realmedia rle rtmp sasl session slp smp sms sndfile sound sox spell sse sse2 sse3 ssl startup-notification stream subtitles svg svgz sysfs t1lib taglib tagwriting tcpd tetex theora thin-splines threads threadsafe thunar tiff tordns totem track-src-odirect truetype udev udis86 ui unicode usb userlocales utempter v4l v4l2 vchroot vim vim-syntax visibility vorbis vpx websockets wmf wxwidgets wxwindows x264 xcb xcomposite xfce xft xls xml xmp xorg xrandr xulrunner xv xvid zlib zvbi" ALSA_CARDS="emu10k1" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DVB_CARDS="usb-dib0700" 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 ubx" INPUT_DEVICES="keyboard mouse aiptek evdev joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="it" LIRC_DEVICES="pctv" PHP_TARGETS="php5-2" QEMU_SOFTMMU_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18" SANE_BACKENDS="canon_pp" USERLAND="GNU" VIDEO_CARDS="radeon v4l fglrx" XFCE_PLUGINS="logout menu" 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, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 William Hubbs gentoo-dev 2010-12-22 21:31:29 UTC
Roy,

I can confirm this behaviour in 5.2.9.

Thanks,

William
Comment 2 Roy Marples 2010-12-23 22:03:50 UTC
Created attachment 257897 [details]
Fix request

Please test the attached patch
Comment 3 Simone Scanzoni 2010-12-24 16:46:06 UTC
(In reply to comment #2)
> Created an attachment (id=257897) [details]
> Fix request
> 
> Please test the attached patch
> 

Tested with 5.2.8 and 5.2.9 : no change.

Happy Holidays to everybody.
Comment 4 Roy Marples 2010-12-24 20:55:36 UTC
Can you post a full tcpdump of the DHCP transaction please?
tcpdump -s0 -w/tmp/dhcpcd.raw -ieth0
Comment 5 Simone Scanzoni 2010-12-25 01:59:32 UTC
Created attachment 257997 [details]
tcpdump -s0 -w/tmp/dhcpcd-5.2.9.raw -ieth0

I used dhcpcd-5.2.9 with the above patch.

dhcpcd -r 23.10.120.51 -m 3 eth0

I got 23.10.120.50
Comment 6 Roy Marples 2010-12-25 07:49:59 UTC
The trace clearly shows that your IP is now requested correctly, however the DHCP server still sent you the "wrong" one.
With dhcpcd still running, you can release the "wrong" one and try again.

dhcpcd -k eth0
dhcpcd -r 23.10.120.51 -m 3 eth0
Comment 7 Christopher Brannon (RETIRED) gentoo-dev 2010-12-25 15:48:53 UTC
I reproduced the bug, and the patch works for me.

Comment 8 Simone Scanzoni 2010-12-25 18:42:09 UTC
Created attachment 258043 [details]
After dhcpcd -k eth0

This time I ran:
# dhcpcd -r 23.10.120.52 -m 3 eth0
and I got 23.10.120.50/24 .

Doing
# dhcpcd -k eth0
before
# dhcpcd -r 23.10.120.51 -m 3 eth0
worked once. After that I always got 23.10.120.51 even if I requested a different address after dhcpcd -k eth0.

(with version 4.0.15 dhcpcd -r "address" always gets the address requested)
Comment 9 Simone Scanzoni 2010-12-29 13:33:50 UTC
I've been using version 5.2.9 (patched) for some days and the behavior seems to be that I get the requested address if I wait enough from the last time the DHCP server assigned an address to this PC. After I get an address, whatever it was, doing dhcpcd -k and a new request with a different address always gives me the first I got.
Comment 10 Roy Marples 2011-01-03 08:32:23 UTC
(In reply to comment #9)
> I've been using version 5.2.9 (patched) for some days and the behavior seems to
> be that I get the requested address if I wait enough from the last time the
> DHCP server assigned an address to this PC. After I get an address, whatever it
> was, doing dhcpcd -k and a new request with a different address always gives me
> the first I got.

That is an issue with the DHCP server then.
ISC DHCPd 3.0.3 gives me the address I request every time correctly unless I request an out of bounds IP or configure the DHCP server to give me a fixed IP.
Comment 11 Roy Marples 2011-01-03 11:47:38 UTC
dhcpcd-5.2.10 has been released with this change
Comment 12 William Hubbs gentoo-dev 2011-01-03 19:11:54 UTC
Also, dhcpcd-5.2.10 is now in portage.

Roy, thanks a lot. :-)

Comment 13 Simone Scanzoni 2011-01-04 22:34:53 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > [...]
> 
> That is an issue with the DHCP server then.
> ISC DHCPd 3.0.3 gives me the address I request every time correctly unless I
> request an out of bounds IP or configure the DHCP server to give me a fixed IP.
> 

Ok, it's strange that it worked with dhcpcd-4.0.15 then.
Thanks a lot.
Comment 14 Roy Marples 2011-01-04 23:42:37 UTC
(In reply to comment #13)
> Ok, it's strange that it worked with dhcpcd-4.0.15 then.
> Thanks a lot.

Old behaviour with request was to directly request the IP address.
New behaviour is to request it as an option in the DISCOVER phase.

With the new way, we can request the address each time we do a discover.
With the old way, it was only the first time. So when carrier went down for whatever reason it didn't attempt to re-request the address.

Still, I would describe what you are seeing as a DHCP server bug though.
Comment 15 Simone Scanzoni 2011-01-06 01:20:31 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > Ok, it's strange that it worked with dhcpcd-4.0.15 then.
> > Thanks a lot.
> 
> Old behaviour with request was to directly request the IP address.
> New behaviour is to request it as an option in the DISCOVER phase.
> 
> With the new way, we can request the address each time we do a discover.
> With the old way, it was only the first time. So when carrier went down for
> whatever reason it didn't attempt to re-request the address.
> 
> Still, I would describe what you are seeing as a DHCP server bug though.
> 

I didn't doubt your words. I already thought it could be a bug in the server, because I know that in general a better behaviour may trigger bugs somewhere else. But it's the kind of thing that makes me say "D'Oh!".
Really, thanks for the explanation.
:)