diff options
author | KOVACS Krisztian <hidden@sch.bme.hu> | 2008-10-07 15:41:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-07 15:41:01 -0400 |
commit | 23542618deb77cfed312842fe8c41ed19fb16470 (patch) | |
tree | 9658279a6e3593846a9127c7a8bffb7ce0077d62 /include/net/inet6_hashtables.h | |
parent | 607c4aaf03041c8bd81555a0218050c0f895088e (diff) |
inet: Don't lookup the socket if there's a socket attached to the skb
Use the socket cached in the skb if it's present.
Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inet6_hashtables.h')
-rw-r--r-- | include/net/inet6_hashtables.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 995efbb031ab..f74665d7bea8 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
@@ -96,10 +96,14 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, | |||
96 | const __be16 sport, | 96 | const __be16 sport, |
97 | const __be16 dport) | 97 | const __be16 dport) |
98 | { | 98 | { |
99 | return __inet6_lookup(dev_net(skb->dst->dev), hashinfo, | 99 | struct sock *sk; |
100 | &ipv6_hdr(skb)->saddr, sport, | 100 | |
101 | &ipv6_hdr(skb)->daddr, ntohs(dport), | 101 | if (unlikely(sk = skb_steal_sock(skb))) |
102 | inet6_iif(skb)); | 102 | return sk; |
103 | else return __inet6_lookup(dev_net(skb->dst->dev), hashinfo, | ||
104 | &ipv6_hdr(skb)->saddr, sport, | ||
105 | &ipv6_hdr(skb)->daddr, ntohs(dport), | ||
106 | inet6_iif(skb)); | ||
103 | } | 107 | } |
104 | 108 | ||
105 | extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, | 109 | extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, |