From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@redhat.com>
Cc: herbert@gondor.apana.org.au, netdev@oss.sgi.com,
netfilter-devel@lists.netfilter.org
Subject: [RFC, PATCH 1/5]: netfilter+ipsec - nf_reset
Date: Thu, 18 Mar 2004 17:31:27 +0100 [thread overview]
Message-ID: <4059CEDF.6030209@trash.net> (raw)
In-Reply-To: <20040308115858.75cdddca.davem@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 173 bytes --]
This patch adds a new function nf_reset to reset netfilter
related skb-fields. It has no real relationship to
netfilter+ipsec, but it's required for the follow-up patches.
[-- Attachment #2: 01-nf_reset.diff --]
[-- Type: text/x-patch, Size: 5499 bytes --]
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/03/18 03:22:26+01:00 kaber@trash.net
# [NETFILTER]: Add new function 'nf_reset' to reset netfilter related skb-fields
#
# net/ipv6/sit.c
# 2004/03/18 03:19:58+01:00 kaber@trash.net +2 -14
# [NETFILTER]: Add new function 'nf_reset' to reset netfilter related skb-fields
#
# net/ipv6/ip6_tunnel.c
# 2004/03/18 03:19:58+01:00 kaber@trash.net +1 -7
# [NETFILTER]: Add new function 'nf_reset' to reset netfilter related skb-fields
#
# net/ipv4/ipip.c
# 2004/03/18 03:19:58+01:00 kaber@trash.net +2 -14
# [NETFILTER]: Add new function 'nf_reset' to reset netfilter related skb-fields
#
# net/ipv4/ip_input.c
# 2004/03/18 03:19:58+01:00 kaber@trash.net +1 -5
# [NETFILTER]: Add new function 'nf_reset' to reset netfilter related skb-fields
#
# net/ipv4/ip_gre.c
# 2004/03/18 03:19:58+01:00 kaber@trash.net +2 -14
# [NETFILTER]: Add new function 'nf_reset' to reset netfilter related skb-fields
#
# include/linux/skbuff.h
# 2004/03/18 03:19:58+01:00 kaber@trash.net +12 -3
# [NETFILTER]: Add new function 'nf_reset' to reset netfilter related skb-fields
#
diff -Nru a/include/linux/skbuff.h b/include/linux/skbuff.h
--- a/include/linux/skbuff.h Thu Mar 18 16:45:10 2004
+++ b/include/linux/skbuff.h Thu Mar 18 16:45:10 2004
@@ -1201,6 +1201,14 @@
if (nfct)
atomic_inc(&nfct->master->use);
}
+static inline void nf_reset(struct sk_buff *skb)
+{
+ nf_conntrack_put(skb->nfct);
+ skb->nfct = NULL;
+#ifdef CONFIG_NETFILTER_DEBUG
+ skb->nf_debug = 0;
+#endif
+}
#ifdef CONFIG_BRIDGE_NETFILTER
static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
@@ -1213,9 +1221,10 @@
if (nf_bridge)
atomic_inc(&nf_bridge->use);
}
-#endif
-
-#endif
+#endif /* CONFIG_BRIDGE_NETFILTER */
+#else /* CONFIG_NETFILTER */
+static inline void nf_reset(struct sk_buff *skb) {}
+#endif /* CONFIG_NETFILTER */
#endif /* __KERNEL__ */
#endif /* _LINUX_SKBUFF_H */
diff -Nru a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
--- a/net/ipv4/ip_gre.c Thu Mar 18 16:45:10 2004
+++ b/net/ipv4/ip_gre.c Thu Mar 18 16:45:10 2004
@@ -643,13 +643,7 @@
skb->dev = tunnel->dev;
dst_release(skb->dst);
skb->dst = NULL;
-#ifdef CONFIG_NETFILTER
- nf_conntrack_put(skb->nfct);
- skb->nfct = NULL;
-#ifdef CONFIG_NETFILTER_DEBUG
- skb->nf_debug = 0;
-#endif
-#endif
+ nf_reset(skb);
ipgre_ecn_decapsulate(iph, skb);
netif_rx(skb);
read_unlock(&ipgre_lock);
@@ -877,13 +871,7 @@
}
}
-#ifdef CONFIG_NETFILTER
- nf_conntrack_put(skb->nfct);
- skb->nfct = NULL;
-#ifdef CONFIG_NETFILTER_DEBUG
- skb->nf_debug = 0;
-#endif
-#endif
+ nf_reset(skb);
IPTUNNEL_XMIT();
tunnel->recursion--;
diff -Nru a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
--- a/net/ipv4/ip_input.c Thu Mar 18 16:45:10 2004
+++ b/net/ipv4/ip_input.c Thu Mar 18 16:45:10 2004
@@ -202,17 +202,13 @@
#ifdef CONFIG_NETFILTER_DEBUG
nf_debug_ip_local_deliver(skb);
- skb->nf_debug = 0;
#endif /*CONFIG_NETFILTER_DEBUG*/
__skb_pull(skb, ihl);
-#ifdef CONFIG_NETFILTER
/* Free reference early: we don't need it any more, and it may
hold ip_conntrack module loaded indefinitely. */
- nf_conntrack_put(skb->nfct);
- skb->nfct = NULL;
-#endif /*CONFIG_NETFILTER*/
+ nf_reset(skb);
/* Point into the IP datagram, just past the header. */
skb->h.raw = skb->data;
diff -Nru a/net/ipv4/ipip.c b/net/ipv4/ipip.c
--- a/net/ipv4/ipip.c Thu Mar 18 16:45:10 2004
+++ b/net/ipv4/ipip.c Thu Mar 18 16:45:10 2004
@@ -496,13 +496,7 @@
skb->dev = tunnel->dev;
dst_release(skb->dst);
skb->dst = NULL;
-#ifdef CONFIG_NETFILTER
- nf_conntrack_put(skb->nfct);
- skb->nfct = NULL;
-#ifdef CONFIG_NETFILTER_DEBUG
- skb->nf_debug = 0;
-#endif
-#endif
+ nf_reset(skb);
ipip_ecn_decapsulate(iph, skb);
netif_rx(skb);
read_unlock(&ipip_lock);
@@ -647,13 +641,7 @@
if ((iph->ttl = tiph->ttl) == 0)
iph->ttl = old_iph->ttl;
-#ifdef CONFIG_NETFILTER
- nf_conntrack_put(skb->nfct);
- skb->nfct = NULL;
-#ifdef CONFIG_NETFILTER_DEBUG
- skb->nf_debug = 0;
-#endif
-#endif
+ nf_reset(skb);
IPTUNNEL_XMIT();
tunnel->recursion--;
diff -Nru a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
--- a/net/ipv6/ip6_tunnel.c Thu Mar 18 16:45:10 2004
+++ b/net/ipv6/ip6_tunnel.c Thu Mar 18 16:45:10 2004
@@ -715,13 +715,7 @@
ipv6h->nexthdr = proto;
ipv6_addr_copy(&ipv6h->saddr, &fl.fl6_src);
ipv6_addr_copy(&ipv6h->daddr, &fl.fl6_dst);
-#ifdef CONFIG_NETFILTER
- nf_conntrack_put(skb->nfct);
- skb->nfct = NULL;
-#ifdef CONFIG_NETFILTER_DEBUG
- skb->nf_debug = 0;
-#endif
-#endif
+ nf_reset(skb);
pkt_len = skb->len;
err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL,
skb->dst->dev, dst_output);
diff -Nru a/net/ipv6/sit.c b/net/ipv6/sit.c
--- a/net/ipv6/sit.c Thu Mar 18 16:45:10 2004
+++ b/net/ipv6/sit.c Thu Mar 18 16:45:10 2004
@@ -388,13 +388,7 @@
skb->dev = tunnel->dev;
dst_release(skb->dst);
skb->dst = NULL;
-#ifdef CONFIG_NETFILTER
- nf_conntrack_put(skb->nfct);
- skb->nfct = NULL;
-#ifdef CONFIG_NETFILTER_DEBUG
- skb->nf_debug = 0;
-#endif
-#endif
+ nf_reset(skb);
ipip6_ecn_decapsulate(iph, skb);
netif_rx(skb);
read_unlock(&ipip6_lock);
@@ -580,13 +574,7 @@
if ((iph->ttl = tiph->ttl) == 0)
iph->ttl = iph6->hop_limit;
-#ifdef CONFIG_NETFILTER
- nf_conntrack_put(skb->nfct);
- skb->nfct = NULL;
-#ifdef CONFIG_NETFILTER_DEBUG
- skb->nf_debug = 0;
-#endif
-#endif
+ nf_reset(skb);
IPTUNNEL_XMIT();
tunnel->recursion--;
next prev parent reply other threads:[~2004-03-18 16:31 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-08 11:03 ip_route_me_harder -> xfrm_lookup Herbert Xu
2004-03-08 14:46 ` Patrick McHardy
2004-03-08 19:58 ` David S. Miller
2004-03-18 16:31 ` Patrick McHardy
2004-03-18 16:31 ` Patrick McHardy [this message]
2004-03-19 6:08 ` [RFC, PATCH 1/5]: netfilter+ipsec - nf_reset David S. Miller
2004-03-18 16:31 ` [RFC, PATCH 2/5]: netfilter+ipsec - output hooks Patrick McHardy
2004-03-19 6:09 ` David S. Miller
2004-03-19 10:59 ` Herbert Xu
2004-03-18 16:32 ` [RFC, PATCH 3/5]: netfilter+ipsec - input hooks Patrick McHardy
2004-03-19 6:15 ` David S. Miller
2004-03-19 11:47 ` Herbert Xu
2004-03-19 16:17 ` Patrick McHardy
2004-03-19 21:05 ` Herbert Xu
2004-03-19 11:07 ` Herbert Xu
2004-03-19 11:46 ` Herbert Xu
2004-03-19 16:29 ` Patrick McHardy
2004-03-18 16:32 ` [RFC, PATCH 4/5]: netfilter+ipsec - policy lookup Patrick McHardy
2004-03-19 6:16 ` David S. Miller
2004-03-19 15:30 ` Patrick McHardy
2004-03-19 11:51 ` Herbert Xu
2004-03-19 16:34 ` Patrick McHardy
2004-03-19 21:05 ` Herbert Xu
2004-03-20 14:01 ` Patrick McHardy
2004-03-21 6:35 ` Herbert Xu
2004-03-21 22:16 ` Herbert Xu
2004-03-21 23:34 ` Patrick McHardy
2004-03-22 2:03 ` Herbert Xu
2004-03-22 2:29 ` Patrick McHardy
2004-03-24 2:15 ` Alexander Samad
2004-03-24 2:39 ` Patrick McHardy
2004-03-24 3:33 ` Alexander Samad
2004-03-18 16:32 ` [RFC, PATCH 5/5]: netfilter+ipsec - policy checks Patrick McHardy
2004-03-19 6:19 ` David S. Miller
2004-03-19 16:24 ` Patrick McHardy
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=4059CEDF.6030209@trash.net \
--to=kaber@trash.net \
--cc=davem@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@oss.sgi.com \
--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 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).