aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2004-07-24 08:24:48 -0700
committerDavid S. Miller <davem@nuts.davemloft.net>2004-07-24 08:24:48 -0700
commit785e4608d1df47e7d9c0205d21f07d671fac83fd (patch)
treefd0c8c6e99a5804f0795db802e09904e892f4360 /net
parent7c2117bc57175cb9977e1795defe6142cdeaa6e2 (diff)
downloadhistory-785e4608d1df47e7d9c0205d21f07d671fac83fd.tar.gz
[AH4]: Save daddr iff options are present.
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>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ah4.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index 8c16b71c3932ea..2c44859397577a 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -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);