diff options
author | David Ahern <dsahern@gmail.com> | 2017-08-07 08:44:16 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-07 11:39:21 -0700 |
commit | fb74c27735f0a34e76dbf1972084e984ad2ea145 (patch) | |
tree | 5c92a234b104580270088b0c3ec243d7ad20f902 /include/net/ip.h | |
parent | 46d4b68f891bee5d83a32508bfbd9778be6b1b63 (diff) | |
download | linux-fb74c27735f0a34e76dbf1972084e984ad2ea145.tar.bz2 |
net: ipv4: add second dif to udp socket lookups
Add a second device index, sdif, to udp 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.
Early demux lookups are handled in the next patch as part of INET_MATCH
changes.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ip.h')
-rw-r--r-- | include/net/ip.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index 9e59dcf1787a..39db596eb89f 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -78,6 +78,16 @@ struct ipcm_cookie { #define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) #define PKTINFO_SKB_CB(skb) ((struct in_pktinfo *)((skb)->cb)) +/* return enslaved device index if relevant */ +static inline int inet_sdif(struct sk_buff *skb) +{ +#if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) + if (skb && ipv4_l3mdev_skb(IPCB(skb)->flags)) + return IPCB(skb)->iif; +#endif + return 0; +} + struct ip_ra_chain { struct ip_ra_chain __rcu *next; struct sock *sk; |