Skip to content

Commit 5be1323

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

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

net/ipv4/datagram.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ EXPORT_SYMBOL(ip4_datagram_connect);
102102
void ip4_datagram_release_cb(struct sock *sk)
103103
{
104104
const struct inet_sock *inet = inet_sk(sk);
105-
const struct ip_options_rcu *inet_opt;
106-
__be32 daddr = inet->inet_daddr;
107105
struct dst_entry *dst;
108106
struct flowi4 fl4;
109107
struct rtable *rt;
@@ -115,14 +113,9 @@ void ip4_datagram_release_cb(struct sock *sk)
115113
rcu_read_unlock();
116114
return;
117115
}
118-
inet_opt = rcu_dereference(inet->inet_opt);
119-
if (inet_opt && inet_opt->opt.srr)
120-
daddr = inet_opt->opt.faddr;
121-
rt = ip_route_output_ports(sock_net(sk), &fl4, sk, daddr,
122-
inet->inet_saddr, inet->inet_dport,
123-
inet->inet_sport, sk->sk_protocol,
124-
ip_sock_rt_tos(sk), sk->sk_bound_dev_if);
125116

117+
inet_sk_init_flowi4(inet, &fl4);
118+
rt = ip_route_output_flow(sock_net(sk), &fl4, sk);
126119
dst = !IS_ERR(rt) ? &rt->dst : NULL;
127120
sk_dst_set(sk, dst);
128121

0 commit comments

Comments
 (0)