diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-05-21 15:57:06 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-05-22 23:21:01 +0200 |
commit | 43571852e62dae90fd0404b8a7c73e727930718e (patch) | |
tree | d37eb4b753a1f6a7bddbd2055080a800755db4f3 /tcp_conn.h | |
parent | 0060acd11b191e0699e2c588a565c4929523db06 (diff) | |
download | passt-43571852e62dae90fd0404b8a7c73e727930718e.tar passt-43571852e62dae90fd0404b8a7c73e727930718e.tar.gz passt-43571852e62dae90fd0404b8a7c73e727930718e.tar.bz2 passt-43571852e62dae90fd0404b8a7c73e727930718e.tar.lz passt-43571852e62dae90fd0404b8a7c73e727930718e.tar.xz passt-43571852e62dae90fd0404b8a7c73e727930718e.tar.zst passt-43571852e62dae90fd0404b8a7c73e727930718e.zip |
flow: Make side 0 always be the initiating side
Each flow in the flow table has two sides, 0 and 1, representing the
two interfaces between which passt/pasta will forward data for that flow.
Which side is which is currently up to the protocol specific code: TCP
uses side 0 for the host/"sock" side and 1 for the guest/"tap" side, except
for spliced connections where it uses 0 for the initiating side and 1 for
the target side. ICMP also uses 0 for the host/"sock" side and 1 for the
guest/"tap" side, but in its case the latter is always also the initiating
side.
Make this generically consistent by always using side 0 for the initiating
side and 1 for the target side. This doesn't simplify a lot for now, and
arguably makes TCP slightly more complex, since we add an extra field to
the connection structure to record which is the guest facing side. This is
an interim change, which we'll be able to remove later.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>q
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp_conn.h')
-rw-r--r-- | tcp_conn.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -13,6 +13,7 @@ * struct tcp_tap_conn - Descriptor for a TCP connection (not spliced) * @f: Generic flow information * @in_epoll: Is the connection in the epoll set? + * @tapside: Which side of the flow faces the tap/guest interface * @tap_mss: MSS advertised by tap/guest, rounded to 2 ^ TCP_MSS_BITS * @sock: Socket descriptor number * @events: Connection events, implying connection states @@ -39,6 +40,7 @@ struct tcp_tap_conn { struct flow_common f; bool in_epoll :1; + unsigned tapside :1; #define TCP_RETRANS_BITS 3 unsigned int retrans :TCP_RETRANS_BITS; @@ -106,7 +108,6 @@ struct tcp_tap_conn { uint32_t seq_init_from_tap; }; -#define SIDES 2 /** * struct tcp_splice_conn - Descriptor for a spliced TCP connection * @f: Generic flow information |