1
0
mirror of https://passt.top/passt synced 2024-09-19 14:00:53 +00:00

Revert "udp: Make rport calculation more local"

This reverts commit c80fa6a6bb, as it
reintroduces the issue fixed by commit 1e6f92b995 ("udp: Fix 16-bit
overflow in udp_invert_portmap()").

Reported-by: Laurent Jacquot <jk@lutty.net>
Link: https://bugs.passt.top/show_bug.cgi?id=80
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Stefano Brivio 2024-06-21 13:59:48 +02:00
parent c66f0341d9
commit 054697598f

3
udp.c
View File

@ -279,9 +279,10 @@ static void udp_invert_portmap(struct udp_fwd_ports *fwd)
"Forward and reverse delta arrays must have same size");
for (i = 0; i < ARRAY_SIZE(fwd->f.delta); i++) {
in_port_t delta = fwd->f.delta[i];
in_port_t rport = i + delta;
if (delta)
fwd->rdelta[i + delta] = NUM_PORTS - delta;
fwd->rdelta[rport] = NUM_PORTS - delta;
}
}