Skip to content

Commit

Permalink
Introduce a configuration file option for the server's UDS address.
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Cochran <[email protected]>
  • Loading branch information
richardcochran committed Oct 8, 2013
1 parent e5ddfd4 commit 9fe2ffd
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
1 change: 1 addition & 0 deletions gPTP.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
6 changes: 5 additions & 1 deletion ptp4l.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH PTP4l 8 "July 2013" "linuxptp"
.TH PTP4l 8 "October 2013" "linuxptp"
.SH NAME
ptp4l \- PTP Boundary/Ordinary Clock

Expand Down Expand Up @@ -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).
Expand Down
2 changes: 2 additions & 0 deletions ptp4l.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "sk.h"
#include "transport.h"
#include "udp6.h"
#include "uds.h"
#include "util.h"
#include "version.h"

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 9fe2ffd

Please sign in to comment.