mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
dump_packet_cmsg -- Allow to receive timestamp data
A socket may support receiving timestamps from the kernel (see net/socket.c:__sock_recv_timestamp in the kernel), so simply pass up this data to userspace. Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com> (cherry picked from commit 1ecd757bf23831d1574e1dca0566dbe26e0fcb49) Ahmed Elaidy: - ported as a standalone commit (was previously squashed into the unix-sockets ucred support); only the SOL_SOCKET timestamp handling is kept, the netlink pktinfo part of the original is not ported here. Signed-off-by: Ahmed Elaidy <elaidya225@gmail.com> Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>
This commit is contained in:
parent
abc025016b
commit
eee7477515
1 changed files with 15 additions and 7 deletions
|
|
@ -207,14 +207,22 @@ static int dump_packet_cmsg(struct msghdr *mh, SkPacketEntry *pe, int flags)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ch->cmsg_len == CMSG_LEN(sizeof(struct ucred)) &&
|
||||
ch->cmsg_type == SCM_CREDENTIALS &&
|
||||
ch->cmsg_level == SOL_SOCKET) {
|
||||
struct ucred *ucred = (struct ucred *)CMSG_DATA(ch);
|
||||
if (ch->cmsg_level == SOL_SOCKET) {
|
||||
if (ch->cmsg_len == CMSG_LEN(sizeof(struct ucred)) &&
|
||||
ch->cmsg_type == SCM_CREDENTIALS) {
|
||||
struct ucred *ucred = (struct ucred *)CMSG_DATA(ch);
|
||||
|
||||
if (dump_sk_creds(ucred, pe, flags))
|
||||
return -1;
|
||||
continue;
|
||||
if (dump_sk_creds(ucred, pe, flags))
|
||||
return -1;
|
||||
continue;
|
||||
} else if (ch->cmsg_type == SCM_TIMESTAMP ||
|
||||
ch->cmsg_type == SCM_TIMESTAMPNS ||
|
||||
ch->cmsg_type == SCM_TIMESTAMPING) {
|
||||
/*
|
||||
* Allow to receive timestamps from the kernel.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
pr_err("cmsg: len %lu type %d level %d\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue