Include GM clock quality parameters clock accuracy and offset scaled log variance to the clock selection algorithm. Those checks together with the clock class can check the remote clock quality, enhancing T-BC support. The existing ha_min_local_clockClass, ha_min_clockAccuracy, ha_min_gm_offsetScaledLogVariance and ha_min_gm_ClockClass were renamed. Now their names are ha_max* because they represent the maximum value the clock can present to be considered valid. The existing ha_timeTraceable and ha_frequencyTraceable were renamed. Now their names contain gm to explain and show they correspond to the GM time and frequency traceability. The ha_min_local_clockClass is now ha_max_local_clockClass, and Its default value was changed to 255. The ha_min_clockAccuracy is now ha_max_local_clockAccuracy, its name now contains the local key to differentiate from the GM configuration option. The ha_min_offsetScaledLogVariance is now ha_max_local_offsetScaledLogVar. Its name now contains the local key to differentiate from the GM configuration option, and the word Variace was shortened Var due to the size limit of the name. The ha_min_gm_ClockClass is now ha_max_gm_clockClass, and its default value was changed to 6. The ha_max_local_clockClass and ha_max_gm_clockClass default values were changed to make it easier to configure both T-GM and T-BC scenarios. The new ha_max_gm_clockAccuracy option is a global setting for the maximum GM clock accuracy requirement. It ranges from 0x00 to 0xff and its default is 0xfe. The new ha_max_gm_offsetScaledLogVar option is a global setting for the maximum GM offset scaled log variance requirement. It ranges from 0x0000 to 0xffff and its default is 0xffff. The status command now includes the GM clock accuracy and offset scaled log variance values. Test plan: new GM fields PASS Verify the clock is discarded because GM clock accuracy is out of requirement PASS Verify the clock is discarded because GM offset scaled log variance is out of the requirement PASS Verify the status command shows the new fields gm.clockAcc and gm.offset Test plan: new default values PASS Verify the ha_max_gm_ClockClass and ha_max_local_clockClass default values. Test plan: renamed fields PASS Verify the a configuration containing all HA configuration options is accepted. Story: 2010723 Task: 48675 Change-Id: I7ed1300a51cbdcaa44d7f350dcdc92e54469a497 Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com>
79 lines
2.5 KiB
Diff
79 lines
2.5 KiB
Diff
From f480fb54182da36baeb35bac90154abafcaf854a Mon Sep 17 00:00:00 2001
|
|
From: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
|
Date: Tue, 8 Aug 2023 14:06:55 -0300
|
|
Subject: [PATCH 46/49] Robustness improvements to phc2sys socket
|
|
|
|
When phc2sys abnormally exits the socket file might remain created.
|
|
To avoid error when phc2sys is relaunched, the exixting file is
|
|
deleted before recriating the socket.
|
|
|
|
If the peer application closes the socket before sending the
|
|
response completely, it will cause a broken pipe error. The
|
|
send function generates a SIGPIPE on broken pipe errors,
|
|
killing the phc2sys process unless MSG_NOSIGNAL flag is set.
|
|
|
|
Test plan: socket file
|
|
PASS: Verify that phc2sys can restart normally after killing it.
|
|
|
|
Test plan: SIGPIPE
|
|
PASS: Verify the phc2sys application don't exit when client socket
|
|
is closed before the respose is sent.
|
|
|
|
Reviewed-by: Cole Walker <cole.walker@windriver.com>
|
|
Reviewed-by: Andre Fernando Zanella Kantek
|
|
<andrefernandozanella.kantek@windriver.com>
|
|
|
|
[commit 8b3765b3f104a90a487fbcb0f61074c7677c215e upstream]
|
|
[commit 50ad1c6f81a706b8be6689bea2ba2db215cf3dc3 upstream]
|
|
|
|
Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com>
|
|
---
|
|
phc2sys.c | 10 ++++++----
|
|
1 file changed, 6 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/phc2sys.c b/phc2sys.c
|
|
index 6965162..edc626f 100644
|
|
--- a/phc2sys.c
|
|
+++ b/phc2sys.c
|
|
@@ -1218,7 +1218,9 @@ static int ha_com_socket_open(int *fd_out, struct config *cfg)
|
|
int fd, err;
|
|
struct sockaddr_un sa;
|
|
const int backlog = 50;
|
|
- const char *name = config_get_string(cfg, NULL, "ha_phc2sys_com_socket");
|
|
+ const char *path = config_get_string(cfg, NULL, "ha_phc2sys_com_socket");
|
|
+
|
|
+ unlink(path);
|
|
|
|
fd = socket(AF_LOCAL, SOCK_STREAM | SOCK_NONBLOCK, 0);
|
|
if (fd < 0) {
|
|
@@ -1228,7 +1230,7 @@ static int ha_com_socket_open(int *fd_out, struct config *cfg)
|
|
|
|
memset(&sa, 0, sizeof(sa));
|
|
sa.sun_family = AF_LOCAL;
|
|
- strncpy(sa.sun_path, name, sizeof(sa.sun_path) - 1);
|
|
+ strncpy(sa.sun_path, path, sizeof(sa.sun_path) - 1);
|
|
|
|
err = bind(fd, (struct sockaddr *) &sa, sizeof(sa));
|
|
if (err < 0) {
|
|
@@ -1245,7 +1247,7 @@ static int ha_com_socket_open(int *fd_out, struct config *cfg)
|
|
}
|
|
|
|
*fd_out = fd;
|
|
- chmod(name, HA_SCK_FILEMODE);
|
|
+ chmod(path, HA_SCK_FILEMODE);
|
|
|
|
return 0;
|
|
}
|
|
@@ -1269,7 +1271,7 @@ static int ha_com_socket_send(int fd, void *buf, size_t buflen)
|
|
{
|
|
int cnt;
|
|
|
|
- cnt = send(fd, buf, buflen, 0);
|
|
+ cnt = send(fd, buf, buflen, MSG_NOSIGNAL);
|
|
if (cnt < 0) {
|
|
pr_err("ha_com_socket: send failed: %m");
|
|
return -errno;
|
|
--
|
|
2.25.1
|
|
|