bitwise shift support
cover bitwise shift support
The kernel supports bitwise shift operations. This patch-set adds the netlink support.
There is a preliminary patch adding some editor artefacts to .gitignore.
Jeremy Sowden (2):
gitignore: add tag and Emacs back-up files.
bitwise: add support for left and right shifts.
.gitignore | 9 ++ include/libnftnl/expr.h | 2 + include/linux/netfilter/nf_tables.h | 4 + src/expr/bitwise.c | 68 ++++++++-- tests/nft-expr_bitwise-test.c | 186 +++++++++++++++++++++++++--- 5 files changed, 241 insertions(+), 28 deletions(-)
Signature · 1 line
2.24.1
PATCH 1/2 gitignore: add tag and Emacs back-up files.
Signed-off-by Jeremy Sowden <[email protected]>
--- .gitignore | 9 +++++++++ 1 file changed, 9 insertions(+)
.gitignore +9 -0
@@ -29,3 +29,12 @@ examples/* tests/* !tests/*.c !tests/Makefile.am + +# Tag files for Vim and Emacs. +TAGS +tags + +# Emacs back-up files +*~ +\#*\# +.\#*
Signature · 1 line
2.24.1
PATCH 2/2 bitwise: add support for left and right shifts.
In reply to Jeremy SowdenAdd new attributes to bitwise expressions to implement bit-shifts.
Signed-off-by Jeremy Sowden <[email protected]>
--- include/libnftnl/expr.h | 2 + include/linux/netfilter/nf_tables.h | 4 + src/expr/bitwise.c | 52 +++++++- tests/nft-expr_bitwise-test.c | 186 +++++++++++++++++++++++++--- 4 files changed, 225 insertions(+), 19 deletions(-)
include/libnftnl/expr.h +2 -0
@@ -116,6 +116,8 @@ enum {NFTNL_EXPR_BITWISE_LEN ,NFTNL_EXPR_BITWISE_MASK ,NFTNL_EXPR_BITWISE_XOR , +NFTNL_EXPR_BITWISE_LSHIFT , + NFTNL_EXPR_BITWISE_RSHIFT, }; enum {
include/linux/netfilter/nf_tables.h +4 -0
@@ -492,6 +492,8 @@ enum nft_immediate_attributes {* @NFTA_BITWISE_LEN: length of operands (NLA_U32) * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes) * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes) +* @NFTA_BITWISE_LSHIFT: left shift value (NLA_U32) +* @NFTA_BITWISE_RSHIFT: right shift value (NLA_U32) * * The bitwise expression performs the following operation: *
@@ -512,6 +514,8 @@ enum nft_bitwise_attributes {NFTA_BITWISE_LEN ,NFTA_BITWISE_MASK ,NFTA_BITWISE_XOR , +NFTA_BITWISE_LSHIFT , +NFTA_BITWISE_RSHIFT , __NFTA_BITWISE_MAX };#define NFTA_BITWISE_MAX (__NFTA_BITWISE_MAX - 1)
src/expr/bitwise.c +50 -2
105 lines not on this page · raw message
tests/nft-expr_bitwise-test.c +169 -17
247 lines not on this page · raw message
Signature · 1 line
2.24.1