From: pablo@netfilter.org
To: netdev@vger.kernel.org
Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net
Subject: [PATCH 2/3] netlink: allow to pass data pointer to netlink_dump_start() callback
Date: Sat, 25 Feb 2012 01:30:16 +0100 [thread overview]
Message-ID: <1330129817-28199-3-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1330129817-28199-1-git-send-email-pablo@netfilter.org>
From: Pablo Neira Ayuso <pablo@netfilter.org>
This patch allows you to pass a data pointer that can be
accessed from the dump callback.
Netfilter is going to use this patch to provide filtered dumps
to user-space. This is specifically interesting in ctnetlink that
may handle lots of conntrack entries. We can save precious
cycles by skipping the conversion to TLV format of conntrack
entries that are not interesting for user-space.
More specifically, ctnetlink will include one operation to allow
to filter the dumping of conntrack entries by ctmark values.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/linux/netlink.h | 2 ++
net/netlink/af_netlink.c | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 1f8c1a9..a2092f5 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -225,6 +225,7 @@ struct netlink_callback {
int (*dump)(struct sk_buff * skb,
struct netlink_callback *cb);
int (*done)(struct netlink_callback *cb);
+ void *data;
u16 family;
u16 min_dump_alloc;
unsigned int prev_seq, seq;
@@ -251,6 +252,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
struct netlink_dump_control {
int (*dump)(struct sk_buff *skb, struct netlink_callback *);
int (*done)(struct netlink_callback*);
+ void *data;
u16 min_dump_alloc;
};
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index ab74845..32bb753 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1750,6 +1750,7 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
cb->dump = control->dump;
cb->done = control->done;
cb->nlh = nlh;
+ cb->data = control->data;
cb->min_dump_alloc = control->min_dump_alloc;
atomic_inc(&skb->users);
cb->skb = skb;
--
1.7.7.3
next prev parent reply other threads:[~2012-02-25 0:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-25 0:30 [PATCH 0/3] netlink: netlink_dump_start takes pointer to data pablo
2012-02-25 0:30 ` [PATCH 1/3] netlink: add netlink_dump_control structure for netlink_dump_start() pablo
2012-02-25 1:12 ` Jan Engelhardt
2012-02-25 13:22 ` Pablo Neira Ayuso
2012-02-26 19:26 ` David Miller
2012-02-25 0:30 ` pablo [this message]
2012-02-26 19:27 ` [PATCH 2/3] netlink: allow to pass data pointer to netlink_dump_start() callback David Miller
2012-02-25 0:30 ` [PATCH 3/3] netfilter: ctnetlink: support kernel-space dump filtering by ctmark pablo
2012-02-25 0:41 ` Pablo Neira Ayuso
2012-02-26 19:27 ` David Miller
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=1330129817-28199-3-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--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).