Introduce a configuration file option for the server's UDS address.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2013-09-29 20:57:00 +02:00
parent e5ddfd491e
commit 9fe2ffd2ef
6 changed files with 15 additions and 1 deletions

View File

@ -393,6 +393,11 @@ static enum parser_result parse_global_setting(const char *option,
return r;
*cfg->udp6_scope = uval;
} else if (!strcmp(option, "uds_address")) {
if (strlen(value) > MAX_IFNAME_SIZE)
return OUT_OF_RANGE;
strncpy(cfg->uds_address, value, MAX_IFNAME_SIZE);
} else if (!strcmp(option, "logging_level")) {
r = get_ranged_int(value, &val,
PRINT_LEVEL_MIN, PRINT_LEVEL_MAX);

View File

@ -89,6 +89,7 @@ struct config {
unsigned char *ptp_dst_mac;
unsigned char *p2p_dst_mac;
unsigned char *udp6_scope;
char *uds_address;
int print_level;
int use_syslog;

View File

@ -59,6 +59,7 @@ transportSpecific 0x0
ptp_dst_mac 01:1B:19:00:00:00
p2p_dst_mac 01:80:C2:00:00:0E
udp6_scope 0x0E
uds_address /var/run/ptp4l
#
# Default interface options
#

View File

@ -57,6 +57,7 @@ clock_servo pi
transportSpecific 0x1
ptp_dst_mac 01:80:C2:00:00:0E
p2p_dst_mac 01:80:C2:00:00:0E
uds_address /var/run/ptp4l
#
# Default interface options
#

View File

@ -1,4 +1,4 @@
.TH PTP4l 8 "July 2013" "linuxptp"
.TH PTP4l 8 "October 2013" "linuxptp"
.SH NAME
ptp4l \- PTP Boundary/Ordinary Clock
@ -354,6 +354,10 @@ will be used as the second byte of the primary address. This option
is only relevant with IPv6 transport. See RFC 4291. The default is
0x0E for the global scope.
.TP
.B uds_address
Specifies the address of the UNIX domain socket for receiving local
management messages. The default is /var/run/ptp4l.
.TP
.B logging_level
The maximum logging level of messages which should be printed.
The default is 6 (LOG_INFO).

View File

@ -32,6 +32,7 @@
#include "sk.h"
#include "transport.h"
#include "udp6.h"
#include "uds.h"
#include "util.h"
#include "version.h"
@ -111,6 +112,7 @@ static struct config cfg_settings = {
.ptp_dst_mac = ptp_dst_mac,
.p2p_dst_mac = p2p_dst_mac,
.udp6_scope = &udp6_scope,
.uds_address = uds_path,
.print_level = LOG_INFO,
.use_syslog = 1,