Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv4: Use cork flow in ip_queue_xmit()

All invokers of ip_queue_xmit() must make certain that the
socket is locked. All of SCTP, TCP, DCCP, and L2TP now make
sure this is the case.

Therefore we can use the cork flow during output route lookup in
ip_queue_xmit() when the socket route check fails.

Signed-off-by: David S. Miller <davem@davemloft.net>

+3 -2
+3 -2
net/ipv4/ip_output.c
··· 317 317 struct sock *sk = skb->sk; 318 318 struct inet_sock *inet = inet_sk(sk); 319 319 struct ip_options_rcu *inet_opt; 320 + struct flowi4 *fl4; 320 321 struct rtable *rt; 321 322 struct iphdr *iph; 322 323 int res; ··· 332 331 goto packet_routed; 333 332 334 333 /* Make sure we can route this packet. */ 334 + fl4 = &inet->cork.fl.u.ip4; 335 335 rt = (struct rtable *)__sk_dst_check(sk, 0); 336 336 if (rt == NULL) { 337 - struct flowi4 fl4; 338 337 __be32 daddr; 339 338 340 339 /* Use correct destination address if we have options. */ ··· 346 345 * keep trying until route appears or the connection times 347 346 * itself out. 348 347 */ 349 - rt = ip_route_output_ports(sock_net(sk), &fl4, sk, 348 + rt = ip_route_output_ports(sock_net(sk), fl4, sk, 350 349 daddr, inet->inet_saddr, 351 350 inet->inet_dport, 352 351 inet->inet_sport,