diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-07-18 15:26:36 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-07-19 18:33:01 +0200 |
commit | 508adde342f65efc3d58c51beaabb9ae8ecd8137 (patch) | |
tree | e9cb9e1dbfe08d27003fc31dc04d1b7b3dd8051e /flow.h | |
parent | acca4235c46f0b2ecceb991d75a09616309afb3c (diff) | |
download | passt-508adde342f65efc3d58c51beaabb9ae8ecd8137.tar passt-508adde342f65efc3d58c51beaabb9ae8ecd8137.tar.gz passt-508adde342f65efc3d58c51beaabb9ae8ecd8137.tar.bz2 passt-508adde342f65efc3d58c51beaabb9ae8ecd8137.tar.lz passt-508adde342f65efc3d58c51beaabb9ae8ecd8137.tar.xz passt-508adde342f65efc3d58c51beaabb9ae8ecd8137.tar.zst passt-508adde342f65efc3d58c51beaabb9ae8ecd8137.zip |
tcp: Re-use flow hash for initial sequence number generation
We generate TCP initial sequence numbers, when we need them, from a
hash of the source and destination addresses and ports, plus a
timestamp. Moments later, we generate another hash of the same
information plus some more to insert the connection into the flow hash
table.
With some tweaks to the flow_hash_insert() interface and changing the
order we can re-use that hash table hash for the initial sequence
number, rather than calculating another one. It won't generate
identical results, but that doesn't matter as long as the sequence
numbers are well scattered.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'flow.h')
-rw-r--r-- | flow.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -229,7 +229,7 @@ static inline bool flow_sidx_eq(flow_sidx_t a, flow_sidx_t b) return (a.flowi == b.flowi) && (a.sidei == b.sidei); } -void flow_hash_insert(const struct ctx *c, flow_sidx_t sidx); +uint64_t flow_hash_insert(const struct ctx *c, flow_sidx_t sidx); void flow_hash_remove(const struct ctx *c, flow_sidx_t sidx); flow_sidx_t flow_lookup_af(const struct ctx *c, uint8_t proto, uint8_t pif, sa_family_t af, |