inet: refactor inet[6]_lookup functions to take skb
This is a preliminary step to allow fast socket lookup of SO_REUSEPORT groups. Doing so with a BPF filter will require access to the skb in question. This change plumbs the skb (and offset to payload data) through the call stack to the listening socket lookup implementations where it will be used in a following patch. Signed-off-by: Craig Gallek <kraig@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
d9b3fca273
commit
a583636a83
@@ -53,6 +53,7 @@ struct sock *__inet6_lookup_established(struct net *net,
|
||||
|
||||
struct sock *inet6_lookup_listener(struct net *net,
|
||||
struct inet_hashinfo *hashinfo,
|
||||
struct sk_buff *skb, int doff,
|
||||
const struct in6_addr *saddr,
|
||||
const __be16 sport,
|
||||
const struct in6_addr *daddr,
|
||||
@@ -60,6 +61,7 @@ struct sock *inet6_lookup_listener(struct net *net,
|
||||
|
||||
static inline struct sock *__inet6_lookup(struct net *net,
|
||||
struct inet_hashinfo *hashinfo,
|
||||
struct sk_buff *skb, int doff,
|
||||
const struct in6_addr *saddr,
|
||||
const __be16 sport,
|
||||
const struct in6_addr *daddr,
|
||||
@@ -71,12 +73,12 @@ static inline struct sock *__inet6_lookup(struct net *net,
|
||||
if (sk)
|
||||
return sk;
|
||||
|
||||
return inet6_lookup_listener(net, hashinfo, saddr, sport,
|
||||
return inet6_lookup_listener(net, hashinfo, skb, doff, saddr, sport,
|
||||
daddr, hnum, dif);
|
||||
}
|
||||
|
||||
static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
|
||||
struct sk_buff *skb,
|
||||
struct sk_buff *skb, int doff,
|
||||
const __be16 sport,
|
||||
const __be16 dport,
|
||||
int iif)
|
||||
@@ -86,13 +88,14 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
|
||||
if (sk)
|
||||
return sk;
|
||||
|
||||
return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo,
|
||||
&ipv6_hdr(skb)->saddr, sport,
|
||||
return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo, skb,
|
||||
doff, &ipv6_hdr(skb)->saddr, sport,
|
||||
&ipv6_hdr(skb)->daddr, ntohs(dport),
|
||||
iif);
|
||||
}
|
||||
|
||||
struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
|
||||
struct sk_buff *skb, int doff,
|
||||
const struct in6_addr *saddr, const __be16 sport,
|
||||
const struct in6_addr *daddr, const __be16 dport,
|
||||
const int dif);
|
||||
|
Reference in New Issue
Block a user