These functions step through all TCP flows. I forgot there was already
a flow_foreach_of_type() macro which makes this easier. Use it.
Signed-off-by: David Gibson
---
tcp.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/tcp.c b/tcp.c
index 88ad886d..16470703 100644
--- a/tcp.c
+++ b/tcp.c
@@ -2907,12 +2907,9 @@ static void tcp_keepalive(struct ctx *c, const struct timespec *now)
c->tcp.keepalive_run = now->tv_sec;
- flow_foreach(flow) {
+ flow_foreach_of_type(flow, FLOW_TCP) {
struct tcp_tap_conn *conn = &flow->tcp;
- if (flow->f.type != FLOW_TCP)
- continue;
-
if (conn->tap_inactive) {
flow_dbg(conn, "No tap activity for least %us, send keepalive",
KEEPALIVE_INTERVAL);
@@ -2938,12 +2935,9 @@ static void tcp_inactivity(struct ctx *c, const struct timespec *now)
debug("TCP inactivity scan");
c->tcp.inactivity_run = now->tv_sec;
- flow_foreach(flow) {
+ flow_foreach_of_type(flow, FLOW_TCP) {
struct tcp_tap_conn *conn = &flow->tcp;
- if (flow->f.type != FLOW_TCP)
- continue;
-
if (conn->inactive) {
/* No activity in this interval, reset */
flow_dbg(conn, "Inactive for at least %us, resetting",
--
2.53.0