Skip to content

darkstat:#29343

Open
ruralroots wants to merge 7 commits into
openwrt:masterfrom
ruralroots:Darkstat
Open

darkstat:#29343
ruralroots wants to merge 7 commits into
openwrt:masterfrom
ruralroots:Darkstat

Conversation

@ruralroots

@ruralroots ruralroots commented May 8, 2026

Copy link
Copy Markdown
Contributor

📦 Package Details

Maintainer: @ruralroots
(You can find this by checking the history of the package Makefile.)

Description:

Bumps darkstat to current upstream release 3.0.722. The original
unix4lyfe.org hosting is no longer available so PKG_SOURCE_URL
has been updated to GitHub.

Fixes missing hosts_keep and ports_max UCI options that were never
passed to the darkstat daemon since the package was added to OpenWrt.

Fixes chroot directory permissions that prevented export, import and
daylog files from being written.

Removes 101-allow-multiple-local-interfaces.patch as this is now
incorporated natively in upstream 3.0.722.

Add Paul Doran as maintainer per invitation in #20979.

Fixes: #20979
Fixes: #26107


🧪 Run Testing Details

  • OpenWrt Version: r34263+5-164428d2d6
  • OpenWrt Target/Subtarget: mediatek/filogic
  • OpenWrt Device: OpenWrt One

✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

If your PR contains a patch:

  • It can be applied using git am
  • it has been refreshed to avoid offsets, fuzzes, etc., using
    make package/<your-package>/refresh V=s
  • It is structured in a way that it is potentially upstreamable
    (e.g., subject line, commit description, etc.)
    We must try to upstream patches to reduce maintenance burden.

@ruralroots
ruralroots force-pushed the Darkstat branch 3 times, most recently from 3424261 to 81c6b78 Compare May 8, 2026 12:14
@ruralroots

Copy link
Copy Markdown
Contributor Author

darkstat does not implement a --version flag and cannot report its
version string to stdout. The version check CI failure is a false
positive. Requesting guidance on the correct override mechanism for
packages without --version support.

@GeorgeSapkin

Copy link
Copy Markdown
Member

You can add test-version.sh with something like:

#!/bin/sh

exit 0

Or do this check per sub-package if it only applies to some.

Comment thread net/darkstat/Makefile Outdated
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://unix4lyfe.org/darkstat
PKG_HASH:=aeaf909585f7f43dc032a75328fdb62114e58405b06a92a13c0d3653236dedd7
PKG_SOURCE:=$(PKG_VERSION).tar.gz

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong. There should be PKG_NAME and PKG_VERSION as it was previously.

Comment thread net/darkstat/Makefile Outdated
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/emikulic/darkstat/archive/refs/tags/
PKG_HASH:=5c8e66d4c478b6d7e58f4c842823a09125509bf6851017ff70e32b32ce95b01b
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this was added? This is already default.

Comment thread net/darkstat/Makefile
Comment on lines +55 to +58
define Build/Configure
( cd $(PKG_BUILD_DIR) && autoreconf -fi )
$(call Build/Configure/Default)
endef

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this now? 🤔

@ruralroots ruralroots May 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review. You are correct on all three points. The
PKG_SOURCE_SUBDIR, PKG_BUILD_DIR, and Build/Configure additions were workarounds for the GitHub raw tag tarball format which lacks a pre-generated configure script. Using the '?' suffix on PKG_SOURCE_URL causes the build system to treat it as a properly named release tarball, making all three workarounds unnecessary. They have been removed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this ( cd $(PKG_BUILD_DIR) && autoreconf -fi )?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies. I did comment on this aspect of your original comment (#29343 (comment)) without context. I re-post it verbatim:
@BKPepe
The ? suffix approach was investigated but darkstat's GitHub releases only provide raw source snapshots without a pre-generated configure script. The autoreconf step is therefore necessary. unix4lyfe.org is no longer hosting releases and no alternative source for a proper release tarball has been found. Requesting guidance on the preferred approach for packages where upstream only provides raw source snapshots via GitHub tags.

@BKPepe
BKPepe requested a review from Copilot May 8, 2026 18:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the OpenWrt darkstat package to the latest upstream release and aligns packaging/runtime behavior with upstream capabilities and OpenWrt UCI options.

Changes:

  • Bump darkstat to 3.0.722 and switch source retrieval to GitHub.
  • Ensure additional UCI options (hosts_keep, ports_max) are passed to the daemon and adjust runtime directory ownership.
  • Remove the now-upstreamed local-interface patch and refresh build steps to regenerate bundled assets.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
net/darkstat/patches/101-allow-multiple-local-interfaces.patch Removes a patch that is now incorporated upstream.
net/darkstat/patches/100-do-not-use-NI_IDN.patch Refreshes patch offsets for the updated upstream source.
net/darkstat/files/darkstat.init Passes additional UCI options and adjusts runtime directory ownership.
net/darkstat/files/darkstat.config Enables export/import/daylog options in the default config.
net/darkstat/Makefile Bumps version/source and adds autoreconf + header generation steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 58 to 65
config_get hosts_max $cfg hosts_max
CONFIGSTR="$CONFIGSTR${hosts_max:+--hosts-max "$hosts_max"} "
config_get hosts_keep $cfg hosts_keep
CONFIGSTR="$CONFIGSTR${hosts_keep:+--hosts-keep "$hosts_keep"} "
config_get ports_max $cfg ports_max
CONFIGSTR="$CONFIGSTR${ports_max:+--ports-max "$ports_max"} "
config_get ports_keep $cfg ports_keep
CONFIGSTR="$CONFIGSTR${ports_keep:+--ports-keep "$ports_keep"} "

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The quoted argument pattern in CONFIGSTR is consistent with the existing script style throughout build_config_string(). The four added lines follow the same convention as hosts_max, highest_port, and other existing options. Changing this pattern would require refactoring the entire function which is beyond the scope of this PR.

Comment thread net/darkstat/files/darkstat.init Outdated
export_bool verbose $cfg "--verbose"
# We need the --no-daemon parameter as with PROCD the process has to run in the background
CONFIGSTR="$CONFIGSTR--no-daemon "
CONFIGSTR="$CONFIGSTR--no-daemon " # run process in background
Comment on lines 31 to 34
set_config_string(){
mkdir -p $RUN_D
chown $USER:$GROUP $RUN_D
. /lib/functions/network.sh
Comment on lines +19 to +21
option export_file 'darkstat_export.log'
option import_file 'darkstat_export.log'
option daylog_file 'darkstat_daylog.log'

@ruralroots ruralroots May 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default RUN_D points to /var/darkstat which is on tmpfs (volatile RAM). Export, import and daylog files written there have no flash wear impact. A user would have to explicitly reconfigure RUN_D to a persistent path to affect flash storage, which is a deliberate choice. Leaving the options uncommented documents the available functionality while maintaining safe defaults.

Comment thread net/darkstat/Makefile
PKG_RELEASE:=7

PKG_MAINTAINER:=Jean-Michel Lacroix <lacroix@lepine-lacroix.info>
PKG_MAINTAINER:=Paul Doran <RuralRoots@gmail.com>
Comment thread net/darkstat/Makefile Outdated
Comment on lines +60 to +64
define Build/Compile
$(HOSTCC) $(PKG_BUILD_DIR)/static/c-ify.c \
-o $(PKG_BUILD_DIR)/c-ify
-o $(PKG_BUILD_DIR)/c-ify
$(HOSTCC) $(PKG_BUILD_DIR)/static/hex-ify.c \
-o $(PKG_BUILD_DIR)/hex-ify
@ruralroots

Copy link
Copy Markdown
Contributor Author

@BKPepe

The ? suffix approach was investigated but darkstat's GitHub releases only provide raw source snapshots without a pre-generated configure script. The autoreconf step is therefore necessary. unix4lyfe.org is no longer hosting releases and no alternative source for a proper release tarball has been found. Requesting guidance on the preferred approach for packages where upstream only provides raw source snapshots via GitHub tags.

@ruralroots
ruralroots force-pushed the Darkstat branch 2 times, most recently from d6ee68b to 4ea96ad Compare May 13, 2026 11:59
@ruralroots
ruralroots requested a review from BKPepe May 13, 2026 23:46
Comment thread net/darkstat/Makefile
Comment thread net/darkstat/Makefile Outdated
Comment on lines +40 to +41
/etc/config/darkstat
/etc/config/darkstat

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that this indeed works? Why do you do it?

@ruralroots ruralroots May 25, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed from spaces to tab for consistency. The conffiles entry works correctly — confirmed by successful build and installation on OpenWrt One r34412+5-35747c66e1. Also, /rom/etc/config/darkstat is populated correctly

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, obviously this is not working. That is why I asked. How did you test this section?

@ruralroots ruralroots May 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I test by syncing my Darkstat branch to my local buildroot via
src-link. Build confirmed on r34654+5-a302626ef4:

darkstat 3.0.722 (using libpcap version 1.10.6 (64-bit time_t, with TPACKET_V3))

However you are correct to question it — I cannot confirm the indented conffiles entry works correctly for backup/restore purposes and it was an erroneous change. It has been reverted to the original unindented form.

Comment thread net/darkstat/Makefile Outdated
@ruralroots

Copy link
Copy Markdown
Contributor Author

Friendly ping @BKPepe, @GeorgeSapkin — all review feedback has been addressed and all CI checks are passing. Happy to make any further changes if needed.

Comment thread net/darkstat/Makefile
Comment on lines +59 to +66
$(HOSTCC) $(HOST_CFLAGS) $(PKG_BUILD_DIR)/static/c-ify.c \
-o $(PKG_BUILD_DIR)/c-ify $(HOST_LDFLAGS)
$(HOSTCC) $(HOST_CFLAGS) $(PKG_BUILD_DIR)/static/hex-ify.c \
-o $(PKG_BUILD_DIR)/hex-ify $(HOST_LDFLAGS)
( cd $(PKG_BUILD_DIR) && \
./c-ify style_css <static/style.css >stylecss.h && \
./c-ify graph_js <static/graph.js >graphjs.h && \
./hex-ify favicon_png <static/favicon.png >favicon.h )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this now?

@ruralroots ruralroots Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Build/Compile block is necessary because darkstat 3.0.721
introduced hex-ify to replace xxd, reducing build dependencies. In a cross-compilation environment the host cannot execute target binaries, so c-ify and hex-ify must be compiled natively using $(HOSTCC) and run on the host before the cross-compiler processes http.c. HOST_CFLAGS and HOST_LDFLAGS were added per CoPilot suggestion to respect host toolchain
hardening settings. If this is not required or follows a different convention in the OpenWrt tree, I am happy to revert it.

@@ -1,6 +1,11 @@
From: Jean-Michel Lacroix <lacroix@lepine-lacroix.info>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@padre-lacroix Any plans to upstream this or letting the upstream know about this issue?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As incoming maintainer I will follow up with upstream regarding this
patch if @padre-lacroix has not already done so.

@ruralroots ruralroots Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As incoming maintainer I will take responsibility for this patch.
The last change to dns.c upstream was approximately 10 years ago and NI_IDN appears to be consistently defined, making upstreaming unlikely to be accepted. The patch will remain as necessary maintenance.

@padre-lacroix

Copy link
Copy Markdown
Contributor

Please just remove me as the maintainer of this package as I am no longe working to maintain any OpenWRT package due to retirement!

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 7 new commits; each commit message matches its diff, so no commit-check issues. One inline issue (test-version.sh location) and one nit noted below.


Generated by Claude Code

@@ -0,0 +1,3 @@
#!/bin/sh

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version-check override is in a location CI won't discover, so it won't take effect. Every test-version.sh in this repo (65 of them, e.g. libs/expat/test-version.sh) sits in the package root, not in a tests/ subdirectory. The only three tests/ subdirs that exist (net/pbr, net/adblock-fast, net/https-dns-proxy) are unrelated run_tests.sh suites, a different mechanism. Placed here at net/darkstat/tests/test-version.sh, the generic version check will still run and fail (darkstat has no --version). Move the file to net/darkstat/test-version.sh.


Generated by Claude Code

Comment thread net/darkstat/Makefile Outdated
define Package/darkstat/description
darkstat is a packet sniffer that runs as a background process on a cable/DSL
router, gathers all sorts of statistics about network usage, and serves them
darkstat is a packet sniffer that runs as a background process on an OpenWrt

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: trailing whitespace at end of this line (after "OpenWrt").

Suggested change
darkstat is a packet sniffer that runs as a background process on an OpenWrt
darkstat is a packet sniffer that runs as a background process on an OpenWrt

Generated by Claude Code

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes since my last review (test-version.sh moved to the package root, and the Makefile trailing-whitespace nit removed) — both correctly address my prior comments. No new issues found.


Generated by Claude Code

Adjust out of box runtime options as default behaviour

Signed-off-by: Paul Doran <RuralRoots@gmail.com>
These four lines were missing since the package was added to OpenWrt,
causing hosts_keep and ports_max UCI options to be silently ignored
and never passed to the darkstat daemon.

Signed-off-by: Paul Doran <RuralRoots@gmail.com>
The chroot directory was created as root:root but darkstat drops privileges
to nobody:nogroup after chroot, preventing writes to export, import and
daylog files. Add chown to set correct ownership before service start

Signed-off-by: Paul Doran <RuralRoots@gmail.com>
Bump to current upstream release 3.0.722 sourced from GitHub as the
original unix4lyfe.org hosting is no longer available. Update
PKG_SOURCE_URL and PKG_SOURCE accordingly.

Replace maintainer with Paul Doran <RuralRoots@gmail.com>
as maintainer per explicit invitation from Jean-Michel Lacroix in
issue openwrt#20979.

Fixes: openwrt#20979
Fixes: openwrt#26107

Signed-off-by: Paul Doran <RuralRoots@gmail.com>
Functionality incorporated natively in upstream 3.0.722. Verified by
building without the patch and running on OpenWrt One r34263+5-164428d2d6
with darkstat operational.

Signed-off-by: Paul Doran <RuralRoots@gmail.com>
Refresh patch to apply cleanly against 3.0.722 with no offsets.

Signed-off-by: Paul Doran <RuralRoots@gmail.com>
darkstat does not implement a --version flag and cannot
report its version string to stdout. Skip the generic
version check accordingly.

Signed-off-by: Paul Doran <RuralRoots@gmail.com>
@openwrt

openwrt Bot commented Jul 22, 2026

Copy link
Copy Markdown

Formality Check: Failed

We completed the verification flow. Please review the formatting overview logs below.

🛑 CRITICAL ERRORS

Commit a6f4da5 - darkstat: bump to 3.0.722, replace maintainer:

  • Makefile line 'darkstat is a packet sniffer that runs as a background process on an OpenWrt' inside 'Package/darkstat/description' must be indented with at least 2 spaces
  • Makefile line 'router. It captures multiple statistics about network usage, and serves them' inside 'Package/darkstat/description' must be indented with at least 2 spaces

Commit 9a7d285 - darkstat: refresh 100-do-not-use-NI_IDN.patch:

  • Embedded patch file 'net/darkstat/patches/100-do-not-use-NI_IDN.patch' violates standard guidelines. Missing required Git header parameters ('From Mon Sep 17 00:00:00 2001' / 'From:' / 'Date:' / 'Subject:') to ensure 'git am' application compatibility

Tip

Do not close this pull request to make corrections. Instead, modify your existing commits (e.g. git commit --amend) and update the branch using git push --force-with-lease --force-if-includes. The checks will re-run automatically.


Something broken? Consider reporting an issue.
Running version f3161d5 deployed on 2026-07-22 02:15:51 CEST

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possibly vulnerable packages overview darkstat new version 3.0.721

6 participants