From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kaber@trash.net
Subject: [PATCH RFC 3/9] net: filter: generalise sk_filter_release
Date: Tue, 11 Mar 2014 10:19:14 +0100 [thread overview]
Message-ID: <1394529560-3490-4-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1394529560-3490-1-git-send-email-pablo@netfilter.org>
This patch adds generic a new callback function to release bytecode
area which depends on the socket filter type. This change prepares
the implementation of new socket filtering approaches.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/linux/filter.h | 1 +
include/net/sock.h | 4 +---
net/core/filter.c | 4 ++--
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/include/linux/filter.h b/include/linux/filter.h
index ab37714..7cba4c2 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -28,6 +28,7 @@ struct sk_filter {
struct rcu_head rcu;
unsigned int (*run_filter)(const struct sk_buff *skb,
const struct sock_filter *filter);
+ void (*release_rcu)(struct rcu_head *rcu);
union {
struct sock_filter insns[0];
struct work_struct work;
diff --git a/include/net/sock.h b/include/net/sock.h
index 7b9723c..9f9acbf 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1616,8 +1616,6 @@ void sk_common_release(struct sock *sk);
/* Initialise core socket variables */
void sock_init_data(struct socket *sock, struct sock *sk);
-void sk_filter_release_rcu(struct rcu_head *rcu);
-
/**
* sk_filter_release - release a socket filter
* @fp: filter to remove
@@ -1628,7 +1626,7 @@ void sk_filter_release_rcu(struct rcu_head *rcu);
static inline void sk_filter_release(struct sk_filter *fp)
{
if (atomic_dec_and_test(&fp->refcnt))
- call_rcu(&fp->rcu, sk_filter_release_rcu);
+ call_rcu(&fp->rcu, fp->release_rcu);
}
static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
diff --git a/net/core/filter.c b/net/core/filter.c
index 3ea0e7f..826ca63 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -633,19 +633,19 @@ EXPORT_SYMBOL(sk_chk_filter);
* sk_filter_release_rcu - Release a socket filter by rcu_head
* @rcu: rcu_head that contains the sk_filter to free
*/
-void sk_filter_release_rcu(struct rcu_head *rcu)
+static void sk_filter_release_rcu(struct rcu_head *rcu)
{
struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu);
bpf_jit_free(fp);
}
-EXPORT_SYMBOL(sk_filter_release_rcu);
static int __sk_prepare_filter(struct sk_filter *fp)
{
int err;
fp->run_filter = sk_run_filter;
+ fp->release_rcu = sk_filter_release_rcu;
err = sk_chk_filter(fp->insns, sk_bpf_flen(fp));
if (err)
--
1.7.10.4
next prev parent reply other threads:[~2014-03-11 9:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-11 9:19 [PATCH RFC 0/9] socket filtering using nf_tables Pablo Neira Ayuso
2014-03-11 9:19 ` [PATCH RFC 1/9] net: rename fp->bpf_func to fp->run_filter Pablo Neira Ayuso
2014-03-11 9:19 ` [PATCH RFC 2/9] net: filter: account filter length in bytes Pablo Neira Ayuso
2014-03-11 9:19 ` Pablo Neira Ayuso [this message]
2014-03-11 9:19 ` [PATCH RFC 4/9] netfilter: nf_tables: move fast operations to header Pablo Neira Ayuso
2014-03-11 9:19 ` [PATCH RFC 5/9] netfilter: nf_tables: add nft_value_init Pablo Neira Ayuso
2014-03-11 9:19 ` [PATCH RFC 6/9] netfilter: nf_tables: rename nf_tables_core.c to nf_tables_nf.c Pablo Neira Ayuso
2014-03-11 9:19 ` [PATCH RFC 7/9] netfilter: nf_tables: move expression infrastructure to built-in core Pablo Neira Ayuso
2014-03-11 9:19 ` [PATCH RFC 8/9] netfilter: nf_tables: generalize verdict handling and introduce scopes Pablo Neira Ayuso
2014-03-11 9:19 ` [PATCH RFC 9/9] netfilter: nf_tables: add support for socket filtering Pablo Neira Ayuso
2014-03-11 10:29 ` [PATCH RFC 0/9] socket filtering using nf_tables Daniel Borkmann
2014-03-11 17:59 ` Alexei Starovoitov
2014-03-12 9:15 ` Pablo Neira Ayuso
2014-03-12 9:27 ` Pablo Neira Ayuso
2014-03-13 3:29 ` Alexei Starovoitov
2014-03-13 12:29 ` Pablo Neira Ayuso
2014-03-14 15:28 ` Alexei Starovoitov
2014-03-14 18:16 ` Pablo Neira Ayuso
2014-03-15 4:04 ` Alexei Starovoitov
2014-03-15 19:03 ` Pablo Neira Ayuso
2014-03-15 19:18 ` Alexei Starovoitov
2014-03-11 12:57 ` Andi Kleen
2014-04-04 15:24 ` David Miller
2014-04-04 15:27 ` Pablo Neira Ayuso
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=1394529560-3490-4-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=kaber@trash.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).