aboutgitcodebugslistschat
diff options
context:
space:
mode:
-rw-r--r--tcp.c10
-rw-r--r--tcp_conn.h20
-rw-r--r--tcp_splice.c8
3 files changed, 19 insertions, 19 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,
diff --git a/tcp_conn.h b/tcp_conn.h
index 7c450a0..faa63dc 100644
--- a/tcp_conn.h
+++ b/tcp_conn.h
@@ -14,9 +14,11 @@
/**
* struct tcp_conn_common - Common fields for spliced and non-spliced
* @spliced: Is this a spliced connection?
+ * @in_epoll: Is the connection in the epoll set?
*/
struct tcp_conn_common {
bool spliced :1;
+ bool in_epoll :1;
};
extern const char *tcp_common_flag_str[];
@@ -90,10 +92,9 @@ struct tcp_tap_conn {
#define STALLED BIT(0)
#define LOCAL BIT(1)
#define WND_CLAMPED BIT(2)
-#define IN_EPOLL BIT(3)
-#define ACTIVE_CLOSE BIT(4)
-#define ACK_TO_TAP_DUE BIT(5)
-#define ACK_FROM_TAP_DUE BIT(6)
+#define ACTIVE_CLOSE BIT(3)
+#define ACK_TO_TAP_DUE BIT(4)
+#define ACK_FROM_TAP_DUE BIT(5)
unsigned int hash_bucket :TCP_HASH_BUCKET_BITS;
@@ -170,12 +171,11 @@ struct tcp_splice_conn {
uint8_t flags;
#define SPLICE_V6 BIT(0)
-#define SPLICE_IN_EPOLL BIT(1)
-#define RCVLOWAT_SET_A BIT(2)
-#define RCVLOWAT_SET_B BIT(3)
-#define RCVLOWAT_ACT_A BIT(4)
-#define RCVLOWAT_ACT_B BIT(5)
-#define CLOSING BIT(6)
+#define RCVLOWAT_SET_A BIT(1)
+#define RCVLOWAT_SET_B BIT(2)
+#define RCVLOWAT_ACT_A BIT(3)
+#define RCVLOWAT_ACT_B BIT(4)
+#define CLOSING BIT(5)
uint32_t a_read;
uint32_t a_written;
diff --git a/tcp_splice.c b/tcp_splice.c
index 0ac316d..7a06252 100644
--- a/tcp_splice.c
+++ b/tcp_splice.c
@@ -83,8 +83,8 @@ static const char *tcp_splice_event_str[] __attribute((__unused__)) = {
/* Display strings for connection flags */
static const char *tcp_splice_flag_str[] __attribute((__unused__)) = {
- "SPLICE_V6", "SPLICE_IN_EPOLL", "RCVLOWAT_SET_A", "RCVLOWAT_SET_B",
- "RCVLOWAT_ACT_A", "RCVLOWAT_ACT_B", "CLOSING",
+ "SPLICE_V6", "RCVLOWAT_SET_A", "RCVLOWAT_SET_B", "RCVLOWAT_ACT_A",
+ "RCVLOWAT_ACT_B", "CLOSING",
};
/**
@@ -164,7 +164,7 @@ static void conn_flag_do(const struct ctx *c, struct tcp_splice_conn *conn,
static int tcp_splice_epoll_ctl(const struct ctx *c,
struct tcp_splice_conn *conn)
{
- int m = (conn->flags & SPLICE_IN_EPOLL) ? EPOLL_CTL_MOD : EPOLL_CTL_ADD;
+ int m = conn->c.in_epoll ? EPOLL_CTL_MOD : EPOLL_CTL_ADD;
union epoll_ref ref_a = { .r.proto = IPPROTO_TCP, .r.s = conn->a,
.r.p.tcp.tcp.splice = 1,
.r.p.tcp.tcp.index = CONN_IDX(conn),
@@ -188,7 +188,7 @@ static int tcp_splice_epoll_ctl(const struct ctx *c,
epoll_ctl(c->epollfd, m, conn->b, &ev_b))
goto delete;
- conn->flags |= SPLICE_IN_EPOLL; /* No need to log this */
+ conn->c.in_epoll = true;
return 0;