Date: Tue, 30 May 2023 16:23:49 GMT From: Cheng Cui <cc@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 7a52b570e758 - main - siftr: bring back the siftr_pkts_per_log feature Message-ID: <202305301623.34UGNnaf047524@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by cc: URL: https://cgit.FreeBSD.org/src/commit/?id=7a52b570e758a5f607c4071e260065633632c868 commit 7a52b570e758a5f607c4071e260065633632c868 Author: Cheng Cui <cc@FreeBSD.org> AuthorDate: 2023-05-30 11:02:45 +0000 Commit: Cheng Cui <cc@FreeBSD.org> CommitDate: 2023-05-30 12:23:36 +0000 siftr: bring back the siftr_pkts_per_log feature Summary: this missing feature is introduced by commit aa61cff4249c Test Plan: verified in Emulab.net Reviewers: rscheff, tuexen Approved by: tuexen (mentor) Subscribers: imp, melifaro, glebius Differential Revision: https://reviews.freebsd.org/D40336 --- sys/netinet/siftr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c index 2c02130bbcca..cbcd2b2ead42 100644 --- a/sys/netinet/siftr.c +++ b/sys/netinet/siftr.c @@ -379,6 +379,22 @@ siftr_process_pkt(struct pkt_node * pkt_node) if (hash_node == NULL) { return; + } else if (siftr_pkts_per_log > 1) { + /* + * Taking the remainder of the counter divided + * by the current value of siftr_pkts_per_log + * and storing that in counter provides a neat + * way to modulate the frequency of log + * messages being written to the log file. + */ + hash_node->counter = (hash_node->counter + 1) % + siftr_pkts_per_log; + /* + * If we have not seen enough packets since the last time + * we wrote a log message for this connection, return. + */ + if (hash_node->counter > 0) + return; } log_buf = alq_getn(siftr_alq, MAX_LOG_MSG_LEN, ALQ_WAITOK);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202305301623.34UGNnaf047524>