mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 03:10:12 +00:00
udp: Stop using RTO_ONLINK.
Use ip_sendmsg_scope() to properly initialise the scope in flowi4_init_output(), instead of overriding tos with the RTO_ONLINK flag. The objective is to eventually remove RTO_ONLINK, which will allow converting .flowi4_tos to dscp_t. Now that the scope is determined by ip_sendmsg_scope(), we need to check its result to set the 'connected' variable. Signed-off-by: Guillaume Nault <gnault@redhat.com> Reviewed-by: David Ahern <dsahern@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c85be08fc4
commit
0e26371db5
1 changed files with 6 additions and 11 deletions
|
@ -1062,8 +1062,8 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||
int free = 0;
|
||||
int connected = 0;
|
||||
__be32 daddr, faddr, saddr;
|
||||
u8 tos, scope;
|
||||
__be16 dport;
|
||||
u8 tos;
|
||||
int err, is_udplite = IS_UDPLITE(sk);
|
||||
int corkreq = READ_ONCE(up->corkflag) || msg->msg_flags&MSG_MORE;
|
||||
int (*getfrag)(void *, char *, int, int, int, struct sk_buff *);
|
||||
|
@ -1183,12 +1183,9 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||
connected = 0;
|
||||
}
|
||||
tos = get_rttos(&ipc, inet);
|
||||
if (sock_flag(sk, SOCK_LOCALROUTE) ||
|
||||
(msg->msg_flags & MSG_DONTROUTE) ||
|
||||
(ipc.opt && ipc.opt->opt.is_strictroute)) {
|
||||
tos |= RTO_ONLINK;
|
||||
scope = ip_sendmsg_scope(inet, &ipc, msg);
|
||||
if (scope == RT_SCOPE_LINK)
|
||||
connected = 0;
|
||||
}
|
||||
|
||||
if (ipv4_is_multicast(daddr)) {
|
||||
if (!ipc.oif || netif_index_is_l3_master(sock_net(sk), ipc.oif))
|
||||
|
@ -1221,11 +1218,9 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||
|
||||
fl4 = &fl4_stack;
|
||||
|
||||
flowi4_init_output(fl4, ipc.oif, ipc.sockc.mark, tos,
|
||||
RT_SCOPE_UNIVERSE, sk->sk_protocol,
|
||||
flow_flags,
|
||||
faddr, saddr, dport, inet->inet_sport,
|
||||
sk->sk_uid);
|
||||
flowi4_init_output(fl4, ipc.oif, ipc.sockc.mark, tos, scope,
|
||||
sk->sk_protocol, flow_flags, faddr, saddr,
|
||||
dport, inet->inet_sport, sk->sk_uid);
|
||||
|
||||
security_sk_classify_flow(sk, flowi4_to_flowi_common(fl4));
|
||||
rt = ip_route_output_flow(net, fl4, sk);
|
||||
|
|
Loading…
Reference in a new issue