aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/netfilter/arpt_mangle.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-10-14 00:39:55 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-15 12:26:28 -0700
commit2ca7b0ac022aa0158599178fe1056b1ba9ec8b97 (patch)
tree6eece25447f0ec3b5d5f5533e49e10fde4d59f35 /net/ipv4/netfilter/arpt_mangle.c
parent[IPVS]: Replace local version of skb_make_writable (diff)
downloadlinux-dev-2ca7b0ac022aa0158599178fe1056b1ba9ec8b97.tar.xz
linux-dev-2ca7b0ac022aa0158599178fe1056b1ba9ec8b97.zip
[NETFILTER]: Avoid skb_copy/pskb_copy/skb_realloc_headroom
This patch replaces unnecessary uses of skb_copy, pskb_copy and skb_realloc_headroom by functions such as skb_make_writable and pskb_expand_head. This allows us to remove the double pointers later. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/netfilter/arpt_mangle.c')
-rw-r--r--net/ipv4/netfilter/arpt_mangle.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/net/ipv4/netfilter/arpt_mangle.c b/net/ipv4/netfilter/arpt_mangle.c
index c4bdab47597f..0181f919a79c 100644
--- a/net/ipv4/netfilter/arpt_mangle.c
+++ b/net/ipv4/netfilter/arpt_mangle.c
@@ -1,5 +1,6 @@
/* module that allows mangling of the arp payload */
#include <linux/module.h>
+#include <linux/netfilter.h>
#include <linux/netfilter_arp/arpt_mangle.h>
#include <net/sock.h>
@@ -18,17 +19,8 @@ target(struct sk_buff **pskb,
unsigned char *arpptr;
int pln, hln;
- if (skb_shared(*pskb) || skb_cloned(*pskb)) {
- struct sk_buff *nskb;
-
- nskb = skb_copy(*pskb, GFP_ATOMIC);
- if (!nskb)
- return NF_DROP;
- if ((*pskb)->sk)
- skb_set_owner_w(nskb, (*pskb)->sk);
- kfree_skb(*pskb);
- *pskb = nskb;
- }
+ if (skb_make_writable(*pskb, (*pskb)->len))
+ return NF_DROP;
arp = arp_hdr(*pskb);
arpptr = skb_network_header(*pskb) + sizeof(*arp);