Even if the caller provides the destination address, still the port must
depend on the passed 'event' value for correct delivery.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 udp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/udp.c b/udp.c
index b8aa76a..48d18d8 100644
--- a/udp.c
+++ b/udp.c
@@ -218,12 +218,12 @@ static int udp_send(struct transport *t, struct fdarray 
*fda, int event,
                addr_buf.sin.sin_family = AF_INET;
                addr_buf.sin.sin_addr = peer ? mcast_addr[MC_PDELAY] :
                                               mcast_addr[MC_PRIMARY];
-               addr_buf.sin.sin_port = htons(event ? EVENT_PORT :
-                                                     GENERAL_PORT);
                addr_buf.len = sizeof(addr_buf.sin);
                addr = &addr_buf;
        }
 
+       addr->sin.sin_port = htons(event ? EVENT_PORT : GENERAL_PORT);
+
        /*
         * Extend the payload by two, for UDP checksum correction.
         * This is not really part of the standard, but it is the way
-- 
2.1.4


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

Reply via email to