OSDN Git Service

net: Get rcv tstamp if needed in nfnetlink_{log, queue}.c
authorMartin KaFai Lau <kafai@fb.com>
Wed, 2 Mar 2022 19:56:15 +0000 (11:56 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Mar 2022 14:38:48 +0000 (14:38 +0000)
commit80fcec675112bd2f697ca1ca74ceb923c53cd569
tree700f55b5f52aa5068d79856baf02499a9663cc60
parentb6561f8491ca899e5a08311796085c9738d631ae
net: Get rcv tstamp if needed in nfnetlink_{log, queue}.c

If skb has the (rcv) timestamp available, nfnetlink_{log, queue}.c
logs/outputs it to the userspace.  When the locally generated skb is
looping from egress to ingress over a virtual interface (e.g. veth,
loopback...),  skb->tstamp may have the delivery time before it is
known that will be delivered locally and received by another sk.  Like
handling the delivery time in network tapping,  use ktime_get_real() to
get the (rcv) timestamp.  The earlier added helper skb_tstamp_cond() is
used to do this.  false is passed to the second 'cond' arg such
that doing ktime_get_real() or not only depends on the
netstamp_needed_key static key.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netfilter/nfnetlink_log.c
net/netfilter/nfnetlink_queue.c