netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Mitsuru KANDA / 神田 充" <mk@linux-ipv6.org>
To: jmorris@intercode.com.au, davem@redhat.com, kuznet@ms2.inr.ac.ru
Cc: netdev@oss.sgi.com, usagi@linux-ipv6.org
Subject: [PATCH] IPV4 IPComp : threshold comparison
Date: Sun, 18 May 2003 02:00:01 +0900	[thread overview]
Message-ID: <87smrda4q6.wl@karaba.org> (raw)


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;

             reply	other threads:[~2003-05-17 17:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-17 17:00 Mitsuru KANDA / 神田 充 [this message]
2003-05-18  1:07 ` [PATCH] IPV4 IPComp : threshold comparison James Morris
2003-05-18  5:34 ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87smrda4q6.wl@karaba.org \
    --to=mk@linux-ipv6.org \
    --cc=davem@redhat.com \
    --cc=jmorris@intercode.com.au \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@oss.sgi.com \
    --cc=usagi@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).