netdev
[Top] [All Lists]

[PATCH] IPV4 IPComp : threshold comparison

To: jmorris@xxxxxxxxxxxxxxxx, davem@xxxxxxxxxx, kuznet@xxxxxxxxxxxxx
Subject: [PATCH] IPV4 IPComp : threshold comparison
From: Mitsuru KANDA / 神田 充 <mk@xxxxxxxxxxxxxx>
Date: Sun, 18 May 2003 02:00:01 +0900
Cc: netdev@xxxxxxxxxxx, usagi@xxxxxxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
Hello,

I'm not sure how exactly we should check threshold.
In IPsec tunnel mode, the original comparison code 
seems to be including IP header length.

Could you check it?

Regards,
-mk


===== ipcomp.c 1.6 vs edited =====
--- 1.6/net/ipv4/ipcomp.c       Tue May 13 05:58:03 2003
+++ edited/ipcomp.c     Sun May 18 01:42:22 2003
@@ -168,6 +168,7 @@
                struct iphdr    iph;
                char            buf[60];
        } tmp_iph;
+       int hdr_len = 0;
 
        if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) {
                err = -EINVAL;
@@ -180,7 +181,11 @@
                goto error;
 
        /* Don't bother compressing */
-       if (skb->len < ipcd->threshold) {
+       if (!x->props.mode) {
+               iph = skb->nh.iph;
+               hdr_len = iph->ihl * 4;
+       }
+       if ((skb->len - hdr_len) < ipcd->threshold) {
                if (x->props.mode) {
                        ipcomp_tunnel_encap(x, skb);
                        iph = skb->nh.iph;

<Prev in Thread] Current Thread [Next in Thread>