* [PATCH netfilter] netfilter: nfnetlink_log: always add a timestamp
@ 2023-07-25 8:54 Maciej Żenczykowski
2023-07-27 13:58 ` Florian Westphal
0 siblings, 1 reply; 4+ messages in thread
From: Maciej Żenczykowski @ 2023-07-25 8:54 UTC (permalink / raw)
To: Maciej Żenczykowski, Pablo Neira Ayuso, Florian Westphal
Cc: Linux Network Development Mailing List,
Netfilter Development Mailing List, Maciej Żenczykowski,
Martin KaFai Lau
Compared to all the other work we're already doing to deliver
an skb to userspace this is very cheap - at worse an extra
call to ktime_get_real() - and very useful.
(and indeed it may even be cheaper if we're running from other hooks)
(background: Android occasionally logs packets which
caused wake from sleep/suspend and we'd like to have
timestamps reliably associated with these events)
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
net/netfilter/nfnetlink_log.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index e57eb168ee13..53c9e76473ba 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -470,7 +470,6 @@ __build_packet_message(struct nfnl_log_net *log,
sk_buff_data_t old_tail = inst->skb->tail;
struct sock *sk;
const unsigned char *hwhdrp;
- ktime_t tstamp;
nlh = nfnl_msg_put(inst->skb, 0, 0,
nfnl_msg_type(NFNL_SUBSYS_ULOG, NFULNL_MSG_PACKET),
@@ -599,10 +598,9 @@ __build_packet_message(struct nfnl_log_net *log,
goto nla_put_failure;
}
- tstamp = skb_tstamp_cond(skb, false);
- if (hooknum <= NF_INET_FORWARD && tstamp) {
+ if (hooknum <= NF_INET_FORWARD) {
+ struct timespec64 kts = ktime_to_timespec64(skb_tstamp_cond(skb, true));
struct nfulnl_msg_packet_timestamp ts;
- struct timespec64 kts = ktime_to_timespec64(tstamp);
ts.sec = cpu_to_be64(kts.tv_sec);
ts.usec = cpu_to_be64(kts.tv_nsec / NSEC_PER_USEC);
--
2.41.0.487.g6d72f3e995-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH netfilter] netfilter: nfnetlink_log: always add a timestamp
2023-07-25 8:54 [PATCH netfilter] netfilter: nfnetlink_log: always add a timestamp Maciej Żenczykowski
@ 2023-07-27 13:58 ` Florian Westphal
2023-08-04 19:26 ` Maciej Żenczykowski
0 siblings, 1 reply; 4+ messages in thread
From: Florian Westphal @ 2023-07-27 13:58 UTC (permalink / raw)
To: Maciej Żenczykowski
Cc: Maciej Żenczykowski, Pablo Neira Ayuso, Florian Westphal,
Linux Network Development Mailing List,
Netfilter Development Mailing List, Martin KaFai Lau
Maciej Żenczykowski <maze@google.com> wrote:
> Compared to all the other work we're already doing to deliver
> an skb to userspace this is very cheap - at worse an extra
> call to ktime_get_real() - and very useful.
Reviewed-by: Florian Westphal <fw@strlen.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH netfilter] netfilter: nfnetlink_log: always add a timestamp
2023-07-27 13:58 ` Florian Westphal
@ 2023-08-04 19:26 ` Maciej Żenczykowski
2023-08-04 19:40 ` Florian Westphal
0 siblings, 1 reply; 4+ messages in thread
From: Maciej Żenczykowski @ 2023-08-04 19:26 UTC (permalink / raw)
To: Florian Westphal, coreteam, kadlec
Cc: Pablo Neira Ayuso, Linux Network Development Mailing List,
Netfilter Development Mailing List, Martin KaFai Lau
On Thu, Jul 27, 2023 at 3:58 PM Florian Westphal <fw@strlen.de> wrote:
>
> Maciej Żenczykowski <maze@google.com> wrote:
> > Compared to all the other work we're already doing to deliver
> > an skb to userspace this is very cheap - at worse an extra
> > call to ktime_get_real() - and very useful.
>
> Reviewed-by: Florian Westphal <fw@strlen.de>
I'm not sure if there's anything else that needs to happen for this to
get merged.
Maybe it fell through the cracks...? Maybe I didn't add the right CC's...
Thanks,
Maciej
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH netfilter] netfilter: nfnetlink_log: always add a timestamp
2023-08-04 19:26 ` Maciej Żenczykowski
@ 2023-08-04 19:40 ` Florian Westphal
0 siblings, 0 replies; 4+ messages in thread
From: Florian Westphal @ 2023-08-04 19:40 UTC (permalink / raw)
To: Maciej Żenczykowski
Cc: Florian Westphal, coreteam, kadlec, Pablo Neira Ayuso,
Linux Network Development Mailing List,
Netfilter Development Mailing List, Martin KaFai Lau
Maciej Żenczykowski <maze@google.com> wrote:
> On Thu, Jul 27, 2023 at 3:58 PM Florian Westphal <fw@strlen.de> wrote:
> >
> > Maciej Żenczykowski <maze@google.com> wrote:
> > > Compared to all the other work we're already doing to deliver
> > > an skb to userspace this is very cheap - at worse an extra
> > > call to ktime_get_real() - and very useful.
> >
> > Reviewed-by: Florian Westphal <fw@strlen.de>
>
> I'm not sure if there's anything else that needs to happen for this to
> get merged.
This is fine, it'll be merged for -next.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-04 19:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-25 8:54 [PATCH netfilter] netfilter: nfnetlink_log: always add a timestamp Maciej Żenczykowski
2023-07-27 13:58 ` Florian Westphal
2023-08-04 19:26 ` Maciej Żenczykowski
2023-08-04 19:40 ` Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).