开发者

Is it possible to execute net_enable_timestamp() from user space in linux?

I'd like to enable timestamping received network packets. I found that function net_enable_timestamp() should do this form me, but I can't find it neither in CentOS nor in ArchLinux. But when I execute:

# cat /proc/kallsyms | grep net_enable_timestam开发者_开发百科p
c126a330 T net_enable_timestamp

In kernel source from kernel.org it's located in linux/netdevice.h, but not in both distros mentioned above. Is it possible to execute it? How?


What's wrong with enabling SO_TIMESTAMP on the socket and accessing the timestamp of the last message via ancilliary data?

Alternatively you can call ioctl(socket, SIOCGSTAMP) as described in socket(7)


Edit: Looking at the kernel source code, it appears that net_enable_timestamp() actually gets called indirectly when you do setsockopt(sock, SO_TIMESTAMP ...

So my answer answers your question :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜