]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/esp4.c
[SCSI] in2000: convert to accessors and !use_sg cleanup
[linux-2.6-omap-h63xx.git] / net / ipv4 / esp4.c
index cad4278025adc83b1b4430c949a3c65fa36f8f9c..1738113268bc12f1e1a23e4a1ca14bb82a637ffa 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/pfkeyv2.h>
 #include <linux/random.h>
 #include <linux/spinlock.h>
+#include <linux/in6.h>
 #include <net/icmp.h>
 #include <net/protocol.h>
 #include <net/udp.h>
@@ -111,9 +112,10 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
                                goto unlock;
                }
                sg_init_table(sg, nfrags);
-               sg_mark_end(sg, skb_to_sgvec(skb, sg, esph->enc_data +
-                                                     esp->conf.ivlen -
-                                                     skb->data, clen));
+               skb_to_sgvec(skb, sg,
+                            esph->enc_data +
+                            esp->conf.ivlen -
+                            skb->data, clen);
                err = crypto_blkcipher_encrypt(&desc, sg, sg, clen);
                if (unlikely(sg != &esp->sgbuf[0]))
                        kfree(sg);
@@ -205,8 +207,9 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
                        goto out;
        }
        sg_init_table(sg, nfrags);
-       sg_mark_end(sg, skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen,
-                                    elen));
+       skb_to_sgvec(skb, sg,
+                    sizeof(*esph) + esp->conf.ivlen,
+                    elen);
        err = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
        if (unlikely(sg != &esp->sgbuf[0]))
                kfree(sg);
@@ -222,6 +225,10 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
 
        /* ... check padding bits here. Silly. :-) */
 
+       /* RFC4303: Drop dummy packets without any error */
+       if (nexthdr[1] == IPPROTO_NONE)
+               goto out;
+
        iph = ip_hdr(skb);
        ihl = iph->ihl * 4;