udp6: 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
parent
8d1b30d91c
commit
1e35b91c6a
5
udp6.c
5
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));
|
||||
|
|
Loading…
Reference in New Issue