From owner-dev-commits-src-branches@freebsd.org Thu Feb 25 10:21:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E415B55DFBD; Thu, 25 Feb 2021 10:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DmTN96B23z4VCL; Thu, 25 Feb 2021 10:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C734515BAD; Thu, 25 Feb 2021 10:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11PALTtr043572; Thu, 25 Feb 2021 10:21:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11PALTHG043571; Thu, 25 Feb 2021 10:21:29 GMT (envelope-from git) Date: Thu, 25 Feb 2021 10:21:29 GMT Message-Id: <202102251021.11PALTHG043571@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: d65b86dd9325 - stable/13 - netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d65b86dd9325ce8d46fb7e82efb03c73c9957a77 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2021 10:21:30 -0000 The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=d65b86dd9325ce8d46fb7e82efb03c73c9957a77 commit d65b86dd9325ce8d46fb7e82efb03c73c9957a77 Author: Neel Chauhan AuthorDate: 2021-01-24 19:23:39 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-02-25 10:21:03 +0000 netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support This extends upon the RFC 6598 support to libalias/ipfw in r357092. Reviewed By: manpages (bcr), donner, adrian, kp Differential Revision: https://reviews.freebsd.org/D23461 (cherry picked from commit 5fe433a6e4d8cab6b64284698301afc0c55a9db2) --- share/man/man4/ng_nat.4 | 8 +++++++- sys/netgraph/ng_nat.c | 2 ++ sys/netgraph/ng_nat.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/share/man/man4/ng_nat.4 b/share/man/man4/ng_nat.4 index b7c65fe89b20..e9c0f2acbcee 100644 --- a/share/man/man4/ng_nat.4 +++ b/share/man/man4/ng_nat.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 12, 2018 +.Dd January 24, 2021 .Dt NG_NAT 4 .Os .Sh NAME @@ -75,7 +75,13 @@ struct ng_nat_mode { #define NG_NAT_RESET_ON_ADDR_CHANGE 0x20 #define NG_NAT_PROXY_ONLY 0x40 #define NG_NAT_REVERSE 0x80 +#define NG_NAT_UNREGISTERED_CGN 0x100 .Ed +.Pp +The corresponding libalias flags can be found by replacing the +.Vt "NG_NAT" +prefix with +.Vt "PKT_ALIAS" . .It Dv NGM_NAT_SET_TARGET Pq Ic settarget Configure target address for a node. When an incoming packet not associated with any pre-existing aliasing diff --git a/sys/netgraph/ng_nat.c b/sys/netgraph/ng_nat.c index a5c776ef6db6..cd3442914311 100644 --- a/sys/netgraph/ng_nat.c +++ b/sys/netgraph/ng_nat.c @@ -961,6 +961,8 @@ ng_nat_translate_flags(unsigned int x) res |= PKT_ALIAS_PROXY_ONLY; if (x & NG_NAT_REVERSE) res |= PKT_ALIAS_REVERSE; + if (x & NG_NAT_UNREGISTERED_CGN) + res |= PKT_ALIAS_UNREGISTERED_CGN; return (res); } diff --git a/sys/netgraph/ng_nat.h b/sys/netgraph/ng_nat.h index 46c9609772ff..b56d45c10671 100644 --- a/sys/netgraph/ng_nat.h +++ b/sys/netgraph/ng_nat.h @@ -54,6 +54,7 @@ struct ng_nat_mode { #define NG_NAT_RESET_ON_ADDR_CHANGE 0x20 #define NG_NAT_PROXY_ONLY 0x40 #define NG_NAT_REVERSE 0x80 +#define NG_NAT_UNREGISTERED_CGN 0x100 #define NG_NAT_DESC_LENGTH 64 #define NG_NAT_REDIRPROTO_ADDR (IPPROTO_MAX + 3) /* LibAlias' LINK_ADDR, also unused in in.h */