aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-05-21 11:14:42 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-05-21 11:14:42 +0200
commit7e3e36b2c2d6cc233958aa10da8ef703c693f0b9 (patch)
treec2601701cdc02534d0630385dcac7b39cc1f159f /tcp.c
parent8358400b3f42920bdd437a7aeecbfdefb45ac0a1 (diff)
downloadpasst-7e3e36b2c2d6cc233958aa10da8ef703c693f0b9.tar
passt-7e3e36b2c2d6cc233958aa10da8ef703c693f0b9.tar.gz
passt-7e3e36b2c2d6cc233958aa10da8ef703c693f0b9.tar.bz2
passt-7e3e36b2c2d6cc233958aa10da8ef703c693f0b9.tar.lz
passt-7e3e36b2c2d6cc233958aa10da8ef703c693f0b9.tar.xz
passt-7e3e36b2c2d6cc233958aa10da8ef703c693f0b9.tar.zst
passt-7e3e36b2c2d6cc233958aa10da8ef703c693f0b9.zip
tcp: Close socket on EPOLLHUP or EPOLLRDHUP in non-data state
If the peer doesn't shut down orderly, this might happen: just close the socket then. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tcp.c b/tcp.c
index 3c92d37..bab07ab 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1465,6 +1465,8 @@ void tcp_sock_handler(struct ctx *c, int s, uint32_t events, char *pkt_buf,
tcp_data_from_sock(c, s, now);
tcp_send_to_tap(c, s, FIN | ACK, NULL, 0);
tcp_sock_consume(s, tc[s].seq_ack_from_tap);
+ } else {
+ tcp_close_and_epoll_del(c, s);
}
}
}