mirror of
https://passt.top/passt
synced 2025-06-14 03:25:34 +02:00
port_fwd: Split TCP and UDP cases for get_bound_ports()
Currently get_bound_ports() takes a parameter to determine if it scans for UDP or TCP bound ports, but in fact there's almost nothing in common between those two paths. The parameter appears primarily to have been a convenience for when we needed to invoke this function via NS_CALL(). Now that we don't need that, split it into separate TCP and UDP versions. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
180dbc957a
commit
1a40d00895
3 changed files with 46 additions and 35 deletions
4
tcp.c
4
tcp.c
|
@ -3287,13 +3287,13 @@ void tcp_timer(struct ctx *c, const struct timespec *ts)
|
|||
struct tcp_port_rebind_arg rebind_arg = { c, 0 };
|
||||
|
||||
if (c->tcp.fwd_out.mode == FWD_AUTO) {
|
||||
get_bound_ports(c, 0, IPPROTO_TCP);
|
||||
get_bound_ports_tcp(c, 0);
|
||||
rebind_arg.bind_in_ns = 1;
|
||||
NS_CALL(tcp_port_rebind, &rebind_arg);
|
||||
}
|
||||
|
||||
if (c->tcp.fwd_in.mode == FWD_AUTO) {
|
||||
get_bound_ports(c, 1, IPPROTO_TCP);
|
||||
get_bound_ports_tcp(c, 1);
|
||||
rebind_arg.bind_in_ns = 0;
|
||||
tcp_port_rebind(&rebind_arg);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue