aboutgitcodebugslistschat
path: root/port_fwd.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-02-28 22:25:20 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-02-29 09:48:27 +0100
commit3b9098aa49bd083a7900dc6e0219bf76e389afd4 (patch)
tree6d80efa34cd6819d5e263bcd3dc5de7b3fb73875 /port_fwd.h
parent10376e7a2f3780a3591d70da2f7db9b3367e9222 (diff)
downloadpasst-3b9098aa49bd083a7900dc6e0219bf76e389afd4.tar
passt-3b9098aa49bd083a7900dc6e0219bf76e389afd4.tar.gz
passt-3b9098aa49bd083a7900dc6e0219bf76e389afd4.tar.bz2
passt-3b9098aa49bd083a7900dc6e0219bf76e389afd4.tar.lz
passt-3b9098aa49bd083a7900dc6e0219bf76e389afd4.tar.xz
passt-3b9098aa49bd083a7900dc6e0219bf76e389afd4.tar.zst
passt-3b9098aa49bd083a7900dc6e0219bf76e389afd4.zip
fwd: Rename port_fwd.[ch] and their contents
Currently port_fwd.[ch] contains helpers related to port forwarding, particular automatic port forwarding. We're planning to allow much more flexible sorts of forwarding, including both port translation and NAT based on the flow table. This will subsume the existing port forwarding logic, so rename port_fwd.[ch] to fwd.[ch] with matching updates to all the names within. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'port_fwd.h')
-rw-r--r--port_fwd.h44
1 files changed, 0 insertions, 44 deletions
diff --git a/port_fwd.h b/port_fwd.h
deleted file mode 100644
index f6bf1b5..0000000
--- a/port_fwd.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright Red Hat
- * Author: Stefano Brivio <sbrivio@redhat.com>
- * Author: David Gibson <david@gibson.dropbear.id.au>
- */
-
-#ifndef PORT_FWD_H
-#define PORT_FWD_H
-
-/* Number of ports for both TCP and UDP */
-#define NUM_PORTS (1U << 16)
-
-enum port_fwd_mode {
- FWD_SPEC = 1,
- FWD_NONE,
- FWD_AUTO,
- FWD_ALL,
-};
-
-#define PORT_BITMAP_SIZE DIV_ROUND_UP(NUM_PORTS, 8)
-
-/**
- * port_fwd - Describes port forwarding for one protocol and direction
- * @mode: Overall forwarding mode (all, none, auto, specific ports)
- * @scan4: /proc/net fd to scan for IPv4 ports when in AUTO mode
- * @scan6: /proc/net fd to scan for IPv6 ports when in AUTO mode
- * @map: Bitmap describing which ports are forwarded
- * @delta: Offset between the original destination and mapped port number
- */
-struct port_fwd {
- enum port_fwd_mode mode;
- int scan4;
- int scan6;
- uint8_t map[PORT_BITMAP_SIZE];
- in_port_t delta[NUM_PORTS];
-};
-
-void port_fwd_scan_tcp(struct port_fwd *fwd, const struct port_fwd *rev);
-void port_fwd_scan_udp(struct port_fwd *fwd, const struct port_fwd *rev,
- const struct port_fwd *tcp_fwd,
- const struct port_fwd *tcp_rev);
-void port_fwd_init(struct ctx *c);
-
-#endif /* PORT_FWD_H */