expr: nat: add support for the new flags attribute
PATCH 1/2 expr: nat: add support for the new flags attribute
This patchs adds support for the new flags attribute in the nft_nat expression.
Signed-off-by Arturo Borrero Gonzalez <[email protected]>
---
0 files changed
include/libnftnl/expr.h +1 -0
@@ -100,6 +100,7 @@ enum {NFT_EXPR_NAT_REG_ADDR_MAX ,NFT_EXPR_NAT_REG_PROTO_MIN ,NFT_EXPR_NAT_REG_PROTO_MAX , + NFT_EXPR_NAT_FLAGS, }; enum {
include/linux/netfilter/nf_tables.h +2 -0
@@ -773,6 +773,7 @@ enum nft_nat_types {* @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers) * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers) * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers) +* @NFTA_NAT_FLAGS: additional NAT configuration (NF_NAT_RANGE_*) (NLA_U32) */ enum nft_nat_attributes {NFTA_NAT_UNSPEC ,
@@ -782,6 +783,7 @@ enum nft_nat_attributes {NFTA_NAT_REG_ADDR_MAX ,NFTA_NAT_REG_PROTO_MIN ,NFTA_NAT_REG_PROTO_MAX , +NFTA_NAT_FLAGS , __NFTA_NAT_MAX };#define NFTA_NAT_MAX (__NFTA_NAT_MAX - 1)
src/expr/nat.c +45 -3
130 lines not on this page · raw message
PATCH 2/2 expr: nat: add masquerade support
This patch adds masquerade support for the nat expression.
Signed-off-by Arturo Borrero Gonzalez <[email protected]>
---
0 files changed
include/linux/netfilter/nf_tables.h +2 -0
@@ -758,10 +758,12 @@ enum nft_reject_attributes {* * @NFT_NAT_SNAT: source NAT * @NFT_NAT_DNAT: destination NAT +* @NFT_NAT_MASQUERADE: masquerade NAT */ enum nft_nat_types {NFT_NAT_SNAT ,NFT_NAT_DNAT , +NFT_NAT_MASQUERADE , };/**
src/expr/nat.c +4 -0
@@ -205,6 +205,8 @@ static inline const char *nft_nat2str(uint16_t nat)return "snat" ;case NFT_NAT_DNAT :return "dnat" ; +case NFT_NAT_MASQUERADE : +return "masquerade" ;default :return "unknown" ; }
@@ -216,6 +218,8 @@ static inline int nft_str2nat(const char *nat)return NFT_NAT_SNAT ; else if (strcmp(nat, "dnat") == 0) return NFT_NAT_DNAT; + else if (strcmp(nat, "masquerade") == 0) + return NFT_NAT_MASQUERADE; else { errno =EINVAL ;return -1 ;