mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix for the ignore of tcp events for closed comm points, preserve
the use after free protection features.
This commit is contained in:
parent
b86a97019f
commit
6f7da59b77
2 changed files with 13 additions and 2 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
28 November 2022: Wouter
|
||||||
|
- Fix for the ignore of tcp events for closed comm points, preserve
|
||||||
|
the use after free protection features.
|
||||||
|
|
||||||
22 November 2022: George
|
22 November 2022: George
|
||||||
- Ignore expired error responses.
|
- Ignore expired error responses.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2665,6 +2665,7 @@ comm_point_tcp_handle_callback(int fd, short event, void* arg)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
int has_tcpq = (c->tcp_req_info != NULL);
|
int has_tcpq = (c->tcp_req_info != NULL);
|
||||||
|
int* moreread = c->tcp_more_read_again;
|
||||||
if(!comm_point_tcp_handle_read(fd, c, 0)) {
|
if(!comm_point_tcp_handle_read(fd, c, 0)) {
|
||||||
reclaim_tcp_handler(c);
|
reclaim_tcp_handler(c);
|
||||||
if(!c->tcp_do_close) {
|
if(!c->tcp_do_close) {
|
||||||
|
|
@ -2679,12 +2680,13 @@ comm_point_tcp_handle_callback(int fd, short event, void* arg)
|
||||||
if(!tcp_req_info_read_again(fd, c))
|
if(!tcp_req_info_read_again(fd, c))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(c->tcp_more_read_again && *c->tcp_more_read_again)
|
if(moreread && *moreread)
|
||||||
tcp_more_read_again(fd, c);
|
tcp_more_read_again(fd, c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(event&UB_EV_WRITE) {
|
if(event&UB_EV_WRITE) {
|
||||||
int has_tcpq = (c->tcp_req_info != NULL);
|
int has_tcpq = (c->tcp_req_info != NULL);
|
||||||
|
int* morewrite = c->tcp_more_write_again;
|
||||||
if(!comm_point_tcp_handle_write(fd, c)) {
|
if(!comm_point_tcp_handle_write(fd, c)) {
|
||||||
reclaim_tcp_handler(c);
|
reclaim_tcp_handler(c);
|
||||||
if(!c->tcp_do_close) {
|
if(!c->tcp_do_close) {
|
||||||
|
|
@ -2699,7 +2701,7 @@ comm_point_tcp_handle_callback(int fd, short event, void* arg)
|
||||||
if(!tcp_req_info_read_again(fd, c))
|
if(!tcp_req_info_read_again(fd, c))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(c->tcp_more_write_again && *c->tcp_more_write_again)
|
if(morewrite && *morewrite)
|
||||||
tcp_more_write_again(fd, c);
|
tcp_more_write_again(fd, c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -4495,6 +4497,11 @@ comm_point_close(struct comm_point* c)
|
||||||
tcp_req_info_clear(c->tcp_req_info);
|
tcp_req_info_clear(c->tcp_req_info);
|
||||||
if(c->h2_session)
|
if(c->h2_session)
|
||||||
http2_session_server_delete(c->h2_session);
|
http2_session_server_delete(c->h2_session);
|
||||||
|
/* stop the comm point from reading or writing after it is closed. */
|
||||||
|
if(c->tcp_more_read_again && *c->tcp_more_read_again)
|
||||||
|
*c->tcp_more_read_again = 0;
|
||||||
|
if(c->tcp_more_write_again && *c->tcp_more_write_again)
|
||||||
|
*c->tcp_more_write_again = 0;
|
||||||
|
|
||||||
/* close fd after removing from event lists, or epoll.. is messed up */
|
/* close fd after removing from event lists, or epoll.. is messed up */
|
||||||
if(c->fd != -1 && !c->do_not_close) {
|
if(c->fd != -1 && !c->do_not_close) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue