Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Exploit OS timestamping when capturing packets #277

Open
frisso opened this issue Mar 2, 2020 · 1 comment
Open

[Feature Request] Exploit OS timestamping when capturing packets #277

frisso opened this issue Mar 2, 2020 · 1 comment

Comments

@frisso
Copy link
Contributor

frisso commented Mar 2, 2020

Problem statement

When capturing packets, e.g., in the packetcapture service, the dataplane code has to take the timestamp of the packet. However, it seems that somewhere the Linux kernel handles the timestamp of the packet, given that there is a tstamp member in the sk_buff structure.

Describe the solution you'd like

It would be nice to be able to take the value possibly stored in sk_buff.tstamp instead of taking the timestamp in eBPF dataplane code.

Additional context

From some tests done on the packetcapture service, it seems that the value in sk_buff.tstamp is always zero (program running in TC, attached to both physical and virtual interfaces). However, the member is there and if we type man packet, which refers to AF_SOCKET, it says that the PACKET_TIMESTAMP is just for this purpose. So, it is not clear how to exploit this timestamping in eBPF code.

@smagnani96
Copy link
Collaborator

The proposal in #320 is to provide a method to generate a Unix epoch timestamp by simply calling bpf_ktime_get_ns() and adding this value to a precomputed Epoch timestamp.

The problem we are facing with sk_buff.tstamp is that sometimes the field is empty or contains an unknown value.
Probably I am missing something, but right now it seems that we cannot fully trust this field, even because it does not exists in a XDP program

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants