diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-10-14 03:39:55 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-15 15:26:28 -0400 |
commit | 2ca7b0ac022aa0158599178fe1056b1ba9ec8b97 (patch) | |
tree | 6eece25447f0ec3b5d5f5533e49e10fde4d59f35 /net/netfilter/xt_TCPMSS.c | |
parent | af1e1cf073e3d038b7aac417a20585ecdcab7de6 (diff) |
[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/netfilter/xt_TCPMSS.c')
-rw-r--r-- | net/netfilter/xt_TCPMSS.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c index 31b6f9d0982..f111edf5f77 100644 --- a/net/netfilter/xt_TCPMSS.c +++ b/net/netfilter/xt_TCPMSS.c | |||
@@ -105,14 +105,10 @@ tcpmss_mangle_packet(struct sk_buff **pskb, | |||
105 | * MSS Option not found ?! add it.. | 105 | * MSS Option not found ?! add it.. |
106 | */ | 106 | */ |
107 | if (skb_tailroom((*pskb)) < TCPOLEN_MSS) { | 107 | if (skb_tailroom((*pskb)) < TCPOLEN_MSS) { |
108 | struct sk_buff *newskb; | 108 | if (pskb_expand_head(*pskb, 0, |
109 | 109 | TCPOLEN_MSS - skb_tailroom(*pskb), | |
110 | newskb = skb_copy_expand(*pskb, skb_headroom(*pskb), | 110 | GFP_ATOMIC)) |
111 | TCPOLEN_MSS, GFP_ATOMIC); | ||
112 | if (!newskb) | ||
113 | return -1; | 111 | return -1; |
114 | kfree_skb(*pskb); | ||
115 | *pskb = newskb; | ||
116 | tcph = (struct tcphdr *)(skb_network_header(*pskb) + tcphoff); | 112 | tcph = (struct tcphdr *)(skb_network_header(*pskb) + tcphoff); |
117 | } | 113 | } |
118 | 114 | ||