netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: The netfilter developer mailinglist <netfilter-devel@vger.kernel.org>
Subject: [PATCH nf-next 1/2] netfilter: nfnetlink_queue: enable to specify nla type
Date: Tue, 25 Aug 2015 08:13:13 +0900	[thread overview]
Message-ID: <20150824231313.GB20038@gmail.com> (raw)
In-Reply-To: <20150824231038.GA20038@gmail.com>

This patch updates nfqnl_ct_put() signature to put not only queue
related attribute type.

Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
---
 include/net/netfilter/nfnetlink_queue.h |    8 +++++---
 net/netfilter/nfnetlink_queue_core.c    |    2 +-
 net/netfilter/nfnetlink_queue_ct.c      |    9 +++++----
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/include/net/netfilter/nfnetlink_queue.h b/include/net/netfilter/nfnetlink_queue.h
index aff88ba..f94942b 100644
--- a/include/net/netfilter/nfnetlink_queue.h
+++ b/include/net/netfilter/nfnetlink_queue.h
@@ -11,8 +11,9 @@ struct nf_conn *nfqnl_ct_get(struct sk_buff *entskb, size_t *size,
 struct nf_conn *nfqnl_ct_parse(const struct sk_buff *skb,
 			       const struct nlattr *attr,
 			       enum ip_conntrack_info *ctinfo);
-int nfqnl_ct_put(struct sk_buff *skb, struct nf_conn *ct,
-		 enum ip_conntrack_info ctinfo);
+int nfqnl_ct_put(struct sk_buff *skb,
+		 struct nf_conn *ct, int type,
+		 enum ip_conntrack_info ctinfo, int info_type);
 void nfqnl_ct_seq_adjust(struct sk_buff *skb, struct nf_conn *ct,
 			 enum ip_conntrack_info ctinfo, int diff);
 int nfqnl_attach_expect(struct nf_conn *ct, const struct nlattr *attr,
@@ -32,7 +33,8 @@ inline struct nf_conn *nfqnl_ct_parse(const struct sk_buff *skb,
 }
 
 inline int
-nfqnl_ct_put(struct sk_buff *skb, struct nf_conn *ct, enum ip_conntrack_info ctinfo)
+nfqnl_ct_put(struct sk_buff *skb, struct nf_conn *ct, int type,
+	     enum ip_conntrack_info ctinfo, int info_type)
 {
 	return 0;
 }
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index 685cc6a..283a189 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -507,7 +507,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
 	if (seclen && nla_put(skb, NFQA_SECCTX, seclen, secdata))
 		goto nla_put_failure;
 
-	if (ct && nfqnl_ct_put(skb, ct, ctinfo) < 0)
+	if (ct && nfqnl_ct_put(skb, ct, NFQA_CT, ctinfo, NFQA_CT_INFO) < 0)
 		goto nla_put_failure;
 
 	if (cap_len > data_len &&
diff --git a/net/netfilter/nfnetlink_queue_ct.c b/net/netfilter/nfnetlink_queue_ct.c
index 96cac50..2a30618 100644
--- a/net/netfilter/nfnetlink_queue_ct.c
+++ b/net/netfilter/nfnetlink_queue_ct.c
@@ -54,8 +54,9 @@ nfqnl_ct_parse(const struct sk_buff *skb, const struct nlattr *attr,
 	return ct;
 }
 
-int nfqnl_ct_put(struct sk_buff *skb, struct nf_conn *ct,
-		 enum ip_conntrack_info ctinfo)
+int nfqnl_ct_put(struct sk_buff *skb,
+		 struct nf_conn *ct, int type,
+		 enum ip_conntrack_info ctinfo, int info_type)
 {
 	struct nfq_ct_hook *nfq_ct;
 	struct nlattr *nest_parms;
@@ -65,7 +66,7 @@ int nfqnl_ct_put(struct sk_buff *skb, struct nf_conn *ct,
 	if (nfq_ct == NULL)
 		return 0;
 
-	nest_parms = nla_nest_start(skb, NFQA_CT | NLA_F_NESTED);
+	nest_parms = nla_nest_start(skb, type | NLA_F_NESTED);
 	if (!nest_parms)
 		goto nla_put_failure;
 
@@ -75,7 +76,7 @@ int nfqnl_ct_put(struct sk_buff *skb, struct nf_conn *ct,
 	nla_nest_end(skb, nest_parms);
 
 	tmp = ctinfo;
-	if (nla_put_be32(skb, NFQA_CT_INFO, htonl(tmp)))
+	if (nla_put_be32(skb, info_type, htonl(tmp)))
 		goto nla_put_failure;
 
 	return 0;
-- 
1.7.10.4


  reply	other threads:[~2015-08-24 23:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24 23:10 [PATCH nf-next 0/2] netfilter: nfnetlink_log attach conntrack Ken-ichirou MATSUZAWA
2015-08-24 23:13 ` Ken-ichirou MATSUZAWA [this message]
2015-08-24 23:15 ` [PATCH nf-next 2/2] netfilter: nfnetlink_log: allow to " Ken-ichirou MATSUZAWA
2015-08-26 19:05   ` Pablo Neira Ayuso
2015-08-28  6:43     ` Ken-ichirou MATSUZAWA
2015-09-01  0:34     ` Ken-ichirou MATSUZAWA
2015-09-01  0:37       ` [PATCHv2 nf-next 1/5] netfilter: nfnetlink_queue: enable to specify nla type Ken-ichirou MATSUZAWA
2015-09-01  0:39       ` [PATCHv2 nf-next 2/5] netfilter: nf_conntrack_netlink: rename to link ct attachment with Ken-ichirou MATSUZAWA
2015-09-01  0:41       ` [PATCHv2 nf-next 3/5] netfilter: nfnetlink_queue_ct: export functions Ken-ichirou MATSUZAWA
2015-09-03 10:10         ` Pablo Neira Ayuso
2015-09-07  7:44           ` Ken-ichirou MATSUZAWA
2015-09-01  0:52       ` [PATCHv2 nf-next 4/5] netfilter: nfnetlink_queue: rename nfnetlink_queue_core.c Ken-ichirou MATSUZAWA
2015-09-01  0:54       ` [PATCHv2 nf-next 5/5] netfilter: nfnetlink_log: allow to attach conntrack Ken-ichirou MATSUZAWA

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=20150824231313.GB20038@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 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).