diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-02-28 16:39:28 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-02-29 05:41:03 +0100 |
commit | 745fa3816979c535b6b046fbc6710a969360ac02 (patch) | |
tree | 2da4b87401c86b49aa9626603f0a0b0e0a8ab3e3 | |
parent | deea5a84373169a2886bbeaf674a4ebb864ba2ac (diff) | |
download | passt-745fa3816979c535b6b046fbc6710a969360ac02.tar passt-745fa3816979c535b6b046fbc6710a969360ac02.tar.gz passt-745fa3816979c535b6b046fbc6710a969360ac02.tar.bz2 passt-745fa3816979c535b6b046fbc6710a969360ac02.tar.lz passt-745fa3816979c535b6b046fbc6710a969360ac02.tar.xz passt-745fa3816979c535b6b046fbc6710a969360ac02.tar.zst passt-745fa3816979c535b6b046fbc6710a969360ac02.zip |
udp: Fix incorrect usage of IPv6 state in IPv4 path
When forwarding IPv4 packets in udp_tap_handler(), we incorrectly use an
IPv6 address test on our IPv4 address (which could cause an out of bounds
access), and possibly set our bind interface to the IPv6 interface based on
it. Adjust to correctly look at the IPv4 address and IPv4 interface.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | udp.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -875,8 +875,8 @@ int udp_tap_handler(struct ctx *c, uint8_t pif, }; const char *bind_if = NULL; - if (!IN6_IS_ADDR_LOOPBACK(&s_in.sin_addr)) - bind_if = c->ip6.ifname_out; + if (!IN4_IS_ADDR_LOOPBACK(&s_in.sin_addr)) + bind_if = c->ip4.ifname_out; if (!IN4_IS_ADDR_UNSPECIFIED(&c->ip4.addr_out) && !IN4_IS_ADDR_LOOPBACK(&s_in.sin_addr)) |