aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-08-22 15:29:58 +1000
committerStefano Brivio <sbrivio@redhat.com>2023-08-22 12:15:36 +0200
commitb60fa33eeafbe2d73d3a4cb6586dd4d637751fa7 (patch)
tree8be1d614dad751b9bb746944eee48ec9e5c3d8b6 /tcp.c
parent955dd3251c9e9b0a1469015748e4600f68e8de0a (diff)
downloadpasst-b60fa33eeafbe2d73d3a4cb6586dd4d637751fa7.tar
passt-b60fa33eeafbe2d73d3a4cb6586dd4d637751fa7.tar.gz
passt-b60fa33eeafbe2d73d3a4cb6586dd4d637751fa7.tar.bz2
passt-b60fa33eeafbe2d73d3a4cb6586dd4d637751fa7.tar.lz
passt-b60fa33eeafbe2d73d3a4cb6586dd4d637751fa7.tar.xz
passt-b60fa33eeafbe2d73d3a4cb6586dd4d637751fa7.tar.zst
passt-b60fa33eeafbe2d73d3a4cb6586dd4d637751fa7.zip
tcp: Move in_epoll flag out of common connection structure
The in_epoll boolean is one of only two fields (currently) in the common structure shared between tap and spliced connections. It seems like it belongs there, because both tap and spliced connections use it, and it has roughly the same meaning. Roughly, however, isn't exactly: which fds this flag says are in the epoll varies between the two connection types, and are in type specific fields. So, it's only possible to meaningfully use this value locally in type specific code anyway. This common field is going to get in the way of more widespread generalisation of connection / flow tracking, so move it to separate fields in the tap and splice specific 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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tcp.c b/tcp.c
index 87f443a..f396ede 100644
--- a/tcp.c
+++ b/tcp.c
@@ -634,13 +634,13 @@ 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->c.in_epoll ? EPOLL_CTL_MOD : EPOLL_CTL_ADD;
+ int m = conn->in_epoll ? EPOLL_CTL_MOD : EPOLL_CTL_ADD;
union epoll_ref ref = { .type = EPOLL_TYPE_TCP, .fd = conn->sock,
.tcp.index = CONN_IDX(conn) };
struct epoll_event ev = { .data.u64 = ref.u64 };
if (conn->events == CLOSED) {
- if (conn->c.in_epoll)
+ if (conn->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);
@@ -652,7 +652,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->c.in_epoll = true;
+ conn->in_epoll = true;
if (conn->timer != -1) {
union epoll_ref ref_t = { .type = EPOLL_TYPE_TCP_TIMER,