lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] Missing 'dhcp6_set_ntp_servers()'


From: Dirk Ziegelmeier
Subject: Re: [lwip-devel] Missing 'dhcp6_set_ntp_servers()'
Date: Mon, 27 Aug 2018 17:04:56 +0200

That's a normal (embedded) way of implementing callback functions. This way we save NULL pointer checks and dereferencing function pointers is evil anyway :-) You'll find this pattern in more places than this one.

See also the comment on LWIP_DHCP6_GET_NTP_SRV in opt.h

Dirk


On Thu, Aug 16, 2018 at 3:17 PM Gisle Vanem <address@hidden> wrote:
When experimenting with IPv6 and most features enabled
(including 'LWIP_DHCP6_GET_NTP_SRV=1'), I get a
link error:
   dhcp6.obj : error LNK2019: unresolved external symbol
   _dhcp6_set_ntp_servers referenced in function _dhcp6_recv

I'm not sure if the NTP-address in dhcp6_recv() is always an
IPv6-address, so just patched it like this:

--- a/src/apps/sntp/sntp.c 2018-04-26 13:57:15
+++ b/src/apps/sntp/sntp.c 2018-08-16 11:38:48
@@ -816,6 +816,15 @@
  }
  #endif /* LWIP_DHCP && SNTP_GET_SERVERS_FROM_DHCP */

+#if LWIP_DHCP6_GET_NTP_SRV
+void
+dhcp6_set_ntp_servers(u8_t num, const ip_addr_t *server)
+{
+  (void) server;
+  LWIP_DEBUGF(SNTP_DEBUG_TRACE, ("sntp: got NTP server #%u via DHCPv6\n", num));
+}
+#endif
+
-------

This works in my Windows test-app since I use lwIP as a static-lib.
This patch fails if my app uses a lwIP.dll.

But IMHO it's strange that a lwipcore6 file should call into an
APPFILE like this. Same issue with 'LWIP_DHCP_GET_NTP_SRV=1' in
'core/ipv4/dhcp.c'.

Perhaps there should be 2 func-pointers defined in lwIP for
sntp.c to hook into?

--
--gv

--
--gv

_______________________________________________
lwip-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-devel

reply via email to

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