config: convert 'domainNumber' to the new scheme.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2015-08-15 19:40:02 +02:00
parent 9d929fe424
commit 1080826d6c
2 changed files with 4 additions and 13 deletions

View File

@ -99,6 +99,7 @@ struct config_item config_tab[] = {
GLOB_ITEM_INT("clockClass", 248, 0, UINT8_MAX), GLOB_ITEM_INT("clockClass", 248, 0, UINT8_MAX),
PORT_ITEM_INT("delayAsymmetry", 0, INT_MIN, INT_MAX), PORT_ITEM_INT("delayAsymmetry", 0, INT_MIN, INT_MAX),
PORT_ITEM_INT("delay_filter_length", 10, 1, INT_MAX), PORT_ITEM_INT("delay_filter_length", 10, 1, INT_MAX),
GLOB_ITEM_INT("domainNumber", 0, 0, 127),
PORT_ITEM_INT("egressLatency", 0, INT_MIN, INT_MAX), PORT_ITEM_INT("egressLatency", 0, INT_MIN, INT_MAX),
PORT_ITEM_INT("fault_badpeernet_interval", 16, INT32_MIN, INT32_MAX), PORT_ITEM_INT("fault_badpeernet_interval", 16, INT32_MIN, INT32_MAX),
PORT_ITEM_INT("fault_reset_interval", 4, INT8_MIN, INT8_MAX), PORT_ITEM_INT("fault_reset_interval", 4, INT8_MIN, INT8_MAX),
@ -390,24 +391,15 @@ static enum parser_result parse_global_setting(const char *option,
struct config *cfg) struct config *cfg)
{ {
int i, cfg_ignore = cfg->cfg_ignore; int i, cfg_ignore = cfg->cfg_ignore;
unsigned int uval;
unsigned char mac[MAC_LEN]; unsigned char mac[MAC_LEN];
unsigned char oui[OUI_LEN]; unsigned char oui[OUI_LEN];
struct defaultDS *dds = &cfg->dds.dds;
enum parser_result r; enum parser_result r;
r = parse_fault_interval(cfg, NULL, option, value); r = parse_fault_interval(cfg, NULL, option, value);
if (r != NOT_PARSED) if (r != NOT_PARSED)
return r; return r;
if (!strcmp(option, "domainNumber")) { if (!strcmp(option, "ptp_dst_mac")) {
r = get_ranged_uint(value, &uval, 0, 127);
if (r != PARSED_OK)
return r;
dds->domainNumber = uval;
} else if (!strcmp(option, "ptp_dst_mac")) {
if (MAC_LEN != sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", if (MAC_LEN != sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
&mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5])) &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]))
return BAD_VALUE; return BAD_VALUE;

View File

@ -43,9 +43,6 @@ static struct config cfg_settings = {
.interfaces = STAILQ_HEAD_INITIALIZER(cfg_settings.interfaces), .interfaces = STAILQ_HEAD_INITIALIZER(cfg_settings.interfaces),
.dds = { .dds = {
.dds = {
.domainNumber = 0,
},
.clock_desc = { .clock_desc = {
.productDescription = { .productDescription = {
.max_symbols = 64, .max_symbols = 64,
@ -225,6 +222,8 @@ int main(int argc, char *argv[])
ds->clockQuality.offsetScaledLogVariance = ds->clockQuality.offsetScaledLogVariance =
config_get_int(cfg, NULL, "offsetScaledLogVariance"); config_get_int(cfg, NULL, "offsetScaledLogVariance");
ds->domainNumber = config_get_int(cfg, NULL, "domainNumber");
if (config_get_int(cfg, NULL, "slaveOnly")) { if (config_get_int(cfg, NULL, "slaveOnly")) {
ds->flags |= DDS_SLAVE_ONLY; ds->flags |= DDS_SLAVE_ONLY;
ds->clockQuality.clockClass = 248; ds->clockQuality.clockClass = 248;