Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 pmc_common.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/pmc_common.c b/pmc_common.c
index 2a58081..4ece489 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -274,21 +274,25 @@ int pmc_send_get_action(struct pmc *pmc, int id)
 
 int pmc_send_set_action(struct pmc *pmc, int id, void *data, int datasize)
 {
-       int pdulen;
-       struct ptp_message *msg;
        struct management_tlv *mgt;
+       struct ptp_message *msg;
+       struct tlv_extra *extra;
+       int pdulen;
+
        msg = pmc_message(pmc, SET);
        if (!msg) {
                return -1;
        }
-       mgt = (struct management_tlv *) msg->management.suffix;
+       extra = msg_tlv_append(msg, sizeof(*mgt) + datasize);
+       if (!extra) {
+               return -ENOMEM;
+       }
+       mgt = (struct management_tlv *) extra->tlv;
        mgt->type = TLV_MANAGEMENT;
        mgt->length = 2 + datasize;
        mgt->id = id;
        memcpy(mgt->data, data, datasize);
        pdulen = msg->header.messageLength + sizeof(*mgt) + datasize;
-       msg->header.messageLength = pdulen;
-       msg->tlv_count = 1;
        pmc_send(pmc, msg, pdulen);
        msg_put(msg);
 
-- 
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to