From 8d1b30d91cb7331f42e1796b3d7fe24b5036f057 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 29 Aug 2015 10:31:14 +0200 Subject: [PATCH] udp: set the destination port unconditionally. 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 --- 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