aboutsummaryrefslogtreecommitdiff
path: root/net/ipv6/icmp.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-02 13:27:41 -0800
committerDavid S. Miller <davem@davemloft.net>2011-03-02 13:27:41 -0800
commit452edd598f60522c11f7f88fdbab27eb36509d1a (patch)
treedf1510e9848e591a412c8bfa724253470c48c4c2 /net/ipv6/icmp.c
parent3872b284087081ee5cb0e4630954c2f7a2153cf5 (diff)
xfrm: Return dst directly from xfrm_lookup()
Instead of on the stack. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/icmp.c')
-rw-r--r--net/ipv6/icmp.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index e332bae104e..55665956b3a 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -324,17 +324,15 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *sk
/* No need to clone since we're just using its address. */
dst2 = dst;
- err = xfrm_lookup(net, &dst, fl, sk, 0);
- switch (err) {
- case 0:
+ dst = xfrm_lookup(net, dst, fl, sk, 0);
+ if (!IS_ERR(dst)) {
if (dst != dst2)
return dst;
- break;
- case -EPERM:
- dst = NULL;
- break;
- default:
- return ERR_PTR(err);
+ } else {
+ if (PTR_ERR(dst) == -EPERM)
+ dst = NULL;
+ else
+ return dst;
}
err = xfrm_decode_session_reverse(skb, &fl2, AF_INET6);
@@ -345,17 +343,17 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *sk
if (err)
goto relookup_failed;
- err = xfrm_lookup(net, &dst2, &fl2, sk, XFRM_LOOKUP_ICMP);
- switch (err) {
- case 0:
+ dst2 = xfrm_lookup(net, dst2, &fl2, sk, XFRM_LOOKUP_ICMP);
+ if (!IS_ERR(dst2)) {
dst_release(dst);
dst = dst2;
- break;
- case -EPERM:
- dst_release(dst);
- return ERR_PTR(err);
- default:
- goto relookup_failed;
+ } else {
+ err = PTR_ERR(dst2);
+ if (err == -EPERM) {
+ dst_release(dst);
+ return dst2;
+ } else
+ goto relookup_failed;
}
relookup_failed:
@@ -560,7 +558,8 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
err = ip6_dst_lookup(sk, &dst, &fl);
if (err)
goto out;
- if ((err = xfrm_lookup(net, &dst, &fl, sk, 0)) < 0)
+ dst = xfrm_lookup(net, dst, &fl, sk, 0);
+ if (IS_ERR(dst))
goto out;
if (ipv6_addr_is_multicast(&fl.fl6_dst))