ipv4: Fix ip_local_out_sk by passing the sk into __ip_local_out_sk
[cascardo/linux.git] / net / ipv4 / route.c
index 54297d3..bf1486b 100644 (file)
@@ -2238,21 +2238,7 @@ struct rtable *__ip_route_output_key_hash(struct net *net, struct flowi4 *fl4,
                goto make_route;
        }
 
-#ifdef CONFIG_IP_ROUTE_MULTIPATH
-       if (res.fi->fib_nhs > 1 && fl4->flowi4_oif == 0) {
-               if (mp_hash < 0)
-                       mp_hash = fib_multipath_hash(fl4->saddr, fl4->daddr);
-               fib_select_multipath(&res, mp_hash);
-       }
-       else
-#endif
-       if (!res.prefixlen &&
-           res.table->tb_num_default > 1 &&
-           res.type == RTN_UNICAST && !fl4->flowi4_oif)
-               fib_select_default(fl4, &res);
-
-       if (!fl4->saddr)
-               fl4->saddr = FIB_RES_PREFSRC(net, res);
+       fib_select_path(net, &res, fl4, mp_hash);
 
        dev_out = FIB_RES_DEV(res);
        fl4->flowi4_oif = dev_out->ifindex;
@@ -2521,6 +2507,9 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
        fl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0;
        fl4.flowi4_mark = mark;
 
+       if (netif_index_is_l3_master(net, fl4.flowi4_oif))
+               fl4.flowi4_flags = FLOWI_FLAG_L3MDEV_SRC | FLOWI_FLAG_SKIP_NH_OIF;
+
        if (iif) {
                struct net_device *dev;