From: Vincent Cheng <vsch...@gmail.com>

When local clock data set is better than remote server, log message says remote
server is best master.  The port states are correct.

ex. local clock is clock class 6 and remote server on port 1 is clock class 7.

  ptp4l[5709.306]: selected best master clock 080027.fffe.fd0000
  ptp4l[5709.306]: port 1 (enp0s8): assuming the grand master role

After fix:
  ptp4l[6880.712]: selected local clock 080027.fffe.799fc5 as best master
  ptp4l[6880.712]: port 1 (enp0s8): assuming the grand master role

Signed-off-by: Vincent Cheng <vsch...@gmail.com>
---
 clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clock.c b/clock.c
index 75d7c40..f9ef306 100644
--- a/clock.c
+++ b/clock.c
@@ -2179,7 +2179,7 @@ static void handle_state_decision_event(struct clock *c)
                        best = fc;
        }
 
-       if (best) {
+       if (best && c->dscmp(&best->dataset, clock_default_ds(c)) > 0) {
                best_id = best->dataset.identity;
        } else {
                best_id = c->dds.clockIdentity;
-- 
2.34.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to