aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-11-17 16:58:49 +1100
committerStefano Brivio <sbrivio@redhat.com>2022-11-25 01:35:00 +0100
commit433604a581604fe8acfa9a9022b9c29305642ab7 (patch)
treedff0150f556e9d7cc940c6d736ca6f9d28630403 /tcp.c
parent34476511f724d52ef4d944627ee741e33c1ba3d7 (diff)
downloadpasst-433604a581604fe8acfa9a9022b9c29305642ab7.tar
passt-433604a581604fe8acfa9a9022b9c29305642ab7.tar.gz
passt-433604a581604fe8acfa9a9022b9c29305642ab7.tar.bz2
passt-433604a581604fe8acfa9a9022b9c29305642ab7.tar.lz
passt-433604a581604fe8acfa9a9022b9c29305642ab7.tar.xz
passt-433604a581604fe8acfa9a9022b9c29305642ab7.tar.zst
passt-433604a581604fe8acfa9a9022b9c29305642ab7.zip
tcp: Unify the IN_EPOLL flag
There is very little common between the tcp_tap_conn and tcp_splice_conn structures. However, both do have an IN_EPOLL flag which has the same meaning in each case, though it's stored in a different location. Simplify things slightly by moving this bit into the common header of the two structures. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tcp.c b/tcp.c
index 24cd10b..35fca31 100644
--- a/tcp.c
+++ b/tcp.c
@@ -429,8 +429,8 @@ static const char *tcp_state_str[] __attribute((__unused__)) = {
};
static const char *tcp_flag_str[] __attribute((__unused__)) = {
- "STALLED", "LOCAL", "WND_CLAMPED", "IN_EPOLL", "ACTIVE_CLOSE",
- "ACK_TO_TAP_DUE", "ACK_FROM_TAP_DUE",
+ "STALLED", "LOCAL", "WND_CLAMPED", "ACTIVE_CLOSE", "ACK_TO_TAP_DUE",
+ "ACK_FROM_TAP_DUE",
};
/* Listening sockets, used for automatic port forwarding in pasta mode only */
@@ -660,14 +660,14 @@ static void conn_flag_do(const struct ctx *c, struct tcp_tap_conn *conn,
*/
static int tcp_epoll_ctl(const struct ctx *c, struct tcp_tap_conn *conn)
{
- int m = (conn->flags & IN_EPOLL) ? EPOLL_CTL_MOD : EPOLL_CTL_ADD;
+ int m = conn->c.in_epoll ? EPOLL_CTL_MOD : EPOLL_CTL_ADD;
union epoll_ref ref = { .r.proto = IPPROTO_TCP, .r.s = conn->sock,
.r.p.tcp.tcp.index = CONN_IDX(conn),
.r.p.tcp.tcp.v6 = CONN_V6(conn) };
struct epoll_event ev = { .data.u64 = ref.u64 };
if (conn->events == CLOSED) {
- if (conn->flags & IN_EPOLL)
+ if (conn->c.in_epoll)
epoll_ctl(c->epollfd, EPOLL_CTL_DEL, conn->sock, &ev);
if (conn->timer != -1)
epoll_ctl(c->epollfd, EPOLL_CTL_DEL, conn->timer, &ev);
@@ -679,7 +679,7 @@ static int tcp_epoll_ctl(const struct ctx *c, struct tcp_tap_conn *conn)
if (epoll_ctl(c->epollfd, m, conn->sock, &ev))
return -errno;
- conn->flags |= IN_EPOLL; /* No need to log this */
+ conn->c.in_epoll = true;
if (conn->timer != -1) {
union epoll_ref ref_t = { .r.proto = IPPROTO_TCP,