lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] Add support for NTP option in DHCP


From: Sergio R. Caprile
Subject: Re: [lwip-devel] Add support for NTP option in DHCP
Date: Sat, 14 Jun 2014 18:06:09 -0300
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Hi Claudius,
I'm a bit greedy with fn ptrs but you are right, SNTP belongs to a
different tree and as you point out it might be not present or a totally
different module for full NTP.
I will follow the current approach in DNS and DHCP, using ip_addr_t
which currently is IPv4 (afaik)

I would go for something like:

typedef void (*ntp_addserver_callback)(ip_addr_t *dnsserver);

struct dhcp {
[...]
#if LWIP_DHCP_ACCEPT_NTPSERVERS
        ntp_addserver_callback ntp_addserver;
#endif /* LWIP_DHCP_ACCEPT_NTPSERVERS */
};

#if LWIP_DHCP_ACCEPT_NTPSERVERS
void dhcp_set_ntpaddserver(struct dhcp *dhcp, ntp_addserver_callback
ntp_addserver)
{
        dhcp->ntp_addserver = ntp_addserver;
}
#endif /* LWIP_DHCP_ACCEPT_NTPSERVERS */

sntp_setserver(ip_addr_t *dnsserver)
{
/* I promise to keep track of the number of servers and reject anything
I can't support */
}

to keep some consistency (I wrote this on the fly, so...)

> Then we don't need NTP_MAX_SERVERS anymore, as the DHCP code could
> call the 3rd version multiple times and let the ntp implementation 
> handle this.

Exactly, that would be a prerrogative of the NTP/SNTP module.
Keeping simplicity I will add a SNTP_MAX_SERVERS to the sntp module in
the contrib tree; but is don't care for dhcp.c and opt.h
I'm thinking on handling the mods to sntp.c as a different patch, to
keep trees separate.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]