mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix udp-connect on FreeBSD, do send calls on connected UDP socket.
This commit is contained in:
parent
5924a591be
commit
15e8f5c6d4
4 changed files with 23 additions and 9 deletions
|
|
@ -1,5 +1,6 @@
|
|||
25 November 2020: Wouter
|
||||
- with udp-connect ignore connection refused with UDP timeouts.
|
||||
- Fix udp-connect on FreeBSD, do send calls on connected UDP socket.
|
||||
|
||||
24 November 2020: Wouter
|
||||
- Merge PR #283 : Stream reuse. This implements upstream stream
|
||||
|
|
|
|||
|
|
@ -1854,10 +1854,17 @@ randomize_and_send_udp(struct pending* pend, sldns_buffer* packet, int timeout)
|
|||
log_assert(pend->pc && pend->pc->cp);
|
||||
|
||||
/* send it over the commlink */
|
||||
if(!comm_point_send_udp_msg(pend->pc->cp, packet,
|
||||
(struct sockaddr*)&pend->addr, pend->addrlen)) {
|
||||
portcomm_loweruse(outnet, pend->pc);
|
||||
return 0;
|
||||
if(outnet->udp_connect) {
|
||||
if(!comm_point_send_udp_msg(pend->pc->cp, packet, NULL, 0)) {
|
||||
portcomm_loweruse(outnet, pend->pc);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if(!comm_point_send_udp_msg(pend->pc->cp, packet,
|
||||
(struct sockaddr*)&pend->addr, pend->addrlen)) {
|
||||
portcomm_loweruse(outnet, pend->pc);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* system calls to set timeout after sending UDP to make roundtrip
|
||||
|
|
|
|||
|
|
@ -341,10 +341,15 @@ comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet,
|
|||
if(sldns_buffer_remaining(packet) == 0)
|
||||
log_err("error: send empty UDP packet");
|
||||
#endif
|
||||
log_assert(addr && addrlen > 0);
|
||||
sent = sendto(c->fd, (void*)sldns_buffer_begin(packet),
|
||||
sldns_buffer_remaining(packet), 0,
|
||||
addr, addrlen);
|
||||
if(addr) {
|
||||
log_assert(addr && addrlen > 0);
|
||||
sent = sendto(c->fd, (void*)sldns_buffer_begin(packet),
|
||||
sldns_buffer_remaining(packet), 0,
|
||||
addr, addrlen);
|
||||
} else {
|
||||
sent = send(c->fd, (void*)sldns_buffer_begin(packet),
|
||||
sldns_buffer_remaining(packet), 0);
|
||||
}
|
||||
if(sent == -1) {
|
||||
/* try again and block, waiting for IO to complete,
|
||||
* we want to send the answer, and we will wait for
|
||||
|
|
|
|||
|
|
@ -620,7 +620,8 @@ void comm_point_drop_reply(struct comm_reply* repinfo);
|
|||
* Send an udp message over a commpoint.
|
||||
* @param c: commpoint to send it from.
|
||||
* @param packet: what to send.
|
||||
* @param addr: where to send it to.
|
||||
* @param addr: where to send it to. If NULL, send is performed,
|
||||
* for connected sockets, to the connected address.
|
||||
* @param addrlen: length of addr.
|
||||
* @return: false on a failure.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue