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; in_port_t dstport;
} __attribute__((__packed__)) in = { } __attribute__((__packed__)) in = {
.src = conn->faddr, .src = conn->faddr,
.srcport = conn->eport, .srcport = conn->fport,
.dstport = conn->fport, .dstport = conn->eport,
}; };
uint32_t ns, seq = 0; uint32_t ns, seq = 0;