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 <richardcochran@gmail.com>
master
Richard Cochran 2015-08-29 10:31:14 +02:00
parent 0135e5344d
commit 8d1b30d91c
1 changed files with 2 additions and 2 deletions

4
udp.c
View File

@ -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_family = AF_INET;
addr_buf.sin.sin_addr = peer ? mcast_addr[MC_PDELAY] : addr_buf.sin.sin_addr = peer ? mcast_addr[MC_PDELAY] :
mcast_addr[MC_PRIMARY]; mcast_addr[MC_PRIMARY];
addr_buf.sin.sin_port = htons(event ? EVENT_PORT :
GENERAL_PORT);
addr_buf.len = sizeof(addr_buf.sin); addr_buf.len = sizeof(addr_buf.sin);
addr = &addr_buf; addr = &addr_buf;
} }
addr->sin.sin_port = htons(event ? EVENT_PORT : GENERAL_PORT);
/* /*
* Extend the payload by two, for UDP checksum correction. * Extend the payload by two, for UDP checksum correction.
* This is not really part of the standard, but it is the way * This is not really part of the standard, but it is the way