diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-09-24 19:08:17 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-09-24 14:48:35 +0200 |
commit | 163dc5f18899808e97b92ddae0314928c903bb4b (patch) | |
tree | d2e8984fe9f1b77fbdf5e878173a666c7a66f801 /tcp_splice.c | |
parent | 1128fa03fe73092dc68f30d0550283f0897d1f89 (diff) | |
download | passt-163dc5f18899808e97b92ddae0314928c903bb4b.tar passt-163dc5f18899808e97b92ddae0314928c903bb4b.tar.gz passt-163dc5f18899808e97b92ddae0314928c903bb4b.tar.bz2 passt-163dc5f18899808e97b92ddae0314928c903bb4b.tar.lz passt-163dc5f18899808e97b92ddae0314928c903bb4b.tar.xz passt-163dc5f18899808e97b92ddae0314928c903bb4b.tar.zst passt-163dc5f18899808e97b92ddae0314928c903bb4b.zip |
Consolidate port forwarding configuration into a common structure
The configuration for how to forward ports in and out of the guest/ns is
divided between several different variables. For each connect direction
and protocol we have a mode in the udp/tcp context structure, a bitmap
of which ports to forward also in the context structure and an array of
deltas to apply if the outward facing and inward facing port numbers are
different. This last is a separate global variable, rather than being in
the context structure, for no particular reason. UDP also requires an
additional array which has the reverse mapping used for return packets.
Consolidate these into a re-used substructure in the context structure.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tcp_splice.c')
-rw-r--r-- | tcp_splice.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tcp_splice.c b/tcp_splice.c index 61e9b23..edbcfd4 100644 --- a/tcp_splice.c +++ b/tcp_splice.c @@ -514,7 +514,7 @@ static int tcp_splice_new(const struct ctx *c, struct tcp_splice_conn *conn, struct tcp_splice_connect_ns_arg ns_arg = { c, conn, port, 0 }; int *p, i, s = -1; - if (bitmap_isset(c->tcp.port_to_tap, port)) + if (bitmap_isset(c->tcp.fwd_in.map, port)) p = CONN_V6(conn) ? ns_sock_pool6 : ns_sock_pool4; else p = CONN_V6(conn) ? init_sock_pool6 : init_sock_pool4; @@ -525,7 +525,7 @@ static int tcp_splice_new(const struct ctx *c, struct tcp_splice_conn *conn, break; } - if (s < 0 && bitmap_isset(c->tcp.port_to_tap, port)) { + if (s < 0 && bitmap_isset(c->tcp.fwd_in.map, port)) { NS_CALL(tcp_splice_connect_ns, &ns_arg); return ns_arg.ret; } |