Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 May 2008 21:59:58 +0200
From:      Mel <fbsd.questions@rachie.is-a-geek.net>
To:        freebsd-questions@freebsd.org
Cc:        Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>
Subject:   Re: dummy dhclient
Message-ID:  <200805122159.59596.fbsd.questions@rachie.is-a-geek.net>
In-Reply-To: <20080512183319.K82433@wojtek.tensor.gdynia.pl>
References:  <20080512183319.K82433@wojtek.tensor.gdynia.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 12 May 2008 18:34:32 Wojciech Puchar wrote:
> is there an option in dhclient (or other program) to try getting IP
> address but - don't set anything in system.
>
> i mean something to just check for dhcp servers.
>
> or maybe something that just detects what DHCP servers are available.

The largely undocumented dhclient_exit|enter_hooks are suitable for this. Look 
at the source of /sbin/dhclient-script.
In short, if you set exit_status to non-zero in /etc/dhclient-enter-hooks, 
nothing will be set. Some environment variables will be available to you, 
among which should be the ip of the dhcp server that responded. If you simply 
dump the env to stdout, you will see things available.

-- 
Mel

Problem with today's modular software: they start with the modules
    and never get to the software part.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805122159.59596.fbsd.questions>