netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [NATT] Fix uh->len with IP options
@ 2004-07-09 11:48 Herbert Xu
  2004-07-10  0:05 ` David S. Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2004-07-09 11:48 UTC (permalink / raw)
  To: David S. Miller, netdev

[-- Attachment #1: Type: text/plain, Size: 439 bytes --]

Hi Dave:

I just noticed that the UDP header length in esp4_output() is incorrect
when IP options are present (in transport mode).  This patch fixes exactly
that.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 440 bytes --]

===== net/ipv4/esp4.c 1.50 vs edited =====
--- 1.50/net/ipv4/esp4.c	2004-07-09 20:19:08 +10:00
+++ edited/net/ipv4/esp4.c	2004-07-09 21:45:46 +10:00
@@ -124,7 +124,7 @@
 		uh = (struct udphdr *)esph;
 		uh->source = encap->encap_sport;
 		uh->dest = encap->encap_dport;
-		uh->len = htons((*pskb)->len + alen - sizeof(struct iphdr));
+		uh->len = htons((*pskb)->len + alen - iph->ihl*4);
 		uh->check = 0;
 
 		switch (encap->encap_type) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [NATT] Fix uh->len with IP options
  2004-07-09 11:48 [NATT] Fix uh->len with IP options Herbert Xu
@ 2004-07-10  0:05 ` David S. Miller
  2004-07-10  1:21   ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: David S. Miller @ 2004-07-10  0:05 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev

On Fri, 9 Jul 2004 21:48:02 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> I just noticed that the UDP header length in esp4_output() is incorrect
> when IP options are present (in transport mode).  This patch fixes exactly
> that.

At first I thought you should be using top_iph to compute the options
length, but now I see why it's correct to be using 'iph'.

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [NATT] Fix uh->len with IP options
  2004-07-10  0:05 ` David S. Miller
@ 2004-07-10  1:21   ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2004-07-10  1:21 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

On Fri, Jul 09, 2004 at 05:05:02PM -0700, David S. Miller wrote:
> 
> At first I thought you should be using top_iph to compute the options
> length, but now I see why it's correct to be using 'iph'.

Mea culpa.  This is broken in tunnel mode.

My big patch that moves the tunnel code out will fix this since it
gets rid of iph altogether.

But if you want to hold out on that one for a bit then please make
the obvious fix by changing iph to top_iph.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-10  1:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-09 11:48 [NATT] Fix uh->len with IP options Herbert Xu
2004-07-10  0:05 ` David S. Miller
2004-07-10  1:21   ` Herbert Xu

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).