aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2008-10-07 14:41:57 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-07 14:41:57 -0400
commit9a1f27c48065ce713eb47f2fd475b717e63ef239 (patch)
tree79ebeb8386b98aca595625b9d2db26bd52a8077d /include
parentc7004482e8dcb7c3c72666395cfa98a216a4fb70 (diff)
inet_hashtables: Add inet_lookup_skb helpers
To be able to use the cached socket reference in the skb during input processing we add a new set of lookup functions that receive the skb on their argument list. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/inet6_hashtables.h11
-rw-r--r--include/net/inet_hashtables.h14
2 files changed, 25 insertions, 0 deletions
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index e48989f04c24..995efbb031ab 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -91,6 +91,17 @@ static inline struct sock *__inet6_lookup(struct net *net,
91 return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif); 91 return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif);
92} 92}
93 93
94static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
95 struct sk_buff *skb,
96 const __be16 sport,
97 const __be16 dport)
98{
99 return __inet6_lookup(dev_net(skb->dst->dev), hashinfo,
100 &ipv6_hdr(skb)->saddr, sport,
101 &ipv6_hdr(skb)->daddr, ntohs(dport),
102 inet6_iif(skb));
103}
104
94extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, 105extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
95 const struct in6_addr *saddr, const __be16 sport, 106 const struct in6_addr *saddr, const __be16 sport,
96 const struct in6_addr *daddr, const __be16 dport, 107 const struct in6_addr *daddr, const __be16 dport,
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index bb619d80f2e2..3522bbcd546d 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -16,6 +16,7 @@
16 16
17 17
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/ip.h>
19#include <linux/ipv6.h> 20#include <linux/ipv6.h>
20#include <linux/list.h> 21#include <linux/list.h>
21#include <linux/slab.h> 22#include <linux/slab.h>
@@ -28,6 +29,7 @@
28#include <net/inet_connection_sock.h> 29#include <net/inet_connection_sock.h>
29#include <net/inet_sock.h> 30#include <net/inet_sock.h>
30#include <net/sock.h> 31#include <net/sock.h>
32#include <net/route.h>
31#include <net/tcp_states.h> 33#include <net/tcp_states.h>
32#include <net/netns/hash.h> 34#include <net/netns/hash.h>
33 35
@@ -371,6 +373,18 @@ static inline struct sock *inet_lookup(struct net *net,
371 return sk; 373 return sk;
372} 374}
373 375
376static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
377 struct sk_buff *skb,
378 const __be16 sport,
379 const __be16 dport)
380{
381 const struct iphdr *iph = ip_hdr(skb);
382
383 return __inet_lookup(dev_net(skb->dst->dev), hashinfo,
384 iph->saddr, sport,
385 iph->daddr, dport, inet_iif(skb));
386}
387
374extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, 388extern int __inet_hash_connect(struct inet_timewait_death_row *death_row,
375 struct sock *sk, u32 port_offset, 389 struct sock *sk, u32 port_offset,
376 int (*check_established)(struct inet_timewait_death_row *, 390 int (*check_established)(struct inet_timewait_death_row *,