From 60bd16119d99a674f4cff54b479bef1a826018ee Mon Sep 17 00:00:00 2001 From: Dirk Meyer Date: Thu, 20 Aug 2020 08:13:42 +0200 Subject: [PATCH] - fix regression introduced in fping 4.3 bind to source only when option was set. this allows to work in jails and lxc with custom IPs. this allows IPv4 only and IPv6 only hosts --- src/fping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fping.c b/src/fping.c index 9baeba1..8a1ec0f 100644 --- a/src/fping.c +++ b/src/fping.c @@ -995,11 +995,11 @@ int main(int argc, char** argv) exit(num_noaddress ? 2 : 1); } - if (socket4 >= 0) { + if (src_addr_set && socket4 >= 0) { socket_set_src_addr_ipv4(socket4, &src_addr, (socktype4 == SOCK_DGRAM) ? &ident4 : NULL); } #ifdef IPV6 - if (socket6 >= 0) { + if (src_addr6_set && socket6 >= 0) { socket_set_src_addr_ipv6(socket6, &src_addr6, (socktype6 == SOCK_DGRAM) ? &ident6 : NULL); } #endif