Commit ea7a7882 removed the calls to transport_peer(), inadvertently
substituting them with transport_send(), resulting in PDelay messages
being sent with an incorrect destination address.

This patch fixes the issue by introducing peer_prepare_and_send(),
analogous to the port_prepare_and_send() function.

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

diff --git a/port.c b/port.c
index 18405c6..caea891 100644
--- a/port.c
+++ b/port.c
@@ -484,6 +484,17 @@ static int path_trace_ignore(struct port *p, struct 
ptp_message *m)
        return 0;
 }
 
+static int peer_prepare_and_send(struct port *p, struct ptp_message *msg,
+                                int event)
+{
+       int cnt;
+       if (msg_pre_send(msg)) {
+               return -1;
+       }
+       cnt = transport_peer(p->trp, &p->fda, event, msg);
+       return cnt <= 0 ? -1 : 0;
+}
+
 static int port_capable(struct port *p)
 {
        if (!port_is_ieee8021as(p)) {
@@ -1114,7 +1125,7 @@ static int port_pdelay_request(struct port *p)
        msg->header.logMessageInterval = port_is_ieee8021as(p) ?
                p->logMinPdelayReqInterval : 0x7f;
 
-       err = port_prepare_and_send(p, msg, 1);
+       err = peer_prepare_and_send(p, msg, 1);
        if (err) {
                pr_err("port %hu: send peer delay request failed", portnum(p));
                goto out;
@@ -1728,7 +1739,7 @@ static int process_pdelay_req(struct port *p, struct 
ptp_message *m)
 
        fup->pdelay_resp_fup.requestingPortIdentity = 
m->header.sourcePortIdentity;
 
-       err = port_prepare_and_send(p, rsp, 1);
+       err = peer_prepare_and_send(p, rsp, 1);
        if (err) {
                pr_err("port %hu: send peer delay response failed", portnum(p));
                goto out;
@@ -1741,7 +1752,7 @@ static int process_pdelay_req(struct port *p, struct 
ptp_message *m)
        ts_to_timestamp(&rsp->hwts.ts,
                        &fup->pdelay_resp_fup.responseOriginTimestamp);
 
-       err = port_prepare_and_send(p, fup, 0);
+       err = peer_prepare_and_send(p, fup, 0);
        if (err)
                pr_err("port %hu: send pdelay_resp_fup failed", portnum(p));
 
-- 
1.7.10.4


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to