dhclient '-n' option problem

hs bai hsoskernels at gmail.com
Mon Dec 19 03:03:30 UTC 2011


Hi experts,

I have a question on '-n' option of the dhclient program,
from version dhcp-4.0.1 the handling of '-n' option
of the dhclient changed,

version previous to dhcp-4.0.1 the below command works
as expeced
dhclient -n -w

from version dhcp-4.0.1 the below command fails like following
dhclient -n -w ethX

print usage messages and exit

the dhclient will initialise all interfaces but not just ethX specified
in the command line
dhclient -w ethX -n

Namely, the location of the '-n' option on the command line has
effect on the functionality of the option, for the reason 'if .. else if'
statement in C language has priority,

for (i = 1; i < argc; i++) {
   } else if (!strcmp(argv[i], "-n")) {
                        /* do not start up any interfaces */
                        interfaces_requested = -1;
   } else if (argv[i][0] == '-') {
                    usage();
                } else if (interfaces_requested < 0) {
                    usage();
   } else {


Handling the '-n' option like this is designed behaviour or a hidden bug?
If its designed to be so, why the location of the option has impacts
on its functionality? I am confused, would you help me out?

Thanks
bhs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20111219/521ed642/attachment.html>


More information about the dhcp-users mailing list