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>
---
 udp6.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/udp6.c b/udp6.c
index fdf5799..10ff166 100644
--- a/udp6.c
+++ b/udp6.c
@@ -223,9 +223,6 @@ static int udp6_send(struct transport *t, struct fdarray 
*fda, int event,
                addr_buf.sin6.sin6_family = AF_INET6;
                addr_buf.sin6.sin6_addr =  peer ? mc6_addr[MC_PDELAY] :
                                                  mc6_addr[MC_PRIMARY];
-               addr_buf.sin6.sin6_port = htons(event ? EVENT_PORT :
-                                                       GENERAL_PORT);
-
                if (is_link_local(&addr_buf.sin6.sin6_addr))
                        addr_buf.sin6.sin6_scope_id = udp6->index;
 
@@ -233,6 +230,8 @@ static int udp6_send(struct transport *t, struct fdarray 
*fda, int event,
                addr = &addr_buf;
        }
 
+       addr->sin6.sin6_port = htons(event ? EVENT_PORT : GENERAL_PORT);
+
        len += 2; /* Extend the payload by two, for UDP checksum corrections. */
 
        cnt = sendto(fd, buf, len, 0, &addr->sa, sizeof(addr->sin6));
-- 
2.1.4


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

Reply via email to