Bug 815816

Summary: dhclient doesn't report failure to open given config file
Product: Red Hat Enterprise Linux 6 Reporter: Ladislav Jozsa <ljozsa>
Component: dhcpAssignee: Jiri Popelka <jpopelka>
Status: CLOSED NOTABUG QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3   
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-24 15:34:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 760559    

Description Ladislav Jozsa 2012-04-24 14:57:22 UTC
Description of problem:
When running dhclient -cf ./dhclient.conf eth0 and the conf file is unreadable e.g. due to SELinux permissions or the conf file simple does not exist, dhclient does not report error nor non-zero exit status.

Version-Release number of selected component (if applicable):
dhclient-4.1.1-30.P1.el6

How reproducible:
always

Steps to Reproduce:d
1. Run dhclient -cf ./dhclient.conf eth0 where ./dhclient.conf file doesn't exist
2. # ls -l
total 0

# dhclient -cf ./dhclient.conf eth0

# echo $?
0
  
Actual results:
dhclient silently goes over missing config file and reports exit status 0.

Expected results:
dhclient should at least exit with non-zero status or even better complain about missing conf file or permission error

Additional info:
Filtered outpupt from strace:

grep open /tmp/dhclient.out 
open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib64/libcap-ng.so.0", O_RDONLY) = 3
open("/lib64/libc.so.6", O_RDONLY)      = 3
open("/dev/null", O_RDWR|O_CLOEXEC)     = 3
open("/etc/nsswitch.conf", O_RDONLY)    = 4
open("/etc/ld.so.cache", O_RDONLY)      = 4
open("/lib64/libnss_files.so.2", O_RDONLY) = 4
open("/etc/services", O_RDONLY|O_CLOEXEC) = 4
open("/var/run/dhclient.pid", O_RDONLY|O_CLOEXEC) = 4
open("/var/run/dhclient.pid", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644) = 4
open("/proc/net/dev", O_RDONLY|O_CLOEXEC) = 4
open("./dhclient.conf", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
open("/var/lib/dhclient/dhclient.leases", O_RDONLY|O_CLOEXEC) = 4
open("/var/lib/dhclient/dhclient.leases", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 4
open("/etc/localtime", O_RDONLY)        = 5
open("/proc/net/dev", O_RDONLY|O_CLOEXEC) = 5

Comment 2 Jiri Popelka 2012-04-24 15:34:55 UTC
Thank you for the report, however I think I have to disagree here.
dhclient (unlike dhcpd) can freely work without any configuration file.
The dhclient.conf serves only to overwrite the default values.

You can see (rpm -ql dhclient) that we don't ship any dhclient.conf because the defaults are fine in most cases. If I fixed this bug I'd need to ship dhclient with default (empty) dhclient.conf.