| Submitter | Alban Crequy |
|---|---|
| Date | Oct. 4, 2010, 6:48 p.m. |
| Message ID | <1286218109-30771-1-git-send-email-alban.crequy@collabora.co.uk> |
| Download | mbox | patch |
| Permalink | /patch/66716/ |
| State | Accepted |
| Delegated to: | David Miller |
| Headers | show |
Comments
Le lundi 04 octobre 2010 à 19:48 +0100, Alban Crequy a écrit : > Userspace applications can already request to receive timestamps with: > setsockopt(sockfd, SOL_SOCKET, SO_TIMESTAMP, ...) > > Although setsockopt() returns zero (success), timestamps are not added to the > ancillary data. This patch fixes that on SOCK_DGRAM and SOCK_SEQPACKET Unix > sockets. > > Signed-off-by: Alban Crequy <alban.crequy@collabora.co.uk> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Note: tstamp is sampled at the time of skb queueing, _after_ eventual sleep in sock_alloc_send_skb() or memcpy_fromiovec() -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Mon, 04 Oct 2010 21:20:52 +0200 > Le lundi 04 octobre 2010 à 19:48 +0100, Alban Crequy a écrit : >> Userspace applications can already request to receive timestamps with: >> setsockopt(sockfd, SOL_SOCKET, SO_TIMESTAMP, ...) >> >> Although setsockopt() returns zero (success), timestamps are not added to the >> ancillary data. This patch fixes that on SOCK_DGRAM and SOCK_SEQPACKET Unix >> sockets. >> >> Signed-off-by: Alban Crequy <alban.crequy@collabora.co.uk> > > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Applied. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Patch
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 617bea4..b03baa8 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1484,6 +1484,8 @@ restart: goto restart; } + if (sock_flag(other, SOCK_RCVTSTAMP)) + __net_timestamp(skb); skb_queue_tail(&other->sk_receive_queue, skb); unix_state_unlock(other); other->sk_data_ready(other, len); @@ -1697,6 +1699,9 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, if (err) goto out_free; + if (sock_flag(sk, SOCK_RCVTSTAMP)) + __sock_recv_timestamp(msg, sk, skb); + if (!siocb->scm) { siocb->scm = &tmp_scm; memset(&tmp_scm, 0, sizeof(tmp_scm));
Userspace applications can already request to receive timestamps with: setsockopt(sockfd, SOL_SOCKET, SO_TIMESTAMP, ...) Although setsockopt() returns zero (success), timestamps are not added to the ancillary data. This patch fixes that on SOCK_DGRAM and SOCK_SEQPACKET Unix sockets. Signed-off-by: Alban Crequy <alban.crequy@collabora.co.uk> --- net/unix/af_unix.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)