Red Hat Bugzilla – Bug 815816
dhclient doesn't report failure to open given config file
Last modified: 2012-04-24 11:34:55 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):
Steps to Reproduce:d
1. Run dhclient -cf ./dhclient.conf eth0 where ./dhclient.conf file doesn't exist
2. # ls -l
# dhclient -cf ./dhclient.conf eth0
# echo $?
dhclient silently goes over missing config file and reports exit status 0.
dhclient should at least exit with non-zero status or even better complain about missing conf file or permission error
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
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.