where do I find the NTP server address with 'dhcpc -O ntpsrv'

Lambrecht Jürgen J.Lambrecht at TELEVIC.com
Mon Oct 10 15:49:35 UTC 2011


On 10/09/2011 08:49 PM, Denys Vlasenko wrote:
>
> On Monday 03 October 2011 15:22, Laurent Bercot wrote:
> > > The NTP server ip is distributed via DHCP in my case.
> > > So I want to do 'ntpd -p $NTP_SERVER'.
> > > But that variable $NTP_SERVER is empty, and also /etc/ntp.conf 
> does not
> > > exist.
> > >
> > > Does anybody know where to find the NTP server's IP address received
> > > with 'dhcpc -O ntpsrc' ?
>
> I suppose you meant "ntpsrv".
>
indeed
>
>
>
> >  If I understand the udhcpc.c code correctly, result of unknown options
> > listed with "-O foobar" are put into the environment via the line
> >   ofs = sprintf(*curr, "opt%u=", i);
>
> But ntpsrv is a *known* option, therefore it is exported as $ntpsrv
>
indeed, found that out in the mean time..
>
> environment variable to the udhcpc script, a-la
>
indeed, "to the udhcpc script", and not to the shell environment 
variables as I thought wrongly 
(http://stackoverflow.com/questions/6981033/why-setenv-does-not-work)
>
>
> ntpsrv='10.4.2.125 10.4.5.7'
>
> See examples/var_service/dhcp_if/* for an example.
>
ok, I will check this. Thanks. I thought that the "putenv(..)" code was 
useless, and should be removed from dhcpc.c.

Regards,
Jürgen
>
>
> --
> vda
>


-- 
Jürgen Lambrecht
R&D Associate
Tel: +32 (0)51 303045    Fax: +32 (0)51 310670
http://www.televic-rail.com
Televic Rail NV - Leo Bekaertlaan 1 - 8870 Izegem - Belgium
Company number 0825.539.581 - RPR Kortrijk


More information about the busybox mailing list