Commit 785e4608 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent 7c2117bc
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment