diff options
| author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2020-01-24 20:35:41 +0000 |
|---|---|---|
| committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2020-01-24 20:35:41 +0000 |
| commit | 75b893375fbc9a10f09f31ca773087e575fa3558 (patch) | |
| tree | b8187f23442ad49f736000fc83956785593fa89c /sys | |
| parent | cd0047f3a9f3531d9181ca1cd38f554f6351af6c (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/netinet/libalias/alias.c | 10 | ||||
| -rw-r--r-- | sys/netinet/libalias/alias.h | 8 | ||||
| -rw-r--r-- | sys/netinet/libalias/libalias.3 | 5 |
3 files changed, 22 insertions, 1 deletions
diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c index d5dd8f2d08c9..df88b1b8bc7a 100644 --- a/sys/netinet/libalias/alias.c +++ b/sys/netinet/libalias/alias.c @@ -1413,6 +1413,10 @@ getout: #define UNREG_ADDR_C_LOWER 0xc0a80000 #define UNREG_ADDR_C_UPPER 0xc0a8ffff +/* 100.64.0.0 -> 100.127.255.255 (RFC 6598 - Carrier Grade NAT) */ +#define UNREG_ADDR_CGN_LOWER 0x64400000 +#define UNREG_ADDR_CGN_UPPER 0x647fffff + int LibAliasOut(struct libalias *la, char *ptr, int maxpacketsize) { @@ -1464,7 +1468,8 @@ LibAliasOutLocked(struct libalias *la, char *ptr, /* valid IP packet */ } addr_save = GetDefaultAliasAddress(la); - if (la->packetAliasMode & PKT_ALIAS_UNREGISTERED_ONLY) { + if (la->packetAliasMode & PKT_ALIAS_UNREGISTERED_ONLY || + la->packetAliasMode & PKT_ALIAS_UNREGISTERED_CGN) { u_long addr; int iclass; @@ -1476,6 +1481,9 @@ LibAliasOutLocked(struct libalias *la, char *ptr, /* valid IP packet */ iclass = 2; else if (addr >= UNREG_ADDR_A_LOWER && addr <= UNREG_ADDR_A_UPPER) iclass = 1; + else if (addr >= UNREG_ADDR_CGN_LOWER && addr <= UNREG_ADDR_CGN_UPPER && + la->packetAliasMode & PKT_ALIAS_UNREGISTERED_CGN) + iclass = 4; if (iclass == 0) { SetDefaultAliasAddress(la, pip->ip_src); diff --git a/sys/netinet/libalias/alias.h b/sys/netinet/libalias/alias.h index 0b8875ec62f1..41cd7b2c23d1 100644 --- a/sys/netinet/libalias/alias.h +++ b/sys/netinet/libalias/alias.h @@ -228,6 +228,14 @@ struct mbuf *m_megapullup(struct mbuf *, int); */ #define PKT_ALIAS_SKIP_GLOBAL 0x200 +/* + * Like PKT_ALIAS_UNREGISTERED_ONLY, but includes the RFC 6598 + * (Carrier Grade NAT) address range as follows: + * + * 100.64.0.0 -> 100.127.255.255 + */ +#define PKT_ALIAS_UNREGISTERED_CGN 0x400 + /* Function return codes. */ #define PKT_ALIAS_ERROR -1 #define PKT_ALIAS_OK 1 diff --git a/sys/netinet/libalias/libalias.3 b/sys/netinet/libalias/libalias.3 index e496168264e5..fe85730f095d 100644 --- a/sys/netinet/libalias/libalias.3 +++ b/sys/netinet/libalias/libalias.3 @@ -212,6 +212,11 @@ This option is useful in the case that the packet aliasing host has both registered and unregistered subnets on different interfaces. The registered subnet is fully accessible to the outside world, so traffic from it does not need to be passed through the packet aliasing engine. +.It Dv PKT_ALIAS_UNREGISTERED_CGN +Like PKT_ALIAS_UNREGISTERED_ONLY, but includes the RFC 6598 (Carrier Grade +NAT) subnet as follows: +.Pp +100.64.0.0 -> 100.127.255.255 (RFC 6598 subnet) .It Dv PKT_ALIAS_RESET_ON_ADDR_CHANGE When this mode bit is set and .Fn LibAliasSetAddress |
