From: Florian Westphal <fw@strlen.de>
To: netfilter-devel@vger.kernel.org
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH 1/2] netfilter: ctnetlink: only export whitelisted flags to userspace
Date: Thu, 22 May 2014 11:43:07 +0200 [thread overview]
Message-ID: <1400751788-7923-2-git-send-email-fw@strlen.de> (raw)
In-Reply-To: <1400751788-7923-1-git-send-email-fw@strlen.de>
Flag bits are part of ABI as they're exposed to userspace.
Upcoming patch will introduce kernel-only flag that we might want to
remove again in the future, so only expose the whitelisted ones (i.e,
all the flags we currently have).
Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/nf_conntrack_netlink.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index ccc46fa..66d8e15 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -130,12 +130,14 @@ ctnetlink_dump_tuples(struct sk_buff *skb,
static inline int
ctnetlink_dump_status(struct sk_buff *skb, const struct nf_conn *ct)
{
- if (nla_put_be32(skb, CTA_STATUS, htonl(ct->status)))
- goto nla_put_failure;
- return 0;
-
-nla_put_failure:
- return -1;
+ static const u32 public_flag_mask = IPS_EXPECTED |
+ IPS_SEEN_REPLY | IPS_ASSURED | IPS_CONFIRMED |
+ IPS_NAT_MASK | IPS_SEQ_ADJUST | IPS_NAT_DONE_MASK |
+ IPS_DYING | IPS_FIXED_TIMEOUT | IPS_TEMPLATE |
+ IPS_UNTRACKED | IPS_HELPER;
+
+ return nla_put_be32(skb, CTA_STATUS,
+ htonl(ct->status & public_flag_mask));
}
static inline int
--
1.8.1.5
next prev parent reply other threads:[~2014-05-22 9:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-22 9:43 [PATCH -next] remove timer from ecache extension Florian Westphal
2014-05-22 9:43 ` Florian Westphal [this message]
2014-05-22 9:43 ` [PATCH 2/2] netfilter: conntrack: " Florian Westphal
2014-06-05 14:25 ` Pablo Neira Ayuso
2014-06-05 14:33 ` Pablo Neira Ayuso
2014-06-05 21:05 ` Florian Westphal
2014-06-05 14:56 ` Florian Westphal
2014-06-10 14:57 ` Pablo Neira Ayuso
2014-06-10 15:36 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400751788-7923-2-git-send-email-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).