Signed-off-by: Martin Pecka <[email protected]>
---
config.c | 4 ++++
uds.c | 5 ++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/config.c b/config.c
index 4f3ceb8..b4c16d8 100644
--- a/config.c
+++ b/config.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
#include "as_capable.h"
#include "bmc.h"
@@ -33,6 +34,8 @@
#include "print.h"
#include "util.h"
+#define UDS_FILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) /*0660*/
+
struct interface {
STAILQ_ENTRY(interface) list;
};
@@ -331,6 +334,7 @@ struct config_item config_tab[] = {
PORT_ITEM_INT("udp6_scope", 0x0E, 0x00, 0x0F),
GLOB_ITEM_STR("uds_address", "/var/run/ptp4l"),
GLOB_ITEM_STR("uds_ro_address", "/var/run/ptp4lro"),
+ PORT_ITEM_INT("uds_file_mode", UDS_FILEMODE, 0, 04777),
PORT_ITEM_INT("unicast_listen", 0, 0, 1),
PORT_ITEM_INT("unicast_master_table", 0, 0, INT_MAX),
PORT_ITEM_INT("unicast_req_duration", 3600, 10, INT_MAX),
diff --git a/uds.c b/uds.c
index 641a672..30a0f1e 100644
--- a/uds.c
+++ b/uds.c
@@ -31,8 +31,6 @@
#include "transport_private.h"
#include "uds.h"
-#define UDS_FILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) /*0660*/
-
struct uds {
struct transport t;
struct address address;
@@ -58,6 +56,7 @@ static int uds_open(struct transport *t, struct interface
*iface, struct fdarray
char *uds_path = config_get_string(t->cfg, NULL, "uds_address");
struct uds *uds = container_of(t, struct uds, t);
const char *name = interface_name(iface);
+ mode_t file_mode = (mode_t)config_get_int(t->cfg, name,
"uds_file_mode");
struct sockaddr_un sa;
int fd, err;
@@ -86,7 +85,7 @@ static int uds_open(struct transport *t, struct interface
*iface, struct fdarray
uds->address.sun = sa;
uds->address.len = sizeof(sa);
- chmod(name, UDS_FILEMODE);
+ chmod(name, file_mode);
fda->fd[FD_EVENT] = -1;
fda->fd[FD_GENERAL] = fd;
return 0;
--
2.17.1
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel