Add support for masq port selection
PATCH 1/1 Add support for masq port selection
Complete masquerading support by allowing port range selection.
Signed-off-by Shivani Bhardwaj <[email protected]>
--- include/libnftnl/expr.h | 4 ++- include/linux/netfilter/nf_tables.h | 2 ++ src/expr/masq.c | 64 ++++++++++++++++++++++++++++++++++--- 3 files changed, 65 insertions(+), 5 deletions(-)
include/libnftnl/expr.h +3 -1
@@ -166,7 +166,9 @@ enum { };enum { -NFTNL_EXPR_MASQ_FLAGS =NFTNL_EXPR_BASE , +NFTNL_EXPR_MASQ_REG_PROTO_MIN =NFTNL_EXPR_BASE , +NFTNL_EXPR_MASQ_REG_PROTO_MAX , +NFTNL_EXPR_MASQ_FLAGS , };enum {
include/linux/netfilter/nf_tables.h +2 -0
@@ -924,6 +924,8 @@ enum nft_nat_attributes {enum nft_masq_attributes {NFTA_MASQ_UNSPEC ,NFTA_MASQ_FLAGS , +NFTA_MASQ_REG_PROTO_MIN , +NFTA_MASQ_REG_PROTO_MAX , __NFTA_MASQ_MAX };#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
src/expr/masq.c +60 -4
124 lines not on this page · raw message
Signature · 1 line
1.9.1
Pablo Neira Ayuso
maintainerQuoted 1 line · Shivani Bhardwaj
Complete masquerading support by allowing port range selection.
Thanks.
Please, include the right subject so we know what tree you're targeting to, this one would be [PATCH libnftnl]
Comments below:
Quoted 51 lines
Signed-off-by Shivani Bhardwaj <[email protected]>--- include/libnftnl/expr.h | 4 ++- include/linux/netfilter/nf_tables.h | 2 ++ src/expr/masq.c | 64 ++++++++++++++++++++++++++++++++++--- 3 files changed, 65 insertions(+), 5 deletions(-)include/libnftnl/expr.h +3
-1@@ -166,7 +166,9 @@ enum { };enum { -NFTNL_EXPR_MASQ_FLAGS =NFTNL_EXPR_BASE , +NFTNL_EXPR_MASQ_REG_PROTO_MIN =NFTNL_EXPR_BASE , +NFTNL_EXPR_MASQ_REG_PROTO_MAX , +NFTNL_EXPR_MASQ_FLAGS , };enum {include/linux/netfilter/nf_tables.h +2
-0@@ -924,6 +924,8 @@ enum nft_nat_attributes {enum nft_masq_attributes {NFTA_MASQ_UNSPEC ,NFTA_MASQ_FLAGS , +NFTA_MASQ_REG_PROTO_MIN , +NFTA_MASQ_REG_PROTO_MAX , __NFTA_MASQ_MAX };#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)src/expr/masq.c +3
-1@@ -21,7 +21,9 @@#include <libnftnl/rule.h> struct nftnl_expr_masq { -uint32_t flags; +uint32_t flags; +enum nft_registers sreg_proto_min; +enum nft_registers sreg_proto_max; }; static int
src/expr/masq.c nftnl_expr_masq_set(struct nftnl_expr *e, uint16_t type, · line 41
Quoted 9 lines
src/expr/masq.c +6
-0@@ -31,6 +33,12 @@ nftnl_expr_masq_set(struct nftnl_expr *e, uint16_t type,struct nftnl_expr_masq *masq =nftnl_expr_data (e);switch (type) { +case NFTNL_EXPR_MASQ_REG_PROTO_MIN : + masq->sreg_proto_min = *((uint32_t *)data); +break ; +case NFTNL_EXPR_MASQ_REG_PROTO_MAX : + masq->sreg_proto_max = *((uint32_t *)data); +break ;
Minor: Please, place these after _FLAGS, so we keep the switch cases in incremental order. Same in other spots.
BTW, don't forget to extend the tests underlibnftnl/tests/nft-expr_masq-test.c
Thanks.