Skip to content

Commit 42e5ffc

Browse files
Guillaume Naultkuba-moo
authored andcommitted
ipv4: Use inet_sk_init_flowi4() in inet_csk_rebuild_route().
Use inet_sk_init_flowi4() to automatically initialise the flowi4 structure in inet_csk_rebuild_route() instead of passing parameters manually to ip_route_output_ports(). Signed-off-by: Guillaume Nault <[email protected]> Link: https://patch.msgid.link/b270931636effa1095508e0f0a3e8c3a0e6d357f.1734357769.git.gnault@redhat.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5be1323 commit 42e5ffc

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

net/ipv4/inet_connection_sock.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,20 +1561,13 @@ EXPORT_SYMBOL_GPL(inet_csk_addr2sockaddr);
15611561
static struct dst_entry *inet_csk_rebuild_route(struct sock *sk, struct flowi *fl)
15621562
{
15631563
const struct inet_sock *inet = inet_sk(sk);
1564-
const struct ip_options_rcu *inet_opt;
1565-
__be32 daddr = inet->inet_daddr;
15661564
struct flowi4 *fl4;
15671565
struct rtable *rt;
15681566

15691567
rcu_read_lock();
1570-
inet_opt = rcu_dereference(inet->inet_opt);
1571-
if (inet_opt && inet_opt->opt.srr)
1572-
daddr = inet_opt->opt.faddr;
15731568
fl4 = &fl->u.ip4;
1574-
rt = ip_route_output_ports(sock_net(sk), fl4, sk, daddr,
1575-
inet->inet_saddr, inet->inet_dport,
1576-
inet->inet_sport, sk->sk_protocol,
1577-
ip_sock_rt_tos(sk), sk->sk_bound_dev_if);
1569+
inet_sk_init_flowi4(inet, fl4);
1570+
rt = ip_route_output_flow(sock_net(sk), fl4, sk);
15781571
if (IS_ERR(rt))
15791572
rt = NULL;
15801573
if (rt)

0 commit comments

Comments
 (0)