Skip to content

Commit c0951cb

Browse files
committed
ipv4: Use flowi4_init_output() in udp_sendmsg()
Signed-off-by: David S. Miller <[email protected]>
1 parent 1bba6ff commit c0951cb

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

net/ipv4/udp.c

+6-12
Original file line numberDiff line numberDiff line change
@@ -909,20 +909,14 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
909909
rt = (struct rtable *)sk_dst_check(sk, 0);
910910

911911
if (rt == NULL) {
912-
struct flowi4 fl4 = {
913-
.flowi4_oif = ipc.oif,
914-
.flowi4_mark = sk->sk_mark,
915-
.daddr = faddr,
916-
.saddr = saddr,
917-
.flowi4_tos = tos,
918-
.flowi4_proto = sk->sk_protocol,
919-
.flowi4_flags = (inet_sk_flowi_flags(sk) |
920-
FLOWI_FLAG_CAN_SLEEP),
921-
.fl4_sport = inet->inet_sport,
922-
.fl4_dport = dport,
923-
};
912+
struct flowi4 fl4;
924913
struct net *net = sock_net(sk);
925914

915+
flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos,
916+
RT_SCOPE_UNIVERSE, sk->sk_protocol,
917+
inet_sk_flowi_flags(sk)|FLOWI_FLAG_CAN_SLEEP,
918+
faddr, saddr, dport, inet->inet_sport);
919+
926920
security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
927921
rt = ip_route_output_flow(net, &fl4, sk);
928922
if (IS_ERR(rt)) {

0 commit comments

Comments
 (0)