Skip to content

Commit edbe774

Browse files
shimodaydavem330
authored andcommitted
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: c14ac94 ("sock: enable timestamping using control messages") Reported-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com> Reported-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent eabfdda commit edbe774

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/packet/af_packet.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,7 @@ static int packet_sendmsg_spkt(struct socket *sock, struct msghdr *msg,
19271927
goto out_unlock;
19281928
}
19291929

1930-
sockc.tsflags = 0;
1930+
sockc.tsflags = sk->sk_tsflags;
19311931
if (msg->msg_controllen) {
19321932
err = sock_cmsg_send(sk, msg, &sockc);
19331933
if (unlikely(err)) {
@@ -2678,7 +2678,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
26782678
dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex);
26792679
}
26802680

2681-
sockc.tsflags = 0;
2681+
sockc.tsflags = po->sk.sk_tsflags;
26822682
if (msg->msg_controllen) {
26832683
err = sock_cmsg_send(&po->sk, msg, &sockc);
26842684
if (unlikely(err))
@@ -2881,7 +2881,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
28812881
if (unlikely(!(dev->flags & IFF_UP)))
28822882
goto out_unlock;
28832883

2884-
sockc.tsflags = 0;
2884+
sockc.tsflags = sk->sk_tsflags;
28852885
sockc.mark = sk->sk_mark;
28862886
if (msg->msg_controllen) {
28872887
err = sock_cmsg_send(sk, msg, &sockc);

0 commit comments

Comments
 (0)