|
@@ -72,6 +72,7 @@
|
|
|
#include <net/tcp_states.h>
|
|
|
#include <linux/net_tstamp.h>
|
|
|
#include <net/smc.h>
|
|
|
+#include <net/l3mdev.h>
|
|
|
|
|
|
/*
|
|
|
* This structure really needs to be cleaned up.
|
|
@@ -2399,4 +2400,23 @@ static inline void sk_pacing_shift_update(struct sock *sk, int val)
|
|
|
sk->sk_pacing_shift = val;
|
|
|
}
|
|
|
|
|
|
+/* if a socket is bound to a device, check that the given device
|
|
|
+ * index is either the same or that the socket is bound to an L3
|
|
|
+ * master device and the given device index is also enslaved to
|
|
|
+ * that L3 master
|
|
|
+ */
|
|
|
+static inline bool sk_dev_equal_l3scope(struct sock *sk, int dif)
|
|
|
+{
|
|
|
+ int mdif;
|
|
|
+
|
|
|
+ if (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif)
|
|
|
+ return true;
|
|
|
+
|
|
|
+ mdif = l3mdev_master_ifindex_by_index(sock_net(sk), dif);
|
|
|
+ if (mdif && mdif == sk->sk_bound_dev_if)
|
|
|
+ return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
#endif /* _SOCK_H */
|