Merge tag 'spi-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / udp.c
index f7d1d5e19e955563178fcddb84c4ffe9abb66036..24ec14f9825c20834eca20b820ec953ba108da52 100644 (file)
@@ -375,7 +375,8 @@ static inline int compute_score(struct sock *sk, struct net *net,
                        return -1;
                score += 4;
        }
-
+       if (sk->sk_incoming_cpu == raw_smp_processor_id())
+               score++;
        return score;
 }
 
@@ -419,6 +420,9 @@ static inline int compute_score2(struct sock *sk, struct net *net,
                score += 4;
        }
 
+       if (sk->sk_incoming_cpu == raw_smp_processor_id())
+               score++;
+
        return score;
 }
 
@@ -1017,30 +1021,14 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 
                fl4 = &fl4_stack;
 
-               /* unconnected socket. If output device is enslaved to a VRF
-                * device lookup source address from VRF table. This mimics
-                * behavior of ip_route_connect{_init}.
-                */
-               if (netif_index_is_vrf(net, ipc.oif)) {
-                       flowi4_init_output(fl4, ipc.oif, sk->sk_mark, tos,
-                                          RT_SCOPE_UNIVERSE, sk->sk_protocol,
-                                          (flow_flags | FLOWI_FLAG_VRFSRC |
-                                           FLOWI_FLAG_SKIP_NH_OIF),
-                                          faddr, saddr, dport,
-                                          inet->inet_sport);
-
-                       rt = ip_route_output_flow(net, fl4, sk);
-                       if (!IS_ERR(rt)) {
-                               saddr = fl4->saddr;
-                               ip_rt_put(rt);
-                       }
-               }
-
                flowi4_init_output(fl4, ipc.oif, sk->sk_mark, tos,
                                   RT_SCOPE_UNIVERSE, sk->sk_protocol,
                                   flow_flags,
                                   faddr, saddr, dport, inet->inet_sport);
 
+               if (!saddr && ipc.oif)
+                       l3mdev_get_saddr(net, ipc.oif, fl4);
+
                security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
                rt = ip_route_output_flow(net, fl4, sk);
                if (IS_ERR(rt)) {