diff --git a/clock.c b/clock.c index 8c20d64..f31ae42 100644 --- a/clock.c +++ b/clock.c @@ -826,7 +826,7 @@ struct clock *clock_create(struct config *config, int phc_index, c->config = config; c->free_running = config_get_int(config, NULL, "free_running"); c->freq_est_interval = config_get_int(config, NULL, "freq_est_interval"); - c->grand_master_capable = dds->grand_master_capable; + c->grand_master_capable = config_get_int(config, NULL, "gmCapable"); c->kernel_leap = dds->kernel_leap; c->utc_offset = CURRENT_UTC_OFFSET; c->time_source = dds->time_source; diff --git a/config.c b/config.c index 8049045..24774af 100644 --- a/config.c +++ b/config.c @@ -102,6 +102,7 @@ struct config_item config_tab[] = { PORT_ITEM_INT("follow_up_info", 0, 0, 1), GLOB_ITEM_INT("free_running", 0, 0, 1), PORT_ITEM_INT("freq_est_interval", 1, 0, INT_MAX), + GLOB_ITEM_INT("gmCapable", 1, 0, 1), PORT_ITEM_INT("ingressLatency", 0, INT_MIN, INT_MAX), PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX), PORT_ITEM_INT("logMinDelayReqInterval", 0, INT8_MIN, INT8_MAX), @@ -412,12 +413,6 @@ static enum parser_result parse_global_setting(const char *option, dds->flags &= ~DDS_SLAVE_ONLY; } - } else if (!strcmp(option, "gmCapable")) { - r = get_ranged_int(value, &val, 0, 1); - if (r != PARSED_OK) - return r; - cfg->dds.grand_master_capable = val; - } else if (!strcmp(option, "priority1")) { r = get_ranged_uint(value, &uval, 0, UINT8_MAX); if (r != PARSED_OK) diff --git a/ds.h b/ds.h index 963a033..1248b7c 100644 --- a/ds.h +++ b/ds.h @@ -52,7 +52,6 @@ struct clock_description { struct default_ds { struct defaultDS dds; - int grand_master_capable; /*802.1AS only*/ int stats_interval; /*log seconds*/ int kernel_leap; int sanity_freq_limit; diff --git a/ptp4l.c b/ptp4l.c index b6cd815..1070d44 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -52,7 +52,6 @@ static struct config cfg_settings = { .priority2 = 128, .domainNumber = 0, }, - .grand_master_capable = 1, .stats_interval = 0, .kernel_leap = 1, .sanity_freq_limit = 200000000, @@ -237,13 +236,13 @@ int main(int argc, char *argv[]) sk_check_fupsync = config_get_int(cfg, NULL, "check_fup_sync"); sk_tx_timeout = config_get_int(cfg, NULL, "tx_timestamp_timeout"); - if (!cfg_settings.dds.grand_master_capable && + if (!config_get_int(cfg, NULL, "gmCapable") && ds->flags & DDS_SLAVE_ONLY) { fprintf(stderr, "Cannot mix 1588 slaveOnly with 802.1AS !gmCapable.\n"); return -1; } - if (!cfg_settings.dds.grand_master_capable || + if (!config_get_int(cfg, NULL, "gmCapable") || ds->flags & DDS_SLAVE_ONLY) { ds->clockQuality.clockClass = 255; }