* [libnftnl PATCHv2] fib: Add support for NFTA_FIB_F_PRESENT flag
@ 2017-03-11 13:27 Phil Sutter
2017-03-13 11:15 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2017-03-11 13:27 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
Reflect existence of flag in debug output so testsuite can check for it.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Changes since v1:
- Print 'present' keyword if flag is set instead of ignoring it.
---
include/linux/netfilter/nf_tables.h | 1 +
src/expr/fib.c | 8 ++++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h
index 4f7d75682c591..a9280a6541ac6 100644
--- a/include/linux/netfilter/nf_tables.h
+++ b/include/linux/netfilter/nf_tables.h
@@ -1257,6 +1257,7 @@ enum nft_fib_flags {
NFTA_FIB_F_MARK = 1 << 2, /* use skb->mark */
NFTA_FIB_F_IIF = 1 << 3, /* restrict to iif */
NFTA_FIB_F_OIF = 1 << 4, /* restrict to oif */
+ NFTA_FIB_F_PRESENT = 1 << 5, /* check existence only */
};
#define NFT_OBJECT_UNSPEC 0
diff --git a/src/expr/fib.c b/src/expr/fib.c
index 9e63621e72877..f3be0810d3250 100644
--- a/src/expr/fib.c
+++ b/src/expr/fib.c
@@ -173,7 +173,8 @@ nftnl_expr_fib_snprintf_default(char *buf, size_t size,
{
struct nftnl_expr_fib *fib = nftnl_expr_data(e);
int len = size, offset = 0, ret, i;
- uint32_t flags = fib->flags;
+ uint32_t flags = fib->flags & ~NFTA_FIB_F_PRESENT;
+ uint32_t present_flag = fib->flags & NFTA_FIB_F_PRESENT;
static const struct {
int bit;
const char *name;
@@ -203,7 +204,10 @@ nftnl_expr_fib_snprintf_default(char *buf, size_t size,
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
}
- ret = snprintf(buf + offset, len, "%s => reg %d ", fib_type_str(fib->result), fib->dreg);
+ ret = snprintf(buf + offset, len, "%s%s => reg %d ",
+ fib_type_str(fib->result),
+ present_flag ? " present" : "",
+ fib->dreg);
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
return offset;
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [libnftnl PATCHv2] fib: Add support for NFTA_FIB_F_PRESENT flag
2017-03-11 13:27 [libnftnl PATCHv2] fib: Add support for NFTA_FIB_F_PRESENT flag Phil Sutter
@ 2017-03-13 11:15 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-03-13 11:15 UTC (permalink / raw)
To: Phil Sutter; +Cc: netfilter-devel
On Sat, Mar 11, 2017 at 02:27:16PM +0100, Phil Sutter wrote:
> Reflect existence of flag in debug output so testsuite can check for it.
Applied, thanks Phil.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-13 11:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-11 13:27 [libnftnl PATCHv2] fib: Add support for NFTA_FIB_F_PRESENT flag Phil Sutter
2017-03-13 11:15 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).