Skip to content

Commit

Permalink
Properly abort server connection for stale response
Browse files Browse the repository at this point in the history
When Tempesta forwards stale response, it free original
response and replace it with new one from the cache
then drops connection with upstream server.
However, Tempesta continues to process input skbs and
call `tfw_http_resp_process()` for them, that may lead
to crash. To prevent that just mark connection with
`Conn_Stop` flag .
  • Loading branch information
const-t committed Nov 15, 2024
1 parent facfd38 commit 9da77cb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fw/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -7036,6 +7036,16 @@ tfw_http_resp_process(TfwConn *conn, TfwStream *stream, struct sk_buff *skb,
HTTP2_ECODE_PROTO);
TFW_INC_STAT_BH(serv.msgs_otherr);
}
/*
* Mark server connection as Conn_Stop to prevent multiple
* calls of @tfw_http_resp_process() when original response
* is freed and connection ready for closing. It may happens
* when error occurred in the middle of the message that has
* sent in multiple SKBs. In this case we close connection,
* but still continue to process rest of SKBs and parse data,
* that is dangerous.
*/
TFW_CONN_TYPE(conn) |= Conn_Stop;
/*
* Close connection with backend immediately
* and try to re-establish it later.
Expand Down

0 comments on commit 9da77cb

Please sign in to comment.