Skip to content

Commit 16314bb

Browse files
committed
BUG/MEDIUM: mux-spop: Properly detect truncated frames on demux to report error
There was no test in the demux part to detect truncated frames and to report an error at the connection level. The SPOP streams were properly switch to half-closed state. But waiting the associated SPOE applets were woken up and released, the SPOP connection could be woken up several times for nothing. I never triggered the watchdog in that case, but it is not excluded. Now, at the end of the demux function, if a specific test was added to detect truncated frames to report an error and close the connection. This patch must be backported to 3.1.
1 parent 71feb49 commit 16314bb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/mux_spop.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,13 @@ static void spop_process_demux(struct spop_conn *spop_conn)
22722272
spop_conn->flags |= SPOP_CF_END_REACHED;
22732273
}
22742274

2275+
if (spop_conn_read0_pending(spop_conn) && (spop_conn->flags & SPOP_CF_DEM_SHORT_READ) && b_data(&spop_conn->dbuf)) {
2276+
spop_conn_error(spop_conn, SPOP_ERR_INVALID);
2277+
spop_conn->state = SPOP_CS_CLOSED;
2278+
TRACE_ERROR("truncated data", SPOP_EV_RX_FRAME|SPOP_EV_RX_FHDR|SPOP_EV_SPOP_CONN_ERR, spop_conn->conn);
2279+
TRACE_STATE("switching to CLOSED", SPOP_EV_RX_FRAME|SPOP_EV_RX_FHDR|SPOP_EV_SPOP_CONN_ERR, spop_conn->conn);
2280+
}
2281+
22752282
if (spop_conn->flags & SPOP_CF_ERROR)
22762283
spop_conn_report_term_evt(spop_conn, ((eb_is_empty(&spop_conn->streams_by_id) && (spop_conn->state == SPOP_CS_RUNNING) && spop_conn->dsi == -1)
22772284
? muxc_tevt_type_rcv_err

0 commit comments

Comments
 (0)