@@ -523,10 +523,19 @@ static void build_skb_flow_key(struct flowi4 *fl4,
const struct sk_buff *skb,
const struct sock *sk)
{
const struct iphdr *iph = ip_hdr(skb);
- int oif = skb->dev->ifindex;
+ struct net_device *master = NULL;
u8 tos = RT_TOS(iph->tos);
u8 prot = iph->protocol;
u32 mark = skb->mark;
+ int oif = skb->dev->ifindex;
+
+ if (skb->dev->flags & IFF_SLAVE) {
+ rcu_read_lock();
+ master = skb_dst(skb)->dev;
+ if (master)
+ oif = master->ifindex;
+ rcu_read_unlock();
+ }
__build_flow_key(fl4, sk, iph, oif, tos, prot, mark, 0);