]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - net/ipv4/route.c
ipv4/route.c: respect prefsrc for local routes
[~shefty/rdma-dev.git] / net / ipv4 / route.c
index df948b0f1ac97c0e1d436690c6bb49f4c9fd056d..93bfd95584f4656605eb963919de2d74b7c729f0 100644 (file)
@@ -2649,8 +2649,12 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
        }
 
        if (res.type == RTN_LOCAL) {
-               if (!fl.fl4_src)
-                       fl.fl4_src = fl.fl4_dst;
+               if (!fl.fl4_src) {
+                       if (res.fi->fib_prefsrc)
+                               fl.fl4_src = res.fi->fib_prefsrc;
+                       else
+                               fl.fl4_src = fl.fl4_dst;
+               }
                dev_out = net->loopback_dev;
                fl.oif = dev_out->ifindex;
                res.fi = NULL;