This patch addresses the bug observed in ptp4l in slaveOnly mode. When the
upstream master is no longer available (not reachable), the slave moves to
LISTENING state. However, the gmIdentity is not updated in ptp4l. This causes
gmPresent reported as true despite GM being non-reachable in pmc commands.

Signed-off-by: Karthikkumar V <[email protected]>
Signed-off-by: Ramana Reddy <[email protected]>
Signed-off-by: Miroslav Lichvar <[email protected]>
---
 clock.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/clock.c b/clock.c
index ec70f91..3759b0f 100644
--- a/clock.c
+++ b/clock.c
@@ -1970,6 +1970,12 @@ static void handle_state_decision_event(struct clock *c)
                ps = bmc_state_decision(c, piter, c->dscmp);
                switch (ps) {
                case PS_LISTENING:
+                       if (!cid_eq(&best_id, &c->dad.pds.grandmasterIdentity)) 
{
+                               clock_update_grandmaster(c);
+                               pr_notice("%s: Updated grandmasterIdentity: %s 
",
+                                       port_log_name(piter),
+                                       
cid2str(&c->dad.pds.grandmasterIdentity));
+                       }
                        event = EV_NONE;
                        break;
                case PS_GRAND_MASTER:
-- 
1.8.3.1



_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to