All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: netfilter-devel@lists.netfilter.org, Patrick McHardy <kaber@trash.net>
Subject: [NETFILTER 17/22]: conntrack: add __nf_copy() to copy members in skb
Date: Wed, 14 Mar 2007 09:50:42 +0100 (MET)	[thread overview]
Message-ID: <20070314085026.15282.72961.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20070314084946.15282.58609.sendpatchset@localhost.localdomain>

[NETFILTER]: nf_conntrack: add __nf_copy() to copy members in skb

This unifies the codes to copy netfilter related datas. Note that
__nf_copy() assumes destination skb doesn't have any netfilter
related members.

Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit c3f281b640e4bec1e09a5ec338d3e605c23a3e9e
tree 9084a7a022b9222cc4d7230f9b885a8693f08296
parent a36f33350b8220397ac33ee98c26e808289a302b
author Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Wed, 14 Mar 2007 09:32:00 +0100
committer Patrick McHardy <kaber@trash.net> Wed, 14 Mar 2007 09:32:00 +0100

 include/linux/skbuff.h |   17 +++++++++++++++++
 net/core/skbuff.c      |   28 ++--------------------------
 2 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6148cb3..3d4d49d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1481,8 +1481,25 @@ #ifdef CONFIG_BRIDGE_NETFILTER
 #endif
 }
 
+/* Note: This doesn't put any conntrack and bridge info in dst. */
+static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
+{
+	dst->nfct = src->nfct;
+	nf_conntrack_get(src->nfct);
+	dst->nfctinfo = src->nfctinfo;
+#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
+	dst->nfct_reasm = src->nfct_reasm;
+	nf_conntrack_get_reasm(src->nfct_reasm);
+#endif
+#ifdef CONFIG_BRIDGE_NETFILTER
+	dst->nf_bridge  = src->nf_bridge;
+	nf_bridge_get(src->nf_bridge);
+#endif
+}
+
 #else /* CONFIG_NETFILTER */
 static inline void nf_reset(struct sk_buff *skb) {}
+static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) {}
 #endif /* CONFIG_NETFILTER */
 
 #ifdef CONFIG_NETWORK_SECMARK
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 05949c9..100af5b 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -476,19 +476,7 @@ #endif
 	C(protocol);
 	n->destructor = NULL;
 	C(mark);
-#ifdef CONFIG_NETFILTER
-	C(nfct);
-	nf_conntrack_get(skb->nfct);
-	C(nfctinfo);
-#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
-	C(nfct_reasm);
-	nf_conntrack_get_reasm(skb->nfct_reasm);
-#endif
-#ifdef CONFIG_BRIDGE_NETFILTER
-	C(nf_bridge);
-	nf_bridge_get(skb->nf_bridge);
-#endif
-#endif /*CONFIG_NETFILTER*/
+	__nf_copy(n, skb);
 #ifdef CONFIG_NET_SCHED
 	C(tc_index);
 #ifdef CONFIG_NET_CLS_ACT
@@ -537,22 +525,10 @@ #endif
 	new->tstamp	= old->tstamp;
 	new->destructor = NULL;
 	new->mark	= old->mark;
-#ifdef CONFIG_NETFILTER
-	new->nfct	= old->nfct;
-	nf_conntrack_get(old->nfct);
-	new->nfctinfo	= old->nfctinfo;
-#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
-	new->nfct_reasm = old->nfct_reasm;
-	nf_conntrack_get_reasm(old->nfct_reasm);
-#endif
+	__nf_copy(new, old);
 #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
 	new->ipvs_property = old->ipvs_property;
 #endif
-#ifdef CONFIG_BRIDGE_NETFILTER
-	new->nf_bridge	= old->nf_bridge;
-	nf_bridge_get(old->nf_bridge);
-#endif
-#endif
 #ifdef CONFIG_NET_SCHED
 #ifdef CONFIG_NET_CLS_ACT
 	new->tc_verd = old->tc_verd;

  parent reply	other threads:[~2007-03-14  8:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-14  8:50 [NETFILTER 00/22]: Netfilter update for 2.6.22 Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 01/22]: x_tables: remove duplicate of xt_prefix Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 03/22]: nf_conntrack: switch protocol registration/unregistration to mutex Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 04/22]: nf_conntrack: remove ugly hack in l4proto registration Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 05/22]: nf_conntrack: simplify protocol locking Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 06/22]: nf_conntrack: simplify l4 protocol array allocation Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 07/22]: nfnetlink: use mutex instead of semaphore Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 08/22]: nfnetlink: use netlink_run_queue() Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 09/22]: nf_conntrack: uninline notifier registration functions Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 10/22]: nfnetlink: remove early debugging messages from nfnetlink Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 11/22]: nfnetlink: remove duplicate checks in nfnetlink_check_attributes Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 12/22]: nfnetlink: remove unrequired check in nfnetlink_get_subsys Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 13/22]: nfnetlink: remove unused includes in nfnetlink.c Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 14/22]: nfnetlink: move EXPORT_SYMBOL declarations next to the exported symbol Patrick McHardy
2007-03-14  8:50 ` [JHASH 15/22]: Use const in jhash2 Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 16/22]: nf_conntrack: use jhash2 in __hash_conntrack Patrick McHardy
2007-03-14  8:50 ` Patrick McHardy [this message]
2007-03-14  8:50 ` [NETFILTER 18/22]: conntrack: add nf_copy() to safely copy members in skb Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 19/22]: tcp_conntrack: accept RST|PSH as valid Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 20/22]: tcp_conntrack: factorize out the PUSH flag Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 21/22]: ctnetlink: add support for internal tcp connection tracking flags handling Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 22/22]: nfnetlink: parse attributes with nfattr_parse in nfnetlink_check_attribute Patrick McHardy
2007-03-14 23:05 ` [NETFILTER 00/22]: Netfilter update for 2.6.22 David Miller
2007-03-14 23:14   ` Patrick McHardy
2007-03-14 23:52     ` 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=20070314085026.15282.72961.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.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.