diff options
author | David Ahern | 2017-08-07 17:44:17 +0200 |
---|---|---|
committer | David S. Miller | 2017-08-07 20:39:21 +0200 |
commit | 3fa6f616a7a4d0bdf4d877d530456d8a5c3b109b (patch) | |
tree | d59b0df380b5f2b8d54356a47950fac577e8ef3c /include/net/tcp.h | |
parent | net: ipv4: add second dif to udp socket lookups (diff) | |
download | kernel-qcow2-linux-3fa6f616a7a4d0bdf4d877d530456d8a5c3b109b.tar.gz kernel-qcow2-linux-3fa6f616a7a4d0bdf4d877d530456d8a5c3b109b.tar.xz kernel-qcow2-linux-3fa6f616a7a4d0bdf4d877d530456d8a5c3b109b.zip |
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>
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 5173fecde495..2b89f1ab8552 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -840,6 +840,16 @@ static inline bool inet_exact_dif_match(struct net *net, struct sk_buff *skb) return false; } +/* TCP_SKB_CB reference means this can not be used from early demux */ +static inline int tcp_v4_sdif(struct sk_buff *skb) +{ +#if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) + if (skb && ipv4_l3mdev_skb(TCP_SKB_CB(skb)->header.h4.flags)) + return TCP_SKB_CB(skb)->header.h4.iif; +#endif + return 0; +} + /* Due to TSO, an SKB can be composed of multiple actual * packets. To keep these tracked properly, we use this. */ |