Bug 496233 - dhclient-script doesn't source ifcfg-* files
Summary: dhclient-script doesn't source ifcfg-* files
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: dhcp
Version: 11
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: David Cantrell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-04-17 13:27 UTC by Miroslav Lichvar
Modified: 2010-01-27 15:20 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-01-27 15:20:23 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Miroslav Lichvar 2009-04-17 13:27:01 UTC
Description of problem:

It seems there was an incompatible change in need_config() and source_config() functions that cause ignoring of NTPPEER=no in ifcfg-* files.

/sbin/dhclient-script contains:

CONFIG="/etc/sysconfig/network-scripts/ifcfg-${interface}"
need_config ${CONFIG}
source_config >/dev/null 2>&1

But this no longer works correctly, need_config now keeps in CONFIG only the basename of the ifcfg path and source_config tries to source it in current directory which is /.

Version-Release number of selected component (if applicable):
initscripts-8.94-1

How reproducible:
always

Steps to Reproduce:
1. configure DHCP server to provide some NTP servers
2. add NTPPEER=no to ifcfg-eth0
3. disable NetworkManager (that's probably another bug)
  
Actual results:
/etc/ntp.conf modified

Expected results:
dhclient doesn't touch /etc/ntp.conf

Additional info:

Comment 1 Bill Nottingham 2009-04-17 14:11:06 UTC
I'm assuming:

diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-script
index 628cae4..c25deef 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -68,8 +68,8 @@ source_config ()
 {
     CONFIG=${CONFIG##*/}
     DEVNAME=${CONFIG##ifcfg-}
-    . ./$CONFIG
-    [ -r "keys-$DEVNAME" ] && . ./keys-$DEVNAME
+    . /etc/sysconfig/network-scripts/$CONFIG
+    [ -r "keys-$DEVNAME" ] && . /etc/sysconfig/network-scripts/keys-$DEVNAME
     case "$TYPE" in
        Ethernet)
                DEVICETYPE="eth"

fixes it for you?

Comment 2 iarly selbir 2009-04-17 15:57:14 UTC
Assigning it.

BugZapper Team Member.

Comment 3 Miroslav Lichvar 2009-04-20 07:43:41 UTC
Not sure what has changed but after update to the latest rawhide it works, the current directory is /etc/sysconfig/network-scripts.

Sorry for the noise.

Comment 4 Miroslav Lichvar 2009-04-21 11:51:34 UTC
Ok, I'm still seeing this. It doesn't show up right after start, but after first DHCP renewal. I guess the first dhclient-script run happens before dhclient chdirs to /.

Adding "cd /etc/sysconfig/network-scripts" to /sbin/dhclient-script should fix it.

Comment 5 David Cantrell 2009-04-21 20:11:35 UTC
Is this the change we need?

Index: dhclient-script
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhclient-script,v
retrieving revision 1.11
diff -u -p -r1.11 dhclient-script
--- dhclient-script	21 Apr 2009 01:14:15 -0000	1.11
+++ dhclient-script	21 Apr 2009 20:11:13 -0000
@@ -420,7 +420,8 @@ if [ -f /etc/sysconfig/networking/networ
     . /etc/sysconfig/networking/network
 fi
 
-CONFIG="/etc/sysconfig/network-scripts/ifcfg-${interface}"
+cd /etc/sysconfig/network-scripts
+CONFIG="ifcfg-${interface}"
 need_config ${CONFIG}
 source_config >/dev/null 2>&1

Comment 6 Miroslav Lichvar 2009-04-21 20:33:36 UTC
Yes, that should do it.

Comment 7 David Cantrell 2009-04-21 20:46:32 UTC
Will be fixed in dhcp-4.1.0-19.fc11 and later.

Comment 8 Bug Zapper 2009-06-09 13:59:59 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping


Note You need to log in before you can comment on or make changes to this bug.