Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 265531 - net-misc/dhcp-3.1.1: dhclient ignores nogateway option and installs a gateway regardless
Summary: net-misc/dhcp-3.1.1: dhclient ignores nogateway option and installs a gateway...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High major
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-09 10:44 UTC by Dmitry
Modified: 2012-10-10 03:48 UTC (History)
4 users (show)

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


Attachments
patch to fix the bug (dhclient-script.diff,1.08 KB, patch)
2010-01-09 23:52 UTC, Laszlo Valko
Details | Diff
patch for version 3.1.3_p1 (dhclient-script-3.1.3_p1.patch,1.31 KB, patch)
2010-10-18 11:57 UTC, Laszlo Valko
Details | Diff
patch for version 4.1.0 (dhclient-script-4.1.0.patch,1.69 KB, patch)
2010-10-18 11:57 UTC, Laszlo Valko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry 2009-04-09 10:44:39 UTC
dhclient --version 
isc-dhclient-V3.1.1-Gentoo
Some problem with -e PEER_ROUTERS=no 
Doesn't matter flag is "Yes" or "NO" , anyway client update routing table on machine, I mean default gateway.

Reproducible: Always

Steps to Reproduce:
1.change /etc/conf.d/net file regarding dhcp_eth1="nodns nogateway"
2./etc/ini.d/net.eth1 restart
3.change /etc/conf.d/net file regarding dhcp_eth1="nodns"
4./etc/ini.d/net.eth1 restart


Actual Results:  
 
root 15427 1 0 17:03 ? 00:00:00 /sbin/dhclient -e PEER_ROUTERS=no -e PEER_DNS=no -e PEER_NTP=yes -q -1 -pf /var/run/dhclient-eth1.pid eth1
 
 
QWERTY1 conf.d #
netstat -rn 
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.140.35.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 10.140.35.250 0.0.0.0 UG 0 0 0 eth1
QWERTY1 conf.d #

Expected Results:  
QWERTY1 film # emerge -pv net-misc/dhcp

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] net-misc/dhcp-3.1.1  USE="-doc -minimal (-selinux) -static" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB
QWERTY1 film #


QWERTY1 film # emerge -pv net-misc/dhcp

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] net-misc/dhcp-3.1.1  USE="-doc -minimal (-selinux) -static" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB
QWERTY1 film #
Comment 1 David Abbott (RETIRED) gentoo-dev 2009-04-09 17:44:35 UTC
Please post emerge --info
Comment 2 Dmitry 2009-04-09 19:17:40 UTC
QWERTY1 ~ # emerge --info
Portage 2.1.6.7 (default/linux/x86/2008.0, gcc-4.1.2, glibc-2.8_p20080602-r1, 2.6.24-gentoo-r8 i686)
=================================================================
System uname: Linux-2.6.24-gentoo-r8-i686-Intel-R-_Celeron-R-_CPU_2.53GHz-with-glibc2.0
Timestamp of tree: Wed, 08 Apr 2009 01:45:01 +0000
distcc 3.0 i686-pc-linux-gnu [disabled]
app-shells/bash:     3.2_p39
dev-lang/python:     2.4.4-r14, 2.5.2-r7
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.6.3, 1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.gentoo.se/ ftp://ftp.du.se/pub/os/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j8"
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="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl apache2 berkdb bzip2 cli cracklib crypt cups diskio dri fortran ftp gd gdbm gpm iconv imap ipv6 isdnlog lm_sensors midi mmx mudflap mysql ncurses nls nptl nptlonly openmp pam pcre perl postgres pppd python readline reflection session snmp soap spl ssl sysfs tcpd truetype unicode x86 xml xorg zip zlib" 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" 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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="fbdev glint i810 intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Dmitry 2009-04-09 19:18:02 UTC
QWERTY1 ~ # emerge --info
Portage 2.1.6.7 (default/linux/x86/2008.0, gcc-4.1.2, glibc-2.8_p20080602-r1, 2.6.24-gentoo-r8 i686)
=================================================================
System uname: Linux-2.6.24-gentoo-r8-i686-Intel-R-_Celeron-R-_CPU_2.53GHz-with-glibc2.0
Timestamp of tree: Wed, 08 Apr 2009 01:45:01 +0000
distcc 3.0 i686-pc-linux-gnu [disabled]
app-shells/bash:     3.2_p39
dev-lang/python:     2.4.4-r14, 2.5.2-r7
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.6.3, 1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.gentoo.se/ ftp://ftp.du.se/pub/os/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j8"
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="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl apache2 berkdb bzip2 cli cracklib crypt cups diskio dri fortran ftp gd gdbm gpm iconv imap ipv6 isdnlog lm_sensors midi mmx mudflap mysql ncurses nls nptl nptlonly openmp pam pcre perl postgres pppd python readline reflection session snmp soap spl ssl sysfs tcpd truetype unicode x86 xml xorg zip zlib" 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" 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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="fbdev glint i810 intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

QWERTY1 ~ #
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-04-10 08:04:35 UTC
chainsaw: yours I think.
Comment 5 Dmitry 2009-08-14 12:21:21 UTC
Who can reproduce problem on your local PC/server ?
PS : generic option till now does't works.

--------------------net.example-------------------
# GENERIC DHCP OPTIONS
# Set generic DHCP options like so
#dhcp_eth0="release nodns nontp nonis nogateway nosendhost"

# This tells the dhcp client to release it's lease when it stops, not to
# overwrite dns, ntp and nis settings, not to set a default route and not to
# send the current hostname to the dhcp server and when it starts.
# You can use any combination of the above options - the default is not to
# use any of them.
Comment 6 Martin Mokrejš 2009-12-14 18:57:35 UTC
Look into /sbin/dhclient-script, the script is ugly and maybe that is the culprit.
Comment 7 Laszlo Valko 2010-01-09 23:50:17 UTC
(In reply to comment #5)
> Who can reproduce problem on your local PC/server ?
> PS : generic option till now does't works.
> 

The script, /sbin/dhclient-script, which is run by dhclient,
does not reference the environment variable that gets set
for "nogateway": PEER_ROUTERS.

Actually, examining the script reveals that is has no options
to disable setting the default router up at all!

root@odon:/sbin>grep PEER dhclient-script 
  if [ x$PEER_DNS = x ] || [ x$PEER_DNS = xyes ]; then
  if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then
root@odon:/sbin>



> --------------------net.example-------------------
> # GENERIC DHCP OPTIONS
> # Set generic DHCP options like so
> #dhcp_eth0="release nodns nontp nonis nogateway nosendhost"
> 
> # This tells the dhcp client to release it's lease when it stops, not to
> # overwrite dns, ntp and nis settings, not to set a default route and not to
> # send the current hostname to the dhcp server and when it starts.
> # You can use any combination of the above options - the default is not to
> # use any of them.
> 

Comment 8 Laszlo Valko 2010-01-09 23:52:29 UTC
Created attachment 215873 [details, diff]
patch to fix the bug

Here's a proposed solution to the problem: make default router setup conditional on environment variable PEER_ROUTERS.

I tested it shortly, and it works for me.
Comment 9 Martin Samek 2010-05-06 12:40:18 UTC
Yes, I can confirm that patch works for me. Now dhclient ignores default gw from dhcp server on my second interface. Please add patch to the ebuild.
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2010-10-15 07:48:30 UTC
Please update to apply against 3.1.3_p1 and 4.1.x.
Or note if it's not required anymore.
Comment 11 Laszlo Valko 2010-10-18 11:57:11 UTC
Created attachment 251113 [details, diff]
patch for version 3.1.3_p1
Comment 12 Laszlo Valko 2010-10-18 11:57:43 UTC
Created attachment 251115 [details, diff]
patch for version 4.1.0
Comment 13 Laszlo Valko 2010-10-18 12:00:27 UTC
Here you are, please, we'd like to see these applied in the ebuilds. Thanks.
Comment 14 SpanKY gentoo-dev 2011-03-05 23:53:02 UTC
ive included this in dhcp-4.2.1.  dont know if anyone wants to also apply to dhcp-3.x, so i'll leave this open for now.
Comment 15 SpanKY gentoo-dev 2012-10-10 03:48:31 UTC
dhcp-4.x is stable now.  dhcp-3.x is dead.