From 2ca7b0ac022aa0158599178fe1056b1ba9ec8b97 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sun, 14 Oct 2007 00:39:55 -0700 Subject: [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 Signed-off-by: David S. Miller --- net/netfilter/xt_TCPMSS.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'net/netfilter/xt_TCPMSS.c') diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c index 31b6f9d09822..f111edf5f775 100644 --- a/net/netfilter/xt_TCPMSS.c +++ b/net/netfilter/xt_TCPMSS.c @@ -105,14 +105,10 @@ tcpmss_mangle_packet(struct sk_buff **pskb, * MSS Option not found ?! add it.. */ if (skb_tailroom((*pskb)) < TCPOLEN_MSS) { - struct sk_buff *newskb; - - newskb = skb_copy_expand(*pskb, skb_headroom(*pskb), - TCPOLEN_MSS, GFP_ATOMIC); - if (!newskb) + if (pskb_expand_head(*pskb, 0, + TCPOLEN_MSS - skb_tailroom(*pskb), + GFP_ATOMIC)) return -1; - kfree_skb(*pskb); - *pskb = newskb; tcph = (struct tcphdr *)(skb_network_header(*pskb) + tcphoff); } -- cgit v1.2.3