Commit 6255e5ea authored by Julian Anastasov's avatar Julian Anastasov Committed by David S. Miller

ipv4: optimize fib_compute_spec_dst call in ip_options_echo

Move fib_compute_spec_dst at the only place where it
is needed.
Signed-off-by: default avatarJulian Anastasov <ja@ssi.bg>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a16a0d2f
...@@ -93,7 +93,6 @@ int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb) ...@@ -93,7 +93,6 @@ int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb)
unsigned char *sptr, *dptr; unsigned char *sptr, *dptr;
int soffset, doffset; int soffset, doffset;
int optlen; int optlen;
__be32 daddr;
memset(dopt, 0, sizeof(struct ip_options)); memset(dopt, 0, sizeof(struct ip_options));
...@@ -105,8 +104,6 @@ int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb) ...@@ -105,8 +104,6 @@ int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb)
sptr = skb_network_header(skb); sptr = skb_network_header(skb);
dptr = dopt->__data; dptr = dopt->__data;
daddr = fib_compute_spec_dst(skb);
if (sopt->rr) { if (sopt->rr) {
optlen = sptr[sopt->rr+1]; optlen = sptr[sopt->rr+1];
soffset = sptr[sopt->rr+2]; soffset = sptr[sopt->rr+2];
...@@ -180,6 +177,8 @@ int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb) ...@@ -180,6 +177,8 @@ int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb)
doffset -= 4; doffset -= 4;
} }
if (doffset > 3) { if (doffset > 3) {
__be32 daddr = fib_compute_spec_dst(skb);
memcpy(&start[doffset-1], &daddr, 4); memcpy(&start[doffset-1], &daddr, 4);
dopt->faddr = faddr; dopt->faddr = faddr;
dptr[0] = start[0]; dptr[0] = start[0];
......
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