According to IEEE 1588 The slave only flag in the SLAVE_ONLY TLV
 is bit 0 and not bit 1 as in the DEFAULT_DATA_SET TLV.

In pmc we can simply print the value.
According to IEEE 1588 the other bits are zero.
When pmc query old ptp4l it will print 2 instead of 1.

Signed-off-by: Erez Geva <erez.geva....@siemens.com>
---
 clock.c | 2 +-
 pmc.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/clock.c b/clock.c
index 85d7667..e545a9b 100644
--- a/clock.c
+++ b/clock.c
@@ -404,7 +404,7 @@ static int clock_management_fill_response(struct clock *c, 
struct port *p,
                break;
        case TLV_SLAVE_ONLY:
                mtd = (struct management_tlv_datum *) tlv->data;
-               mtd->val = c->dds.flags & DDS_SLAVE_ONLY;
+               mtd->val = c->dds.flags & DDS_SLAVE_ONLY ? 1 : 0;
                datalen = sizeof(*mtd);
                break;
        case TLV_CLOCK_ACCURACY:
diff --git a/pmc.c b/pmc.c
index 250124d..a767c8a 100644
--- a/pmc.c
+++ b/pmc.c
@@ -315,7 +315,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
        case TLV_SLAVE_ONLY:
                mtd = (struct management_tlv_datum *) mgt->data;
                fprintf(fp, "SLAVE_ONLY "
-                       IFMT "slaveOnly %d", mtd->val & DDS_SLAVE_ONLY ? 1 : 0);
+                       IFMT "slaveOnly %d", mtd->val);
                break;
        case TLV_CLOCK_ACCURACY:
                mtd = (struct management_tlv_datum *) mgt->data;
-- 
2.20.1



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

Reply via email to