aboutgitcodebugslistschat
path: root/tcp_splice.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-05-21 15:57:07 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-05-22 23:21:03 +0200
commit8a2accb847926d0354f3a45d8c3e00933c9d7e00 (patch)
tree712f1c59549d8a540425160433b8c5c2ff9dfc94 /tcp_splice.c
parent43571852e62dae90fd0404b8a7c73e727930718e (diff)
downloadpasst-8a2accb847926d0354f3a45d8c3e00933c9d7e00.tar
passt-8a2accb847926d0354f3a45d8c3e00933c9d7e00.tar.gz
passt-8a2accb847926d0354f3a45d8c3e00933c9d7e00.tar.bz2
passt-8a2accb847926d0354f3a45d8c3e00933c9d7e00.tar.lz
passt-8a2accb847926d0354f3a45d8c3e00933c9d7e00.tar.xz
passt-8a2accb847926d0354f3a45d8c3e00933c9d7e00.tar.zst
passt-8a2accb847926d0354f3a45d8c3e00933c9d7e00.zip
flow: Record the pifs for each side of each flow
Currently we have no generic information flows apart from the type and state, everything else is specific to the flow type. Start introducing generic flow information by recording the pifs which the flow connects. To keep track of what information is valid, introduce new flow states: INI for when the initiating side information is complete, and TGT for when both sides information is complete, but we haven't chosen the flow type yet. For now, these states don't do an awful lot, but they'll become more important as we add more generic information. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp_splice.c')
-rw-r--r--tcp_splice.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tcp_splice.c b/tcp_splice.c
index 31e2173..b8f64a9 100644
--- a/tcp_splice.c
+++ b/tcp_splice.c
@@ -431,7 +431,7 @@ bool tcp_splice_conn_from_sock(const struct ctx *c,
union inany_addr src;
in_port_t srcport;
sa_family_t af;
- uint8_t pif1;
+ uint8_t tgtpif;
if (c->mode != MODE_PASTA)
return false;
@@ -455,7 +455,7 @@ bool tcp_splice_conn_from_sock(const struct ctx *c,
return true;
}
- pif1 = PIF_HOST;
+ tgtpif = PIF_HOST;
dstport += c->tcp.fwd_out.delta[dstport];
break;
@@ -463,7 +463,7 @@ bool tcp_splice_conn_from_sock(const struct ctx *c,
if (!inany_is_loopback(&src))
return false;
- pif1 = PIF_SPLICE;
+ tgtpif = PIF_SPLICE;
dstport += c->tcp.fwd_in.delta[dstport];
break;
@@ -471,6 +471,7 @@ bool tcp_splice_conn_from_sock(const struct ctx *c,
return false;
}
+ flow_target(flow, tgtpif);
conn = FLOW_SET_TYPE(flow, FLOW_TCP_SPLICE, tcp_splice);
conn->flags = af == AF_INET ? 0 : SPLICE_V6;
@@ -482,7 +483,7 @@ bool tcp_splice_conn_from_sock(const struct ctx *c,
if (setsockopt(s0, SOL_TCP, TCP_QUICKACK, &((int){ 1 }), sizeof(int)))
flow_trace(conn, "failed to set TCP_QUICKACK on %i", s0);
- if (tcp_splice_connect(c, conn, af, pif1, dstport))
+ if (tcp_splice_connect(c, conn, af, tgtpif, dstport))
conn_flag(c, conn, CLOSING);
FLOW_ACTIVATE(conn);