git: f132be9bac5f - main - netgraph: Enable support for EIM NAT
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Dec 2024 09:33:13 UTC
The branch main has been updated by thj:
URL: https://cgit.FreeBSD.org/src/commit/?id=f132be9bac5f29e844e8dde4f3a70f4c3c158221
commit f132be9bac5f29e844e8dde4f3a70f4c3c158221
Author: Damjan Jovanovic <damjan.jov@gmail.com>
AuthorDate: 2024-12-06 09:31:58 +0000
Commit: Tom Jones <thj@FreeBSD.org>
CommitDate: 2024-12-06 09:31:58 +0000
netgraph: Enable support for EIM NAT
Enable support for endpoint-independent mapping ("full cone NAT") via
Libalias's UDP NAT.
Reviewed by: igoro, thj
Differential Revision: https://reviews.freebsd.org/D46689
---
share/man/man4/ng_nat.4 | 3 ++-
sys/netgraph/ng_nat.c | 2 ++
sys/netgraph/ng_nat.h | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/share/man/man4/ng_nat.4 b/share/man/man4/ng_nat.4
index bf9ec4052733..20042db7a1af 100644
--- a/share/man/man4/ng_nat.4
+++ b/share/man/man4/ng_nat.4
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 24, 2021
+.Dd December 6, 2024
.Dt NG_NAT 4
.Os
.Sh NAME
@@ -74,6 +74,7 @@ struct ng_nat_mode {
#define NG_NAT_PROXY_ONLY 0x40
#define NG_NAT_REVERSE 0x80
#define NG_NAT_UNREGISTERED_CGN 0x100
+#define NG_NAT_UDP_EIM 0x200
.Ed
.Pp
The corresponding libalias flags can be found by replacing the
diff --git a/sys/netgraph/ng_nat.c b/sys/netgraph/ng_nat.c
index e9de0e5b60c8..defbe817becd 100644
--- a/sys/netgraph/ng_nat.c
+++ b/sys/netgraph/ng_nat.c
@@ -967,6 +967,8 @@ ng_nat_translate_flags(unsigned int x)
res |= PKT_ALIAS_REVERSE;
if (x & NG_NAT_UNREGISTERED_CGN)
res |= PKT_ALIAS_UNREGISTERED_CGN;
+ if (x & NG_NAT_UDP_EIM)
+ res |= PKT_ALIAS_UDP_EIM;
return (res);
}
diff --git a/sys/netgraph/ng_nat.h b/sys/netgraph/ng_nat.h
index 73f09459a84c..9b092b7749f0 100644
--- a/sys/netgraph/ng_nat.h
+++ b/sys/netgraph/ng_nat.h
@@ -53,6 +53,7 @@ struct ng_nat_mode {
#define NG_NAT_PROXY_ONLY 0x40
#define NG_NAT_REVERSE 0x80
#define NG_NAT_UNREGISTERED_CGN 0x100
+#define NG_NAT_UDP_EIM 0x200
#define NG_NAT_DESC_LENGTH 64
#define NG_NAT_REDIRPROTO_ADDR (IPPROTO_MAX + 3) /* LibAlias' LINK_ADDR, also unused in in.h */