timemaster: Allow ptp4l-specific sections in [ptp4l.conf].
Remove > from beginning of lines specified in the *.conf sections in order to allow a ptp4l-specific section (e.g. [unicast_master_table]) to be included there. After inserting the lines to the generated ptp4l.conf, switch back to the [global] section. Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>master
parent
241d8a064e
commit
78a720f2b3
10
timemaster.8
10
timemaster.8
|
@ -253,9 +253,13 @@ Specify extra options that should be added to all \fBptp4l\fR command lines. By
|
||||||
default, \fB\-l 5\fR is added to the command lines.
|
default, \fB\-l 5\fR is added to the command lines.
|
||||||
|
|
||||||
.SS [ptp4l.conf]
|
.SS [ptp4l.conf]
|
||||||
Settings specified in this section are copied directly to the configuration
|
Settings specified in this section are copied directly to the global section of
|
||||||
files generated for all \fBptp4l\fR instances. There is no default content of
|
the configuration files generated for all \fBptp4l\fR instances. There is no
|
||||||
this section.
|
default content of this section.
|
||||||
|
|
||||||
|
Other sections (e.g. \fB[unicast_master_table]\fR) may be specified here, but
|
||||||
|
lines beginning with the bracket need to be prefixed with the \fB>\fR character
|
||||||
|
to prevent \fBtimemaster\fR from parsing it as a beginning of another section.
|
||||||
|
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
For best accuracy, \fBchronyd\fR is usually preferred over \fBntpd\fR, it also
|
For best accuracy, \fBchronyd\fR is usually preferred over \fBntpd\fR, it also
|
||||||
|
|
24
timemaster.c
24
timemaster.c
|
@ -405,6 +405,23 @@ static int parse_timemaster_settings(char **settings,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char **parse_raw_settings(char **settings)
|
||||||
|
{
|
||||||
|
char **setting, *s, **parsed_settings;
|
||||||
|
|
||||||
|
parsed_settings = (char **)parray_new();
|
||||||
|
|
||||||
|
for (setting = settings; *setting; setting++) {
|
||||||
|
s = *setting;
|
||||||
|
/* Unescape lines beginning with '>' */
|
||||||
|
if (s[0] == '>')
|
||||||
|
s++;
|
||||||
|
parray_append((void ***)&parsed_settings, xstrdup(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsed_settings;
|
||||||
|
}
|
||||||
|
|
||||||
static int parse_section(char **settings, char *name,
|
static int parse_section(char **settings, char *name,
|
||||||
struct timemaster_config *config)
|
struct timemaster_config *config)
|
||||||
{
|
{
|
||||||
|
@ -451,8 +468,7 @@ static int parse_section(char **settings, char *name,
|
||||||
|
|
||||||
if (settings_dst) {
|
if (settings_dst) {
|
||||||
free_parray((void **)*settings_dst);
|
free_parray((void **)*settings_dst);
|
||||||
*settings_dst = (char **)parray_new();
|
*settings_dst = parse_raw_settings(settings);
|
||||||
extend_string_array(settings_dst, settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -802,9 +818,13 @@ static int add_ptp_source(struct ptp_domain *source,
|
||||||
config_file = xmalloc(sizeof(*config_file));
|
config_file = xmalloc(sizeof(*config_file));
|
||||||
config_file->path = string_newf("%s/ptp4l.%d.conf",
|
config_file->path = string_newf("%s/ptp4l.%d.conf",
|
||||||
config->rundir, *shm_segment);
|
config->rundir, *shm_segment);
|
||||||
|
|
||||||
config_file->content = xstrdup("[global]\n");
|
config_file->content = xstrdup("[global]\n");
|
||||||
|
if (*config->ptp4l.settings) {
|
||||||
extend_config_string(&config_file->content,
|
extend_config_string(&config_file->content,
|
||||||
config->ptp4l.settings);
|
config->ptp4l.settings);
|
||||||
|
string_appendf(&config_file->content, "\n[global]\n");
|
||||||
|
}
|
||||||
extend_config_string(&config_file->content,
|
extend_config_string(&config_file->content,
|
||||||
source->ptp4l_settings);
|
source->ptp4l_settings);
|
||||||
string_appendf(&config_file->content,
|
string_appendf(&config_file->content,
|
||||||
|
|
Loading…
Reference in New Issue