Skip to content

Commit

Permalink
udp: set the destination port unconditionally.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
richardcochran committed Aug 29, 2015
1 parent 0135e53 commit 8d1b30d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8d1b30d

Please sign in to comment.