/* Create a source instance for this NTP source */
result->source = SRC_CreateNewInstance(UTI_IPToRefid(&remote_addr->ip_addr),
- SRC_NTP, params->sel_options,
- &result->remote_addr.ip_addr,
+ SRC_NTP, NAU_IsAuthEnabled(result->auth),
+ params->sel_options, &result->remote_addr.ip_addr,
params->min_samples, params->max_samples,
params->min_delay, params->asymmetry);
inst->filter = SPF_CreateInstance(MIN(params->filter_length, 4), params->filter_length,
params->max_dispersion, 0.6);
- inst->source = SRC_CreateNewInstance(inst->ref_id, SRC_REFCLOCK, params->sel_options, NULL,
- params->min_samples, params->max_samples, 0.0, 0.0);
+ inst->source = SRC_CreateNewInstance(inst->ref_id, SRC_REFCLOCK, 0, params->sel_options,
+ NULL, params->min_samples, params->max_samples,
+ 0.0, 0.0);
DEBUG_LOG("refclock %s refid=%s poll=%d dpoll=%d filter=%d",
params->driver_name, UTI_RefidToString(inst->ref_id),
/* Type of the source */
SRC_Type type;
- /* Options used when selecting sources */
+ /* Flag indicating that the source is authenticated */
+ int authenticated;
+
+ /* Configured selection options */
+ int conf_sel_options;
+
+ /* Effective selection options */
int sel_options;
/* Score against currently selected source */
/* ================================================== */
/* Forward prototype */
+static void update_sel_options(void);
static void slew_sources(struct timespec *raw, struct timespec *cooked, double dfreq,
double doffset, LCL_ChangeType change_type, void *anything);
static void add_dispersion(double dispersion, void *anything);
/* Function to create a new instance. This would be called by one of
the individual source-type instance creation routines. */
-SRC_Instance SRC_CreateNewInstance(uint32_t ref_id, SRC_Type type, int sel_options,
- IPAddr *addr, int min_samples, int max_samples,
- double min_delay, double asymmetry)
+SRC_Instance SRC_CreateNewInstance(uint32_t ref_id, SRC_Type type, int authenticated,
+ int sel_options, IPAddr *addr, int min_samples,
+ int max_samples, double min_delay, double asymmetry)
{
SRC_Instance result;
result->index = n_sources;
result->type = type;
+ result->authenticated = authenticated;
+ result->conf_sel_options = sel_options;
result->sel_options = sel_options;
result->active = 0;
n_sources++;
+ update_sel_options();
+
return result;
}
--n_sources;
Free(instance);
+ update_sel_options();
+
/* If this was the previous reference source, we have to reselect! */
if (selected_source_index == dead_index)
SRC_ReselectSource();
/* ================================================== */
+static void
+update_sel_options(void)
+{
+ int i;
+
+ for (i = 0; i < n_sources; i++) {
+ sources[i]->sel_options = sources[i]->conf_sel_options;
+ }
+}
+
+/* ================================================== */
+
static void
log_selection_message(const char *format, const char *arg)
{
/* Function to create a new instance. This would be called by one of
the individual source-type instance creation routines. */
-extern SRC_Instance SRC_CreateNewInstance(uint32_t ref_id, SRC_Type type, int sel_options,
- IPAddr *addr, int min_samples, int max_samples,
- double min_delay, double asymmetry);
+extern SRC_Instance SRC_CreateNewInstance(uint32_t ref_id, SRC_Type type, int authenticated,
+ int sel_options, IPAddr *addr, int min_samples,
+ int max_samples, double min_delay, double asymmetry);
/* Function to get rid of a source when it is being unconfigured.
This may cause the current reference source to be reselected, if this
SRC_SELECT_TRUST | SRC_SELECT_REQUIRE);
DEBUG_LOG("added source %d options %d", j, sel_options);
- srcs[j] = SRC_CreateNewInstance(UTI_IPToRefid(&addr), SRC_NTP, sel_options, &addr,
+ srcs[j] = SRC_CreateNewInstance(UTI_IPToRefid(&addr), SRC_NTP, 0, sel_options, &addr,
SRC_DEFAULT_MINSAMPLES, SRC_DEFAULT_MAXSAMPLES,
0.0, 1.0);
SRC_UpdateReachability(srcs[j], 1);