tcp: Clarify allowed state for tcp_data_from_tap()
Comments suggest that this should only be called for an ESTABLISHED connection. However, it's non-trivial to ascertain that from the actual control flow in the caller. Add an ASSERT() to make it very clear that this is only called in ESTABLISHED state. In fact, there were some circumstances where it could be called on a CLOSED connection. In a sense that is "established", but with that assert this does require specific (trivial) handling to avoid a spurious abort(). Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
1ee2f7cada
commit
085672f77c
1 changed files with 5 additions and 0 deletions
5
tcp.c
5
tcp.c
|
@ -2337,6 +2337,11 @@ static void tcp_data_from_tap(struct ctx *c, struct tcp_tap_conn *conn,
|
|||
size_t len;
|
||||
ssize_t n;
|
||||
|
||||
if (conn->events == CLOSED)
|
||||
return;
|
||||
|
||||
ASSERT(conn->events & ESTABLISHED);
|
||||
|
||||
for (i = 0, iov_i = 0; i < (int)p->count; i++) {
|
||||
uint32_t seq, seq_offset, ack_seq;
|
||||
struct tcphdr *th;
|
||||
|
|
Loading…
Reference in a new issue