aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-02-28 16:39:29 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-02-29 06:23:47 +0100
commit90f1d3b3546eba0e454d227c24b391e184ac092c (patch)
tree212b0dfe97368ff1d98055e95ea3336892dc425c
parent745fa3816979c535b6b046fbc6710a969360ac02 (diff)
downloadpasst-90f1d3b3546eba0e454d227c24b391e184ac092c.tar
passt-90f1d3b3546eba0e454d227c24b391e184ac092c.tar.gz
passt-90f1d3b3546eba0e454d227c24b391e184ac092c.tar.bz2
passt-90f1d3b3546eba0e454d227c24b391e184ac092c.tar.lz
passt-90f1d3b3546eba0e454d227c24b391e184ac092c.tar.xz
passt-90f1d3b3546eba0e454d227c24b391e184ac092c.tar.zst
passt-90f1d3b3546eba0e454d227c24b391e184ac092c.zip
udp: Remove unnecessary test for unspecified addr_out
If the configured output address is unspecified, we don't set the bind address to it when creating a new socket in udp_tap_handler(). That sounds sensible, but what we're leaving the bind address as is, exactly, the unspecified address, so this test makes no difference. Remove it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--udp.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/udp.c b/udp.c
index d55a682..5b7778e 100644
--- a/udp.c
+++ b/udp.c
@@ -878,8 +878,7 @@ int udp_tap_handler(struct ctx *c, uint8_t pif,
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))
+ if (!IN4_IS_ADDR_LOOPBACK(&s_in.sin_addr))
bind_addr = c->ip4.addr_out;
s = sock_l4(c, AF_INET, IPPROTO_UDP, &bind_addr,
@@ -930,8 +929,7 @@ int udp_tap_handler(struct ctx *c, uint8_t pif,
if (!IN6_IS_ADDR_LOOPBACK(&s_in6.sin6_addr))
bind_if = c->ip6.ifname_out;
- if (!IN6_IS_ADDR_UNSPECIFIED(&c->ip6.addr_out) &&
- !IN6_IS_ADDR_LOOPBACK(&s_in6.sin6_addr) &&
+ if (!IN6_IS_ADDR_LOOPBACK(&s_in6.sin6_addr) &&
!IN6_IS_ADDR_LINKLOCAL(&s_in6.sin6_addr))
bind_addr = &c->ip6.addr_out;