net: ipv4: add second dif to inet socket lookups
Add a second device index, sdif, to inet socket lookups. sdif is the index for ingress devices enslaved to an l3mdev. It allows the lookups to consider the enslaved device as well as the L3 domain when searching for a socket. TCP moves the data in the cb. Prior to tcp_v4_rcv (e.g., early demux) the ingress index is obtained from IPCB using inet_sdif and after the cb move in tcp_v4_rcv the tcp_v4_sdif helper is used. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
fb74c27735
commit
3fa6f616a7
@@ -2196,7 +2196,7 @@ static struct sock *__udp4_lib_mcast_demux_lookup(struct net *net,
|
||||
static struct sock *__udp4_lib_demux_lookup(struct net *net,
|
||||
__be16 loc_port, __be32 loc_addr,
|
||||
__be16 rmt_port, __be32 rmt_addr,
|
||||
int dif)
|
||||
int dif, int sdif)
|
||||
{
|
||||
unsigned short hnum = ntohs(loc_port);
|
||||
unsigned int hash2 = udp4_portaddr_hash(net, loc_addr, hnum);
|
||||
@@ -2208,7 +2208,7 @@ static struct sock *__udp4_lib_demux_lookup(struct net *net,
|
||||
|
||||
udp_portaddr_for_each_entry_rcu(sk, &hslot2->head) {
|
||||
if (INET_MATCH(sk, net, acookie, rmt_addr,
|
||||
loc_addr, ports, dif))
|
||||
loc_addr, ports, dif, sdif))
|
||||
return sk;
|
||||
/* Only check first socket in chain */
|
||||
break;
|
||||
@@ -2254,7 +2254,7 @@ void udp_v4_early_demux(struct sk_buff *skb)
|
||||
dif, sdif);
|
||||
} else if (skb->pkt_type == PACKET_HOST) {
|
||||
sk = __udp4_lib_demux_lookup(net, uh->dest, iph->daddr,
|
||||
uh->source, iph->saddr, dif);
|
||||
uh->source, iph->saddr, dif, sdif);
|
||||
}
|
||||
|
||||
if (!sk || !refcount_inc_not_zero(&sk->sk_refcnt))
|
||||
|
Reference in New Issue
Block a user