Commit edbe7746 authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by David S. Miller

packet: fix second argument of sock_tx_timestamp()

This patch fixes an issue that a syscall (e.g. sendto syscall) cannot
work correctly. Since the sendto syscall doesn't have msg_control buffer,
the sock_tx_timestamp() in packet_snd() cannot work correctly because
the socks.tsflags is set to 0.
So, this patch sets the socks.tsflags to sk->sk_tsflags as default.

Fixes: c14ac945 ("sock: enable timestamping using control messages")
Reported-by: default avatarKazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Reported-by: default avatarKeita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
Acked-by: default avatarWillem de Bruijn <willemb@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eabfdda9
...@@ -1927,7 +1927,7 @@ static int packet_sendmsg_spkt(struct socket *sock, struct msghdr *msg, ...@@ -1927,7 +1927,7 @@ static int packet_sendmsg_spkt(struct socket *sock, struct msghdr *msg,
goto out_unlock; goto out_unlock;
} }
sockc.tsflags = 0; sockc.tsflags = sk->sk_tsflags;
if (msg->msg_controllen) { if (msg->msg_controllen) {
err = sock_cmsg_send(sk, msg, &sockc); err = sock_cmsg_send(sk, msg, &sockc);
if (unlikely(err)) { if (unlikely(err)) {
...@@ -2678,7 +2678,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) ...@@ -2678,7 +2678,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex); dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex);
} }
sockc.tsflags = 0; sockc.tsflags = po->sk.sk_tsflags;
if (msg->msg_controllen) { if (msg->msg_controllen) {
err = sock_cmsg_send(&po->sk, msg, &sockc); err = sock_cmsg_send(&po->sk, msg, &sockc);
if (unlikely(err)) if (unlikely(err))
...@@ -2881,7 +2881,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) ...@@ -2881,7 +2881,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
if (unlikely(!(dev->flags & IFF_UP))) if (unlikely(!(dev->flags & IFF_UP)))
goto out_unlock; goto out_unlock;
sockc.tsflags = 0; sockc.tsflags = sk->sk_tsflags;
sockc.mark = sk->sk_mark; sockc.mark = sk->sk_mark;
if (msg->msg_controllen) { if (msg->msg_controllen) {
err = sock_cmsg_send(sk, msg, &sockc); err = sock_cmsg_send(sk, msg, &sockc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment