The module seems to ignore the value of "packets" in "settemplate". It is NetFlow_v9 specific setting. To reproduce configure the export9 node with: msg netflow: settemplate { time=43200 packets=10 } and wait for the template to be transmitted. Most likely the logic of "sent_packets" is not fully operational and re-announcements of the template are done only on a time basis. This is only a mild flaw since periodic re-announcements of the template work fine.
Unfortunately, the removal of code doing re-announcements on the basis of packet counter, according to RFC 3954, is forbidden[1], so maybe our respectable programmers can fix it. [1] 3. On a regular basis, the Exporter MUST send all the Template Records and Options Template Records to refresh the Collector. Template IDs have a limited lifetime at the Collector and MUST be periodically refreshed. Two approaches are taken to make sure that Templates get refreshed at the Collector: * Every N number of Export Packets. * On a time basis, so every N number of minutes. Both options MUST be configurable by the user on the Exporter. When one of these expiry conditions is met, the Exporter MUST send the Template FlowSet and Options Template.
Created attachment 267199 [details] [PATCH] ng_netflow v9: fix template re-announcement using packet This patch fixes the issue for me.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=d836dae9f0d888d441234ea11e3cd91614c86aa2 commit d836dae9f0d888d441234ea11e3cd91614c86aa2 Author: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl> AuthorDate: 2026-01-16 10:12:11 +0000 Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> CommitDate: 2026-01-16 18:36:53 +0000 ng_netflow v9: fix template re-announcement using packet count Increment fe->sent_packets after export9_send(). Previously, NetFlow v9 templates were only re-announced based on time, ignoring the packet count parameter (`templ_packets`). PR: 270083 Reviewed by: glebius pouria Approved by: glebius (mentor) MFC after: 1 week Sponsored by: Subcarpathian BSD User Group sys/netgraph/netflow/netflow_v9.c | 1 + 1 file changed, 1 insertion(+)
Thank you for the report and patch.
Pouria, can you please MFC this fix to stable/14 and stable/15 ? MFC to stable/13 is also possible, but probably pointless.
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f51e0f5e69cf9e3806d64b3ce85d70aca63d922b commit f51e0f5e69cf9e3806d64b3ce85d70aca63d922b Author: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl> AuthorDate: 2026-01-16 10:12:11 +0000 Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> CommitDate: 2026-01-24 09:09:02 +0000 ng_netflow v9: fix template re-announcement using packet count Increment fe->sent_packets after export9_send(). Previously, NetFlow v9 templates were only re-announced based on time, ignoring the packet count parameter (`templ_packets`). PR: 270083 Reviewed by: glebius pouria Approved by: glebius (mentor) MFC after: 1 week Sponsored by: Subcarpathian BSD User Group (cherry picked from commit d836dae9f0d888d441234ea11e3cd91614c86aa2) sys/netgraph/netflow/netflow_v9.c | 1 + 1 file changed, 1 insertion(+)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=40c0d6735538a1557a9b53306dd70aa2fc8ae7d1 commit 40c0d6735538a1557a9b53306dd70aa2fc8ae7d1 Author: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl> AuthorDate: 2026-01-16 10:12:11 +0000 Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> CommitDate: 2026-01-24 09:23:28 +0000 ng_netflow v9: fix template re-announcement using packet count Increment fe->sent_packets after export9_send(). Previously, NetFlow v9 templates were only re-announced based on time, ignoring the packet count parameter (`templ_packets`). PR: 270083 Reviewed by: glebius pouria Approved by: glebius (mentor) MFC after: 1 week Sponsored by: Subcarpathian BSD User Group (cherry picked from commit d836dae9f0d888d441234ea11e3cd91614c86aa2) sys/netgraph/netflow/netflow_v9.c | 1 + 1 file changed, 1 insertion(+)
Thank you for the MFCs ! Now this bug is fixed in all supported FreeBSD versions, at least in versions that will have future releases.