where do I find the NTP server address with 'dhcpc -O ntpsrv'
Laurent Bercot
ska-dietlibc at skarnet.org
Mon Oct 3 13:22:47 UTC 2011
> 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' ?
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);
So if you start your client with "udhcpc -O ntpsrv", if my guess is
correct, you should get the NTP server address in the "opt0" environment
variable.
--
Laurent
More information about the busybox
mailing list