mirror of
https://passt.top/passt
synced 2025-06-10 17:45:34 +02:00
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>
This commit is contained in:
parent
955dd3251c
commit
b60fa33eea
3 changed files with 9 additions and 7 deletions
6
tcp.c
6
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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue