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>
This commit is contained in:
parent
deea5a8437
commit
745fa38169
1 changed files with 2 additions and 2 deletions
4
udp.c
4
udp.c
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue