RFC 5908 deprecates OPTION_SNTP_SERVERS.
However we can support both at the same time as our scripts
will uniqify the results if there are stupidly any duplicates.
Fixes #183.
[ -e "$cf" ] && rm "$cf"
[ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
if [ -n "$new_ntp_servers" ]; then
- for x in $new_ntp_servers; do
+ for x in $(uniqify $new_ntp_servers); do
echo "server $x" >> "$cf"
done
fi
# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
- new_ntp_servers="$new_dhcp6_sntp_servers"
+ new_ntp_servers="$new_dhcp6_sntp_servers $new_dhcp6_ntp_server_addr $new_dhcp6_ntp_server_fqdn"
;;
esac
+echo DHCP6 test
+echo $new_ntp_servers
+
if $if_configured; then
if $if_up; then
add_ntp_conf
conf="$signature$NL"
conf="${conf}[Time]$NL"
- conf="${conf}NTP=$new_ntp_servers$NL"
+ conf="${conf}NTP="
+ # Trim spaces
+ space=false
+ for ntp_server in $(uniqify $new_ntp_servers); do
+ if ! $space; then
+ space=true
+ else
+ conf="$conf "
+ fi
+ conf="$conf$ntp_server"
+ done
+ conf="$conf$NL"
printf %s "$conf" > "$timesyncd_tmp"
if change_file "$timesyncd_conf" "$timesyncd_tmp"; then
# For ease of use, map DHCP6 names onto our DHCP4 names
case "$reason" in
BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
- new_ntp_servers="$new_dhcp6_sntp_servers"
+ new_ntp_servers="$new_dhcp6_sntp_servers $new_dhcp6_ntp_server_addr $new_dhcp6_ntp_server_fqdn"
;;
esac
uint16_t dhcp6_opt;
};
+/*
+ * RFC 5908 deprecates OPTION_SNTP_SERVERS.
+ * But we can support both as the hook scripts will uniqify the
+ * results if the server returns both options.
+ */
static const struct dhcp_compat dhcp_compats[] = {
{ DHO_DNSSERVER, D6_OPTION_DNS_SERVERS },
{ DHO_HOSTNAME, D6_OPTION_FQDN },
{ DHO_DNSDOMAIN, D6_OPTION_FQDN },
{ DHO_NISSERVER, D6_OPTION_NIS_SERVERS },
{ DHO_NTPSERVER, D6_OPTION_SNTP_SERVERS },
+ { DHO_NTPSERVER, D6_OPTION_NTP_SERVER },
{ DHO_RAPIDCOMMIT, D6_OPTION_RAPID_COMMIT },
{ DHO_FQDN, D6_OPTION_FQDN },
{ DHO_VIVCO, D6_OPTION_VENDOR_CLASS },
#define D6_OPTION_FQDN 39
#define D6_OPTION_POSIX_TIMEZONE 41
#define D6_OPTION_TZDB_TIMEZONE 42
+#define D6_OPTION_NTP_SERVER 56
#define D6_OPTION_PD_EXCLUDE 67
#define D6_OPTION_SOL_MAX_RT 82
#define D6_OPTION_INF_MAX_RT 83