From f530ae93331f878afdeb611bffce85b99f6636fb Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Wed, 6 Feb 2013 13:34:49 +0100 Subject: [PATCH] Hide the grandmaster port state. There really is no such state, but there probably should have been one. In any case, we do have one just to make the code simpler, but this should not appear in the management responses. This patch fixes the issue by covering over our tracks before sending a response. Signed-off-by: Richard Cochran --- fsm.h | 2 +- phc2sys.c | 1 - port.c | 6 +++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fsm.h b/fsm.h index 90c7a4d..5d4ae91 100644 --- a/fsm.h +++ b/fsm.h @@ -28,10 +28,10 @@ enum port_state { PS_LISTENING, PS_PRE_MASTER, PS_MASTER, - PS_GRAND_MASTER, PS_PASSIVE, PS_UNCALIBRATED, PS_SLAVE, + PS_GRAND_MASTER, /*non-standard extension*/ }; /** Defines the events for the port state machine. */ diff --git a/phc2sys.c b/phc2sys.c index 17d00db..8e6b79f 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -383,7 +383,6 @@ static int run_pmc(int wait_sync, int *utc_offset) switch (((struct portDS *)data)->portState) { case PS_MASTER: - case PS_GRAND_MASTER: case PS_SLAVE: ds_done = 1; break; diff --git a/port.c b/port.c index 6c9bd32..0112cb3 100644 --- a/port.c +++ b/port.c @@ -457,7 +457,11 @@ static int port_management_get_response(struct port *target, case PORT_DATA_SET: pds = (struct portDS *) tlv->data; pds->portIdentity = target->portIdentity; - pds->portState = target->state; + if (target->state == PS_GRAND_MASTER) { + pds->portState = PS_MASTER; + } else { + pds->portState = target->state; + } pds->logMinDelayReqInterval = target->logMinDelayReqInterval; pds->peerMeanPathDelay = target->peerMeanPathDelay; pds->logAnnounceInterval = target->logAnnounceInterval;