Skip to content

Add support for setting SNTP servers via DHCPv6#25

Merged
d-a-v merged 1 commit into
d-a-v:masterfrom
davefiddes:sntp-support
Jan 22, 2019
Merged

Add support for setting SNTP servers via DHCPv6#25
d-a-v merged 1 commit into
d-a-v:masterfrom
davefiddes:sntp-support

Conversation

@davefiddes
Copy link
Copy Markdown
Contributor

This bring parity between DHCPv4 and DHCPv6 allowing DHCPv6
servers to specify an SNTP server to use. Only a single SNTP
server slot is allocated to DHCPv6 (the same as v4).

Tests:

  • Start a WeMos D1 on a network which only provides IPv6
    addresses via DHCPv6 with 0, 1 or 3 SNTP servers
    configured
  • Verify that the SNTP is configured and that time is
    correct with an updated IPv6.ino sketch that reports
    SNTP servers and the current time

Signed-off-by: David J. Fiddes D.J@fiddes.net

This bring parity between DHCPv4 and DHCPv6 allowing DHCPv6
servers to specify an SNTP server to use. Only a single SNTP
server slot is allocated to DHCPv6 (the same as v4).

Tests:
 - Start a WeMos D1 on a network which only provides IPv6
   addresses via DHCPv6 with 0, 1 or 3 SNTP servers
   configured
 - Verify that the SNTP is configured and that time is
   correct with an updated IPv6.ino sketch that reports
   SNTP servers and the current time

Signed-off-by: David J. Fiddes <D.J@fiddes.net>
@d-a-v d-a-v merged commit 9246ef5 into d-a-v:master Jan 22, 2019
@d-a-v
Copy link
Copy Markdown
Owner

d-a-v commented Jan 22, 2019

Thanks! Did you propose your path to lwIP ?

Comment thread glue-lwip/lwip-git.c

if (ip_2_ip4(&netif->ip_addr)->addr)
// If we have a valid address of any type restart SNTP
if (ip_addr_isany(&netif->ip_addr))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After re-reading is it not if (!ip_addr_isany(&netif->ip_addr)) instead ?

@davefiddes
Copy link
Copy Markdown
Contributor Author

Yes. You are correct. This breaks IPv4 SNTP support.

I'm trying to figure out why it works. It seems that when a DHCPv6 address is received, netif_sta_status_callback() is called but the netif->ip_addr value is set to all zeros.

@davefiddes davefiddes deleted the sntp-support branch January 27, 2019 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants