introduce rt expression
PATCH v4 1/1 introduce rt expression
From: Anders K. Pedersen <[email protected]>
Introduce support for rt expression for routing related data as implemented in kernel.
Signed-off-by Anders K. Pedersen <[email protected]>
---
v4
- drop NFTA_RT_FAMILY in favor of separate NFT_RT_NEXTHOP4 and NFT_RT_NEXTHOP6
v3
- no changes
v2
- fix comments for enum nft_rt_keys
include/libnftnl/expr.h | 10 ++ include/linux/netfilter/nf_tables.h | 27 ++++ src/Makefile.am | 1 + src/expr/rt.c | 243 ++++++++++++++++++++++++++++++++++++ src/expr_ops.c | 2 + 5 files changed, 283 insertions(+)
include/libnftnl/expr.h +10 -0
@@ -64,6 +64,11 @@ enum { };enum { +NFTNL_EXPR_RT_KEY =NFTNL_EXPR_BASE , +NFTNL_EXPR_RT_DREG , +}; + +enum {NFTNL_EXPR_CMP_SREG =NFTNL_EXPR_BASE ,NFTNL_EXPR_CMP_OP ,NFTNL_EXPR_CMP_DATA ,
@@ -272,6 +277,11 @@ enum { };enum { +NFT_EXPR_RT_KEY =NFT_RULE_EXPR_ATTR_BASE , +NFT_EXPR_RT_DREG , +}; + +enum {NFT_EXPR_CMP_SREG =NFT_RULE_EXPR_ATTR_BASE ,NFT_EXPR_CMP_OP ,NFT_EXPR_CMP_DATA ,
include/linux/netfilter/nf_tables.h +27 -0
@@ -753,6 +753,19 @@ enum nft_meta_keys { };/** +* enum nft_rt_keys - nf_tables routing expression keys +* +* @NFT_RT_CLASSID: realm value of packet's route (skb->dst->tclassid) +* @NFT_RT_NEXTHOP4: routing nexthop for IPv4 +* @NFT_RT_NEXTHOP6: routing nexthop for IPv6 +*/ +enum nft_rt_keys { +NFT_RT_CLASSID , +NFT_RT_NEXTHOP4 , +NFT_RT_NEXTHOP6 , +}; + +/** * enum nft_hash_attributes - nf_tables hash expression netlink attributes * * @NFTA_HASH_SREG: source register (NLA_U32)
@@ -791,6 +804,20 @@ enum nft_meta_attributes {#define NFTA_META_MAX (__NFTA_META_MAX - 1)/** +* enum nft_rt_attributes - nf_tables routing expression netlink attributes +* +* @NFTA_RT_DREG: destination register (NLA_U32) +* @NFTA_RT_KEY: routing data item to load (NLA_U32: nft_rt_keys) +*/ +enum nft_rt_attributes { +NFTA_RT_UNSPEC , +NFTA_RT_DREG , +NFTA_RT_KEY , + __NFTA_RT_MAX +}; +#define NFTA_RT_MAX (__NFTA_RT_MAX - 1) + +/** * enum nft_ct_keys - nf_tables ct expression keys * * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info)
src/Makefile.am +1 -0
@@ -44,6 +44,7 @@ libnftnl_la_SOURCES = utils.c \ expr/queue.c \ expr/quota.c \ expr/reject.c \ + expr/rt.c \ expr/target.c \ expr/masq.c \ expr/redir.c \
src/expr/rt.c new file +243 -0
243 lines not on this page · raw message
src/expr_ops.c +2 -0
@@ -25,6 +25,7 @@ extern struct expr_ops expr_ops_payload;extern struct expr_ops expr_ops_range;extern struct expr_ops expr_ops_redir;extern struct expr_ops expr_ops_reject; +extern struct expr_ops expr_ops_rt;extern struct expr_ops expr_ops_queue;extern struct expr_ops expr_ops_quota;extern struct expr_ops expr_ops_target;
@@ -58,6 +59,7 @@ static struct expr_ops *expr_ops[] = { &expr_ops_range, &expr_ops_redir, &expr_ops_reject, + &expr_ops_rt, &expr_ops_queue, &expr_ops_quota, &expr_ops_target,
Pablo Neira Ayuso
maintainerQuoted 4 lines · Anders K. Pedersen | Cohaesio
From: Anders K. Pedersen <[email protected]>
Introduce support for rt expression for routing related data as implemented in kernel.
Also applied, thanks.