]> git.hungrycats.org Git - linux/commitdiff
[AH4]: Save daddr iff options are present.
authorHerbert Xu <herbert@gondor.apana.org.au>
Sat, 24 Jul 2004 15:24:48 +0000 (08:24 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Sat, 24 Jul 2004 15:24:48 +0000 (08:24 -0700)
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>
Signed-off-by: David S. Miller <davem@redhat.com>
net/ipv4/ah4.c

index 8c16b71c3932ea1ebbbabebda31e2d348ec03e82..2c44859397577a9004cf1b1efe7730c94e4a6ee8 100644 (file)
@@ -73,9 +73,9 @@ static int ah_output(struct sk_buff **pskb)
        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 @@ static int ah_output(struct sk_buff **pskb)
        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);