From: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH nf-next 1/3] netfilter: nfnetlink_queue: rename related to nfqueue attaching conntrack info
Date: Fri, 11 Sep 2015 12:07:48 +0900 [thread overview]
Message-ID: <20150911030748.GB7380@gmail.com> (raw)
In-Reply-To: <20150911030530.GA7380@gmail.com>
The idea of this series of patch is to attach conntrack information to
nflog like nfqueue has already done. nfqueue conntrack info attaching
basis is generic, rename those names to generic one, glue.
Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
---
include/linux/netfilter.h | 4 +--
net/netfilter/core.c | 4 +--
net/netfilter/nf_conntrack_netlink.c | 54 +++++++++++++++++-----------------
net/netfilter/nfnetlink_queue.c | 12 ++++----
4 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 89bf246..6df59f0 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -379,7 +379,7 @@ struct nf_conn;
enum ip_conntrack_info;
struct nlattr;
-struct nfq_ct_hook {
+struct nfnl_ct_hook {
struct nf_conn *(*get_ct)(struct sk_buff *skb,
enum ip_conntrack_info *ctinfo);
size_t (*build_size)(const struct nf_conn *ct);
@@ -392,7 +392,7 @@ struct nfq_ct_hook {
void (*seq_adjust)(struct sk_buff *skb, struct nf_conn *ct,
enum ip_conntrack_info ctinfo, s32 off);
};
-extern struct nfq_ct_hook __rcu *nfq_ct_hook;
+extern struct nfnl_ct_hook __rcu *nfnl_ct_hook;
/**
* nf_skb_duplicated - TEE target has sent a packet
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 0b939b7..83fb9e2 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -385,8 +385,8 @@ void nf_conntrack_destroy(struct nf_conntrack *nfct)
}
EXPORT_SYMBOL(nf_conntrack_destroy);
-struct nfq_ct_hook __rcu *nfq_ct_hook __read_mostly;
-EXPORT_SYMBOL_GPL(nfq_ct_hook);
+struct nfnl_ct_hook __rcu *nfnl_ct_hook __read_mostly;
+EXPORT_SYMBOL_GPL(nfnl_ct_hook);
#endif /* CONFIG_NF_CONNTRACK */
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index ee7b544..d6a5514 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -2139,8 +2139,8 @@ ctnetlink_alloc_expect(const struct nlattr *const cda[], struct nf_conn *ct,
struct nf_conntrack_tuple *mask);
#ifdef CONFIG_NETFILTER_NETLINK_QUEUE_CT
-static struct nf_conn *ctnetlink_nfqueue_get_ct(struct sk_buff *skb,
- enum ip_conntrack_info *ctinfo)
+static struct nf_conn *ctnetlink_glue_get_ct(struct sk_buff *skb,
+ enum ip_conntrack_info *ctinfo)
{
struct nf_conn *ct;
@@ -2152,7 +2152,7 @@ static struct nf_conn *ctnetlink_nfqueue_get_ct(struct sk_buff *skb,
}
static int
-__ctnetlink_nfqueue_build(struct sk_buff *skb, struct nf_conn *ct)
+__ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct)
{
const struct nf_conntrack_zone *zone;
struct nlattr *nest_parms;
@@ -2225,9 +2225,9 @@ nla_put_failure:
}
static int
-ctnetlink_nfqueue_build(struct sk_buff *skb, struct nf_conn *ct,
- enum ip_conntrack_info ctinfo,
- u_int16_t ct_attr, u_int16_t ct_info_attr)
+ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct,
+ enum ip_conntrack_info ctinfo,
+ u_int16_t ct_attr, u_int16_t ct_info_attr)
{
struct nlattr *nest_parms;
@@ -2235,7 +2235,7 @@ ctnetlink_nfqueue_build(struct sk_buff *skb, struct nf_conn *ct,
if (!nest_parms)
goto nla_put_failure;
- if (__ctnetlink_nfqueue_build(skb, ct) < 0)
+ if (__ctnetlink_glue_build(skb, ct) < 0)
goto nla_put_failure;
nla_nest_end(skb, nest_parms);
@@ -2250,7 +2250,7 @@ nla_put_failure:
}
static int
-ctnetlink_nfqueue_parse_ct(const struct nlattr *cda[], struct nf_conn *ct)
+ctnetlink_glue_parse_ct(const struct nlattr *cda[], struct nf_conn *ct)
{
int err;
@@ -2290,7 +2290,7 @@ ctnetlink_nfqueue_parse_ct(const struct nlattr *cda[], struct nf_conn *ct)
}
static int
-ctnetlink_nfqueue_parse(const struct nlattr *attr, struct nf_conn *ct)
+ctnetlink_glue_parse(const struct nlattr *attr, struct nf_conn *ct)
{
struct nlattr *cda[CTA_MAX+1];
int ret;
@@ -2300,16 +2300,16 @@ ctnetlink_nfqueue_parse(const struct nlattr *attr, struct nf_conn *ct)
return ret;
spin_lock_bh(&nf_conntrack_expect_lock);
- ret = ctnetlink_nfqueue_parse_ct((const struct nlattr **)cda, ct);
+ ret = ctnetlink_glue_parse_ct((const struct nlattr **)cda, ct);
spin_unlock_bh(&nf_conntrack_expect_lock);
return ret;
}
-static int ctnetlink_nfqueue_exp_parse(const struct nlattr * const *cda,
- const struct nf_conn *ct,
- struct nf_conntrack_tuple *tuple,
- struct nf_conntrack_tuple *mask)
+static int ctnetlink_glue_exp_parse(const struct nlattr * const *cda,
+ const struct nf_conn *ct,
+ struct nf_conntrack_tuple *tuple,
+ struct nf_conntrack_tuple *mask)
{
int err;
@@ -2323,8 +2323,8 @@ static int ctnetlink_nfqueue_exp_parse(const struct nlattr * const *cda,
}
static int
-ctnetlink_nfqueue_attach_expect(const struct nlattr *attr, struct nf_conn *ct,
- u32 portid, u32 report)
+ctnetlink_glue_attach_expect(const struct nlattr *attr, struct nf_conn *ct,
+ u32 portid, u32 report)
{
struct nlattr *cda[CTA_EXPECT_MAX+1];
struct nf_conntrack_tuple tuple, mask;
@@ -2336,7 +2336,7 @@ ctnetlink_nfqueue_attach_expect(const struct nlattr *attr, struct nf_conn *ct,
if (err < 0)
return err;
- err = ctnetlink_nfqueue_exp_parse((const struct nlattr * const *)cda,
+ err = ctnetlink_glue_exp_parse((const struct nlattr * const *)cda,
ct, &tuple, &mask);
if (err < 0)
return err;
@@ -2364,8 +2364,8 @@ ctnetlink_nfqueue_attach_expect(const struct nlattr *attr, struct nf_conn *ct,
return 0;
}
-static void ctnetlink_nfqueue_seqadj(struct sk_buff *skb, struct nf_conn *ct,
- enum ip_conntrack_info ctinfo, int diff)
+static void ctnetlink_glue_seqadj(struct sk_buff *skb, struct nf_conn *ct,
+ enum ip_conntrack_info ctinfo, int diff)
{
if (!(ct->status & IPS_NAT_MASK))
return;
@@ -2373,14 +2373,14 @@ static void ctnetlink_nfqueue_seqadj(struct sk_buff *skb, struct nf_conn *ct,
nf_ct_tcp_seqadj_set(skb, ct, ctinfo, diff);
}
-static struct nfq_ct_hook ctnetlink_nfqueue_hook = {
- .get_ct = ctnetlink_nfqueue_get_ct,
+static struct nfnl_ct_hook ctnetlink_glue_hook = {
+ .get_ct = ctnetlink_glue_get_ct,
/* extra size - acct and use */
.build_size = ctnetlink_nlmsg_payload_size,
- .build = ctnetlink_nfqueue_build,
- .parse = ctnetlink_nfqueue_parse,
- .attach_expect = ctnetlink_nfqueue_attach_expect,
- .seq_adjust = ctnetlink_nfqueue_seqadj,
+ .build = ctnetlink_glue_build,
+ .parse = ctnetlink_glue_parse,
+ .attach_expect = ctnetlink_glue_attach_expect,
+ .seq_adjust = ctnetlink_glue_seqadj,
};
#endif /* CONFIG_NETFILTER_NETLINK_QUEUE_CT */
@@ -3368,7 +3368,7 @@ static int __init ctnetlink_init(void)
}
#ifdef CONFIG_NETFILTER_NETLINK_QUEUE_CT
/* setup interaction between nf_queue and nf_conntrack_netlink. */
- RCU_INIT_POINTER(nfq_ct_hook, &ctnetlink_nfqueue_hook);
+ RCU_INIT_POINTER(nfnl_ct_hook, &ctnetlink_glue_hook);
#endif
return 0;
@@ -3388,7 +3388,7 @@ static void __exit ctnetlink_exit(void)
nfnetlink_subsys_unregister(&ctnl_exp_subsys);
nfnetlink_subsys_unregister(&ctnl_subsys);
#ifdef CONFIG_NETFILTER_NETLINK_QUEUE_CT
- RCU_INIT_POINTER(nfq_ct_hook, NULL);
+ RCU_INIT_POINTER(nfnl_ct_hook, NULL);
#endif
}
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 40982c7..3e3a577 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -302,7 +302,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
{
size_t size;
size_t data_len = 0, cap_len = 0;
- struct nfq_ct_hook *nfq_ct;
+ struct nfnl_ct_hook *nfq_ct;
unsigned int hlen = 0;
struct sk_buff *skb;
struct nlattr *nla;
@@ -365,7 +365,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
}
if (queue->flags & NFQA_CFG_F_CONNTRACK) {
- nfq_ct = rcu_dereference(nfq_ct_hook);
+ nfq_ct = rcu_dereference(nfnl_ct_hook);
if (nfq_ct != NULL) {
ct = nfq_ct->get_ct(entskb, &ctinfo);
if (ct != NULL)
@@ -1008,7 +1008,7 @@ nfqnl_recv_verdict_batch(struct sock *ctnl, struct sk_buff *skb,
return 0;
}
-static struct nf_conn *nfqnl_ct_parse(struct nfq_ct_hook *nfq_ct,
+static struct nf_conn *nfqnl_ct_parse(struct nfnl_ct_hook *nfq_ct,
const struct nlmsghdr *nlh,
const struct nlattr * const nfqa[],
struct nf_queue_entry *entry,
@@ -1043,7 +1043,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
unsigned int verdict;
struct nf_queue_entry *entry;
enum ip_conntrack_info uninitialized_var(ctinfo);
- struct nfq_ct_hook *nfq_ct;
+ struct nfnl_ct_hook *nfq_ct;
struct nf_conn *ct = NULL;
struct net *net = sock_net(ctnl);
@@ -1068,7 +1068,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
if (nfqa[NFQA_CT]) {
/* rcu lock already held from nfnl->call_rcu. */
- nfq_ct = rcu_dereference(nfq_ct_hook);
+ nfq_ct = rcu_dereference(nfnl_ct_hook);
if (nfq_ct != NULL)
ct = nfqnl_ct_parse(nfq_ct, nlh, nfqa, entry, &ctinfo);
}
@@ -1225,7 +1225,7 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
}
#endif
if (flags & mask & NFQA_CFG_F_CONNTRACK &&
- rcu_dereference(nfq_ct_hook) == NULL) {
+ rcu_dereference(nfnl_ct_hook) == NULL) {
ret = -EOPNOTSUPP;
goto err_out_unlock;
}
--
1.7.10.4
next prev parent reply other threads:[~2015-09-11 3:07 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-08 16:54 [PATCH RFC 0/3] Rework nfnetlink_queue conntrack support Pablo Neira Ayuso
2015-09-08 16:54 ` [PATCH RFC 1/3] netfilter: ctnetlink: remove ctnetlink_nfqueue_build_size() Pablo Neira Ayuso
2015-09-09 9:53 ` Ken-ichirou MATSUZAWA
2015-09-10 0:12 ` Pablo Neira Ayuso
2015-09-08 16:54 ` [PATCH RFC 2/3] netfilter: nfnetlink_queue: get rid of nfnetlink_queue_ct.c Pablo Neira Ayuso
2015-09-08 16:54 ` [PATCH RFC 3/3] netfilter: rename nfnetlink_queue_core.c to nfnetlink_queue.c Pablo Neira Ayuso
2015-09-09 9:55 ` Ken-ichirou MATSUZAWA
2015-09-10 0:09 ` Pablo Neira Ayuso
2015-09-10 8:02 ` nfqueue batch verdict with conntrack (was [PATCH RFC 3/3] netfilter: rename nfnetlink_queue_core.c to nfnetlink_queue.c) Ken-ichirou MATSUZAWA
2015-09-10 9:20 ` [PATCH nf-next 0/1] netfilter: nfnetlink_queue: return -EOPNOTSUPP if QUEUE_CT is disabled Ken-ichirou MATSUZAWA
2015-09-10 9:24 ` [PATCH nf-next 1/1] " Ken-ichirou MATSUZAWA
2015-09-09 9:50 ` [PATCH RFC 0/3] Rework nfnetlink_queue conntrack support Ken-ichirou MATSUZAWA
2015-09-09 9:58 ` [PATCH lnf-queue] examples: attaching a conntrack information Ken-ichirou MATSUZAWA
2015-09-09 20:29 ` Florian Westphal
2015-09-09 22:22 ` Ken-ichirou MATSUZAWA
2015-09-09 22:58 ` Florian Westphal
2015-09-10 0:02 ` Pablo Neira Ayuso
2015-09-10 2:26 ` [PATCHv2 " Ken-ichirou MATSUZAWA
2015-09-10 8:58 ` [PATCH " Ken-ichirou MATSUZAWA
2015-09-10 0:06 ` [PATCH RFC 0/3] Rework nfnetlink_queue conntrack support Pablo Neira Ayuso
2015-09-11 3:05 ` Ken-ichirou MATSUZAWA
2015-09-11 3:07 ` Ken-ichirou MATSUZAWA [this message]
2015-09-30 22:03 ` [PATCH nf-next 1/3] netfilter: nfnetlink_queue: rename related to nfqueue attaching conntrack info Pablo Neira Ayuso
2015-09-11 3:09 ` [PATCH nf-next 2/3] netfilter: nf_conntrack_netlink: add const qualifier to nfnl_hook Ken-ichirou MATSUZAWA
2015-09-11 3:10 ` [PATCH nf-next 3/3] netfilter: nfnetlink_log: allow to attach conntrack Ken-ichirou MATSUZAWA
2015-09-30 22:10 ` Pablo Neira Ayuso
2015-09-11 3:12 ` [PATCH lnf-log 1/3] include: Sync with kernel headers Ken-ichirou MATSUZAWA
2015-10-12 15:21 ` Pablo Neira Ayuso
2015-09-11 3:14 ` [PATCH lnf-log 2/3] nlmsg: Add NFULA_CT and NFULA_CT_INFO attributes support Ken-ichirou MATSUZAWA
2015-10-12 15:21 ` Pablo Neira Ayuso
2015-09-11 3:15 ` [PATCH lnf-log 3/3] utils: nf-log: attaching a conntrack information Ken-ichirou MATSUZAWA
2015-10-12 15:26 ` Pablo Neira Ayuso
2015-10-15 4:35 ` Ken-ichirou MATSUZAWA
2015-10-15 4:39 ` [PATCHv2 lnf-log] " Ken-ichirou MATSUZAWA
2015-10-16 16:59 ` Pablo Neira Ayuso
2016-11-15 7:36 ` Ken-ichirou MATSUZAWA
2016-11-15 7:38 ` Ken-ichirou MATSUZAWA
2016-11-24 11:54 ` Pablo Neira Ayuso
2016-11-24 13:15 ` 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=20150911030748.GB7380@gmail.com \
--to=chamaken@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.