aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-06-21 13:59:48 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-06-24 15:41:38 +0200
commit054697598f97be70d9244c604db44d1ea230c133 (patch)
treee9b98d4e0b1a45bcfae4c10f4a7857293a4c6199
parentc66f0341d94d255e647cca8c4b35192f0f32e181 (diff)
downloadpasst-054697598f97be70d9244c604db44d1ea230c133.tar
passt-054697598f97be70d9244c604db44d1ea230c133.tar.gz
passt-054697598f97be70d9244c604db44d1ea230c133.tar.bz2
passt-054697598f97be70d9244c604db44d1ea230c133.tar.lz
passt-054697598f97be70d9244c604db44d1ea230c133.tar.xz
passt-054697598f97be70d9244c604db44d1ea230c133.tar.zst
passt-054697598f97be70d9244c604db44d1ea230c133.zip
Revert "udp: Make rport calculation more local"
This reverts commit c80fa6a6bb4415ad48f9e11424310875d0d99bc7, as it reintroduces the issue fixed by commit 1e6f92b995a9 ("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>
-rw-r--r--udp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/udp.c b/udp.c
index e79ca93..8181900 100644
--- a/udp.c
+++ b/udp.c
@@ -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;
}
}