conf: Fix typo and logic in conf_ports() check for port binding
Ouch, I accidentally pushed the previous change without running the
tests:
- we need to check, in conf_ports(), that udp_sock_init()
managed to bind at least a port, not the opposite
- for -T and -U, we have no way to know if we'll manage to bind
the port later, so never report an error for those
Fixes: 3d0de2c1d7
("conf, tcp, udp: Exit if we fail to bind sockets for all given ports")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
36f0199f6e
commit
4663ccc89a
1 changed files with 7 additions and 1 deletions
8
conf.c
8
conf.c
|
@ -306,6 +306,9 @@ static void conf_ports(const struct ctx *c, char optname, const char *optarg,
|
|||
} else if (optname == 'u') {
|
||||
if (!udp_sock_init(c, 0, af, addr, ifname, i))
|
||||
bound_one = true;
|
||||
} else {
|
||||
/* No way to check in advance for -T and -U */
|
||||
bound_one = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,8 +359,11 @@ static void conf_ports(const struct ctx *c, char optname, const char *optarg,
|
|||
if (!tcp_sock_init(c, af, addr, ifname, i))
|
||||
bound_one = true;
|
||||
} else if (optname == 'u') {
|
||||
if (udp_sock_init(c, 0, af, addr, ifname, i))
|
||||
if (!udp_sock_init(c, 0, af, addr, ifname, i))
|
||||
bound_one = true;
|
||||
} else {
|
||||
/* No way to check in advance for -T and -U */
|
||||
bound_one = true;
|
||||
}
|
||||
}
|
||||
} while ((p = next_chunk(p, ',')));
|
||||
|
|
Loading…
Reference in a new issue