* [AH4] Save daddr iff options are present
@ 2004-07-24 1:44 Herbert Xu
2004-07-25 5:35 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Herbert Xu @ 2004-07-24 1:44 UTC (permalink / raw)
To: David S. Miller, netdev
[-- Attachment #1: Type: text/plain, Size: 583 bytes --]
Hi Dave:
This is a little optimisation for AH4. When I moved the tunnel code out,
I put the daddr copying code on the main path which is unnecessary since
daddr is only mutable if IP options are present.
This patch moves the saving and restoring of daddr under the check for
the existence of IP options.
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: 817 bytes --]
===== net/ipv4/ah4.c 1.37 vs edited =====
--- 1.37/net/ipv4/ah4.c 2004-07-12 20:00:21 +10:00
+++ edited/net/ipv4/ah4.c 2004-07-24 11:39:40 +10:00
@@ -73,9 +73,9 @@
iph->tos = top_iph->tos;
iph->ttl = top_iph->ttl;
iph->frag_off = top_iph->frag_off;
- iph->daddr = top_iph->daddr;
if (top_iph->ihl != 5) {
+ iph->daddr = top_iph->daddr;
memcpy(iph+1, top_iph+1, top_iph->ihl*4 - sizeof(struct iphdr));
err = ip_clear_mutable_options(top_iph, &top_iph->daddr);
if (err)
@@ -104,9 +104,10 @@
top_iph->tos = iph->tos;
top_iph->ttl = iph->ttl;
top_iph->frag_off = iph->frag_off;
- top_iph->daddr = iph->daddr;
- if (top_iph->ihl != 5)
+ if (top_iph->ihl != 5) {
+ top_iph->daddr = iph->daddr;
memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr));
+ }
ip_send_check(top_iph);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [AH4] Save daddr iff options are present
2004-07-24 1:44 [AH4] Save daddr iff options are present Herbert Xu
@ 2004-07-25 5:35 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-07-25 5:35 UTC (permalink / raw)
To: Herbert Xu; +Cc: netdev
On Sat, 24 Jul 2004 11:44:15 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:
> This is a little optimisation for AH4. When I moved the tunnel code out,
> I put the daddr copying code on the main path which is unnecessary since
> daddr is only mutable if IP options are present.
>
> This patch moves the saving and restoring of daddr under the check for
> the existence of IP options.
Looks good to me, applied.
Thanks Herbert.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-07-25 5:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-24 1:44 [AH4] Save daddr iff options are present Herbert Xu
2004-07-25 5:35 ` David S. Miller
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).