Bug 815816 - dhclient doesn't report failure to open given config file
dhclient doesn't report failure to open given config file
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: dhcp (Show other bugs)
All Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: Jiri Popelka
Release Test Team
Depends On:
Blocks: 760559
  Show dependency treegraph
Reported: 2012-04-24 10:57 EDT by Ladislav Jozsa
Modified: 2012-04-24 11:34 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-04-24 11:34:55 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Ladislav Jozsa 2012-04-24 10:57:22 EDT
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):

How reproducible:

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 $?
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 11:34:55 EDT
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.

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