pmc_common: Preset uninitialized 'iface.ts_label' with
 'iface.name'

pmc_create() calls transport_create(), which sets the open function
for the interface 'iface' to raw_open(), if Layer 2 is used. The
immediate following call of transport_open() calls raw_open(), which
uses the field .ts_label for opening, instead of the field .name
(which is used the other transport layers). Therefore, the
field .name is copied here into the field .ts_label

Signed-off-by: Peter Schneider <pe...@psch.de>
---
 pmc_common.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pmc_common.c b/pmc_common.c
index 91fffb3..850544c 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -93,6 +93,10 @@ struct pmc *pmc_create(struct config *cfg, enum 
transport_type transport_type,
        }

        strncpy(iface.name, iface_name, MAX_IFNAME_SIZE);
+       if (transport_type == TRANS_IEEE_802_3) {
+               strncpy(iface.ts_label, iface_name, MAX_IFNAME_SIZE);
+       }
+
        if (transport_open(pmc->transport, &iface,
                           &pmc->fdarray, TS_SOFTWARE)) {
                pr_err("failed to open transport");
-- 
2.14.3

------------------------------------------------------------------------------
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