]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ipvs: SIP fragment handling
authorJesper Dangaard Brouer <brouer@redhat.com>
Wed, 26 Sep 2012 12:07:33 +0000 (14:07 +0200)
committerSimon Horman <horms@verge.net.au>
Fri, 28 Sep 2012 02:37:16 +0000 (11:37 +0900)
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 <brouer@redhat.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
[ horms@verge.net.au: Fix comment style ]
Signed-off-by: Simon Horman <horms@verge.net.au>
net/netfilter/ipvs/ip_vs_pe_sip.c

index ee4e2e3cc08655336d8b3b4458c4e4da13e5b82b..12475ef88dafe571bbc2e031af50890c08d91a54 100644 (file)
@@ -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,20 @@ 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;