RE: [PATCH/RFC] packet: fix sock_tx_timestamp() in packet_snd() via sendto syscall
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date: 2016-07-19 05:43:06
Hi,
From: Willem de Bruijn Sent: Saturday, July 16, 2016 12:31 AM On Thu, Jul 14, 2016 at 10:49 PM, Yoshihiro Shimoda [off-list ref] wrote:quoted
Since the sendto syscall doesn't have msg_control buffer, the sock_tx_timestamp() in packet_snd() cannot work correctly because the socks.fsflags is set to 0.You're right. __sock_tx_timestamp used to take sk->sk_tsflags as input, now it relies solely on this parameter tsflags. All callsites must either pass sk->sk_tsflags directly or initialize sockc.tsflags to this value.
Thank you very much for the comment!
quoted
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 9f0983f..d76fd41 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c@@ -2887,6 +2887,11 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) err = sock_cmsg_send(sk, msg, &sockc); if (unlikely(err)) goto out_unlock; + } else { + /* Set tsflags from sk because a syscall (e.g. sendto) doesn't + * have msg_control buffer. + */ + sockc.tsflags = sk->sk_tsflags; }Better to follow the example of other protocols. In all three packet variants, make the following initialization change: - sockc.tsflags = 0; + sockc.tsflags = sk->sk_tsflags;
Thank you for the suggestion. I submitted a fixed patch now. Best regards, Yoshihiro Shimoda
(I had to remove some recipients, because my reply was marked as spam and dropped otherwise..)