From patchwork Wed Sep 26 12:07:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 187060 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id AE26B2C008F for ; Wed, 26 Sep 2012 21:59:59 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755401Ab2IZL7y (ORCPT ); Wed, 26 Sep 2012 07:59:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48095 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753328Ab2IZL7x (ORCPT ); Wed, 26 Sep 2012 07:59:53 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8QBxTFp019089 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 26 Sep 2012 07:59:29 -0400 Received: from dragon.localdomain (ovpn-116-79.ams2.redhat.com [10.36.116.79]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8QBxSN7003501; Wed, 26 Sep 2012 07:59:29 -0400 Received: from [127.0.0.1] (localhost [IPv6:::1]) by dragon.localdomain (Postfix) with ESMTP id 22BEC2C1F29; Wed, 26 Sep 2012 14:07:33 +0200 (CEST) From: Jesper Dangaard Brouer Subject: [PATCH V4 7/7] ipvs: SIP fragment handling To: Hans Schillstrom , Hans Schillstrom , netdev@vger.kernel.org, Pablo Neira Ayuso , lvs-devel@vger.kernel.org, Julian Anastasov Cc: Jesper Dangaard Brouer , "Patrick McHardy" , Thomas Graf , Wensong Zhang , netfilter-devel@vger.kernel.org, Simon Horman Date: Wed, 26 Sep 2012 14:07:33 +0200 Message-ID: <20120926120722.24804.28000.stgit@dragon> In-Reply-To: <20120926120534.24804.78415.stgit@dragon> References: <20120926120534.24804.78415.stgit@dragon> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Use the nfct_reasm SKB if available. Based on part of a patch from: Hans Schillstrom I have left Hans'es comment in the patch (marked /HS) Signed-off-by: Jesper Dangaard Brouer --- V3: - I have split out the SIP fragment handling into a seperate patch. As I have not been able to test this part. - Change the strange SKB swapping reasm = skb, reverse logic to minimize patch net/netfilter/ipvs/ip_vs_pe_sip.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/netfilter/ipvs/ip_vs_pe_sip.c b/net/netfilter/ipvs/ip_vs_pe_sip.c index ee4e2e3..43acba6 100644 --- a/net/netfilter/ipvs/ip_vs_pe_sip.c +++ b/net/netfilter/ipvs/ip_vs_pe_sip.c @@ -68,6 +68,7 @@ static int get_callid(const char *dptr, unsigned int dataoff, static int ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb) { + struct sk_buff *reasm = skb_nfct_reasm(skb); struct ip_vs_iphdr iph; unsigned int dataoff, datalen, matchoff, matchlen; const char *dptr; @@ -78,13 +79,23 @@ ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb) /* Only useful with UDP */ if (iph.protocol != IPPROTO_UDP) return -EINVAL; + /* + * todo: IPv6 fragments: + * I think this only should be done for the first fragment. /HS + */ + if (reasm) { + skb = reasm; + dataoff = iph.thoff_reasm + sizeof(struct udphdr); + } else + dataoff = iph.len + sizeof(struct udphdr); - /* No Data ? */ - dataoff = iph.len + sizeof(struct udphdr); if (dataoff >= skb->len) return -EINVAL; - - if ((retc=skb_linearize(skb)) < 0) + /* + * todo: Check if this will mess-up the reasm skb !!! /HS + */ + retc = skb_linearize(skb); + if (retc < 0) return retc; dptr = skb->data + dataoff; datalen = skb->len - dataoff;