1
0
mirror of https://passt.top/passt synced 2024-06-30 15:02:40 +00:00

tcp: Consistent usage of ports in tcp_seq_init()

In tcp_seq_init() the meaning of "src" and "dst" isn't really clear since
it's used for connections in both directions.  However, these values are
just feeding a hash, so as long as we're consistent and include all the
information we want, it doesn't really matter.

Oddly, for the "src" side we supply the (tap side) forwarding address but
the (tap side) endpoint port.  This again doesn't really matter, but it's
confusing.  So swap this with dstport, so "src" is always forwarding
and "dst" is always endpoint.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2023-08-22 15:29:55 +10:00 committed by Stefano Brivio
parent bccfbff193
commit 8aa32009ed

4
tcp.c
View File

@ -1857,8 +1857,8 @@ static void tcp_seq_init(const struct ctx *c, struct tcp_tap_conn *conn,
in_port_t dstport;
} __attribute__((__packed__)) in = {
.src = conn->faddr,
.srcport = conn->eport,
.dstport = conn->fport,
.srcport = conn->fport,
.dstport = conn->eport,
};
uint32_t ns, seq = 0;