Skip to content

nlbwmon: enhance init script with logging and health checks - #29709

Open
Mahmudul-009 wants to merge 3 commits into
openwrt:masterfrom
Mahmudul-009:patch-3
Open

nlbwmon: enhance init script with logging and health checks#29709
Mahmudul-009 wants to merge 3 commits into
openwrt:masterfrom
Mahmudul-009:patch-3

Conversation

@Mahmudul-009

Copy link
Copy Markdown

Summary

This PR significantly improves the nlbwmon init script with proper error handling,
comprehensive logging system, performance tuning capabilities, and service health monitoring.

Problem Statement

The current nlbwmon init script has several limitations:

  1. No Logging System

    • Service events are completely invisible to users
    • Troubleshooting and debugging are extremely difficult
    • No way to track when errors occur
  2. No Error Handling

    • Network functions sourcing can fail silently
    • Directory creation failures crash the service without notification
    • No graceful failure mechanism
  3. Code Duplication

    • IPv4 and IPv6 subnet handling code repeated twice (Lines 19-28)
    • Violates DRY (Don't Repeat Yourself) principle
    • Bug fixes must be applied in multiple places
    • Maintenance burden increased significantly
  4. Security Vulnerabilities

    • Unquoted variables: [ $value -eq 1 ] can cause shell injection
    • No resource limits - process can exhaust system resources
    • Potential DoS vulnerability from resource exhaustion
  5. Limited Customization

    • No performance tuning options for different hardware
    • Cannot adjust thread count or memory limits
    • Cannot enable debug logging for troubleshooting
  6. No Service Monitoring

    • No way to check if service is actually running
    • No health status reporting
    • Crashes go undetected

Solutions Implemented

1. Structured Logging System (Lines 11-27)

log_info()   - Information messages to syslog
log_error()  - Error messages to stderr + syslog  
log_warn()   - Warning messages to syslog

Copilot AI review requested due to automatic review settings June 10, 2026 18:01

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.

This PR enhances the nlbwmon init script with additional helper functions, logging, and new runtime/config options, while refactoring some duplicated subnet handling logic.

Changes:

  • Added logging + health-check helper functions and refactored subnet expansion into a shared helper.
  • Added new config-driven options (performance/debug) and introduced directory creation error handling.
  • Added procd resource limits and attempted to improve interface trigger formatting.

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

Comment thread net/nlbwmon/files/nlbwmon.init Outdated
Comment thread net/nlbwmon/files/nlbwmon.init Outdated
Comment thread net/nlbwmon/files/nlbwmon.init Outdated
Comment thread net/nlbwmon/files/nlbwmon.init Outdated
Comment thread net/nlbwmon/files/nlbwmon.init Outdated
# ============================================
# [NEW] Logging Functions
# ============================================
log_info() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could collapse functions into one, 1st optional parameter log level, 2nd escapes string of message

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good suggestion. I'll refactor this into a single function with log level and message as parameters. Thanks!

@sppmasterspp

sppmasterspp commented Jun 27, 2026

Copy link
Copy Markdown

Any progress with this PR? Ready to test yet?

@openwrt

openwrt Bot commented Jun 30, 2026

Copy link
Copy Markdown

Formality Check: Failed

We checked this pull request against the contribution guidelines. Here is what needs your attention:

🛑 CRITICAL ERRORS

Commit 5332e70 - Enhance nlbwmon with logging, health checks, and options:

  • Commit subject must start with <package name or prefix>:

Commit 85e2d43 - Refactor logging functions and improve error handling:

  • Commit subject must start with <package name or prefix>:
  • Line 3 in commit body exceeds max width (156/100 chars)

Commit e218ea5 - Merge branch 'master' into patch-3:

  • Merge commits are not allowed within the pull request
  • Commit subject must start with <package name or prefix>:
  • Commit description body is empty or contains only trailers (e.g. Signed-off-by). Please provide a meaningful description of what this change does and why
  • Missing 'Signed-off-by:' line. Please add a line at the end of the commit message in the format 'Signed-off-by: Your Name your@email.com', matching your commit author or committer identity.

Commit e218ea5 - Merge branch 'master' into patch-3:

  • Makefile introduces PKG_VERSION '1.14.6', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.14.6'.
  • Makefile introduces PKG_VERSION '2.1.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.1.2'.
  • Makefile introduces PKG_VERSION '2026.7.4', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2026.7.4'.
  • Makefile introduces PKG_VERSION '0.107.78', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.107.78'.
  • Makefile introduces PKG_VERSION '2026.27', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2026.27'.
  • Makefile introduces PKG_VERSION '7.1.0.2026070800', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 7.1.0.2026070800'.
  • Makefile introduces PKG_VERSION '3.53.3', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.53.3'.
  • Makefile introduces PKG_VERSION '1.3.6', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.3.6'.
  • Makefile introduces PKG_VERSION '2.2.5', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.2.5'.
  • Makefile introduces PKG_VERSION '29.6.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 29.6.1'.
  • Makefile introduces PKG_VERSION '29.6.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 29.6.1'.
  • Makefile introduces PKG_VERSION '7.0.28', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 7.0.28'.
  • Makefile introduces PKG_VERSION '8.2606.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 8.2606.0'.
  • Makefile introduces PKG_VERSION '2026.05.06', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2026.05.06'.
  • Makefile introduces PKG_VERSION '0.14.12', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.14.12'.
  • Makefile introduces PKG_VERSION '1.39.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.39.2'.
  • Makefile introduces PKG_VERSION '3.7.7', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.7.7'.
  • Makefile introduces PKG_VERSION '9.07.2907', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 9.07.2907'.
  • Makefile introduces PKG_VERSION '4.18.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 4.18.0'.
  • Makefile introduces PKG_VERSION '1.9.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.9.2'.
  • Makefile introduces PKG_VERSION '3.5.6', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.5.6'.
  • Makefile introduces PKG_VERSION '2.16.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.16.0'.
  • Makefile introduces PKG_VERSION '3.2.10', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.2.10'.
  • Makefile introduces PKG_VERSION '9.20.26', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 9.20.26'.
  • Makefile introduces PKG_VERSION '1.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.1'.
  • Makefile introduces PKG_VERSION '5.51.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 5.51.2'.
  • Makefile introduces PKG_VERSION '2026.7.3', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2026.7.3'.
  • Makefile introduces PKG_VERSION '8.0.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 8.0.0'.
  • Makefile introduces PKG_VERSION '3.4.9', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.4.9'.
  • Makefile introduces PKG_VERSION '3.18', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.18'.
  • Makefile introduces PKG_VERSION '2026.7.22', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2026.7.22'.
  • Makefile introduces PKG_VERSION '4.1.4', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 4.1.4'.
  • Makefile introduces PKG_VERSION '1.9.8', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.9.8'.
  • Makefile introduces PKG_VERSION '1.18.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.18.0'.
  • Makefile introduces PKG_VERSION '1.25.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.25.0'.
  • Makefile introduces PKG_VERSION '2.15.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.15.1'.
  • Makefile introduces PKG_VERSION '3.53.4', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.53.4'.
  • Makefile introduces PKG_VERSION '2.3.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.3.1'.
  • Makefile introduces PKG_VERSION '2.12.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.12.0'.
  • Makefile introduces PKG_VERSION '1.0.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.0.0'.
  • Makefile introduces PKG_VERSION '1.2.5', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.2.5'.
  • Makefile introduces PKG_VERSION '0.3.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.3.2'.
  • Makefile introduces PKG_VERSION '0.12.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.12.1'.
  • Makefile introduces PKG_VERSION '1.11.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.11.0'.
  • Makefile introduces PKG_VERSION '2.15.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.15.2'.
  • Makefile introduces PKG_VERSION '2.15.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.15.1'.
  • Makefile introduces PKG_VERSION '1.25.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.25.2'.
  • Makefile introduces PKG_VERSION '0.3.34', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.3.34'.
  • Makefile introduces PKG_VERSION '3.2.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.2.0'.
  • Makefile introduces PKG_VERSION '0.409', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.409'.
  • Makefile introduces PKG_VERSION '13.0.6', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 13.0.6'.
  • Makefile introduces PKG_VERSION '4.1.3', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 4.1.3'.
  • Makefile introduces PKG_VERSION '1.8.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.8.2'.
  • Makefile introduces PKG_VERSION '704', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 704'.
  • Makefile introduces PKG_VERSION '1.2.16.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.2.16.1'.
  • Makefile introduces PKG_VERSION '2.1.18', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.1.18'.
  • Makefile introduces PKG_VERSION '7.7', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 7.7'.
  • Makefile introduces PKG_VERSION '28', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 28'.
  • Makefile introduces PKG_VERSION '0.3.29', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.3.29'.
  • Makefile introduces PKG_VERSION '2.1.7', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.1.7'.
  • Makefile introduces PKG_VERSION '1.70.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.70.0'.
  • Makefile introduces PKG_VERSION '22.23.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 22.23.2'.
  • Makefile introduces PKG_VERSION '4.5.7', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 4.5.7'.
  • Makefile introduces PKG_VERSION '9.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 9.2'.
  • Makefile introduces PKG_VERSION '2.8.7', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.8.7'.
  • Makefile introduces PKG_VERSION '2.4.7', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.4.7'.
  • Makefile introduces PKG_VERSION '1.8.11', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.8.11'.
  • Makefile introduces PKG_VERSION '2026.08.06', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2026.08.06'.
  • Makefile introduces PKG_VERSION '7.1.2.29', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 7.1.2.29'.
  • Makefile introduces PKG_VERSION '1.3.48', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.3.48'.
  • Makefile introduces PKG_VERSION '2.17.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.17.0'.
  • Makefile introduces PKG_VERSION '2.13.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.13.0'.
  • Makefile introduces PKG_VERSION '2.13.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.13.0'.
  • Makefile introduces PKG_VERSION '1.44', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.44'.
  • Makefile introduces PKG_VERSION '0.36', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.36'.
  • Makefile introduces PKG_VERSION '1.102.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.102.2'.
  • Makefile introduces PKG_VERSION '3.7.8', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.7.8'.
  • Makefile introduces PKG_VERSION '7.0.29', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 7.0.29'.
  • Makefile introduces PKG_VERSION '4.14.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 4.14.2'.
  • Makefile introduces PKG_VERSION '3.7.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.7.2'.
  • Makefile introduces PKG_VERSION '26.3', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 26.3'.
  • Makefile introduces PKG_VERSION '4.0.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 4.0.2'.
  • Makefile introduces PKG_VERSION '1.31.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.31.0'.
  • Makefile introduces PKG_VERSION '10.2.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 10.2.1'.
  • Makefile introduces PKG_VERSION '3.1.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.1.0'.
  • Makefile introduces PKG_VERSION '7.35.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 7.35.1'.
  • Makefile introduces PKG_VERSION '2026.6.3', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2026.6.3'.
  • Makefile introduces PKG_VERSION '1.4.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.4.1'.
  • Makefile introduces PKG_VERSION '84.0.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 84.0.0'.
  • Makefile introduces PKG_VERSION '1.13.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.13.0'.
  • Makefile introduces PKG_VERSION '2.2.4', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.2.4'.
  • Makefile introduces PKG_VERSION '4.24.5', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 4.24.5'.
  • Makefile introduces PKG_VERSION '2.1.3', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.1.3'.
  • Makefile introduces PKG_VERSION '3.12.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.12.1'.
  • Makefile introduces PKG_VERSION '6.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 6.1'.
  • Makefile introduces PKG_VERSION '3.18.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.18.0'.
  • Makefile introduces PKG_VERSION '0.95.3', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.95.3'.
  • Makefile introduces PKG_VERSION '2.3.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.3.1'.
  • Makefile introduces PKG_VERSION '1.2.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.2.1'.
  • Makefile introduces PKG_VERSION '0.41.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.41.1'.
  • Makefile introduces PKG_VERSION '1.43.67', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.43.67'.
  • Makefile introduces PKG_VERSION '1.43.67', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.43.67'.
  • Makefile introduces PKG_VERSION '0.19.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.19.2'.
  • Makefile introduces PKG_VERSION '8.8.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 8.8.0'.
  • Makefile introduces PKG_VERSION '1.39.3', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.39.3'.
  • Makefile introduces PKG_VERSION '7.1.0.2026080300', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 7.1.0.2026080300'.
  • Makefile introduces PKG_VERSION '2.7.6', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.7.6'.
  • Makefile introduces PKG_VERSION '2.0.0.1584', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.0.0.1584'.
  • Makefile introduces PKG_VERSION '3.12.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.12.0'.
  • Makefile introduces PKG_VERSION '1.4.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.4.1'.
  • Makefile introduces PKG_VERSION '4.3.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 4.3.1'.
  • Makefile introduces PKG_VERSION '4.11.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 4.11.1'.
  • Makefile introduces PKG_VERSION '1.6.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.6.0'.
  • Makefile introduces PKG_VERSION '0.52.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.52.1'.
  • Makefile introduces PKG_VERSION '5.16.4', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 5.16.4'.
  • Makefile introduces PKG_VERSION '9.1.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 9.1.1'.
  • Makefile introduces PKG_VERSION '1.7.5', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.7.5'.
  • Makefile introduces PKG_VERSION '26.2.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 26.2.1'.
  • Makefile introduces PKG_VERSION '1.46.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.46.0'.
  • Makefile introduces PKG_VERSION '1.4.4', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.4.4'.
  • Makefile introduces PKG_VERSION '8.4.2', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 8.4.2'.
  • Makefile introduces PKG_VERSION '2.1.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 2.1.1'.
  • Makefile introduces PKG_VERSION '3.2.9', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.2.9'.
  • Makefile introduces PKG_VERSION '3.5.4', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 3.5.4'.
  • Makefile introduces PKG_VERSION '1.27.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.27.1'.
  • Makefile introduces PKG_VERSION '0.70.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.70.1'.
  • Makefile introduces PKG_VERSION '0.410', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.410'.
  • Makefile introduces PKG_VERSION '0.6.4', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.6.4'.
  • Makefile introduces PKG_VERSION '4.16.0', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 4.16.0'.
  • Makefile introduces PKG_VERSION '1.0.13', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.0.13'.
  • Makefile introduces PKG_VERSION '1.13.18', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 1.13.18'.
  • Makefile introduces PKG_VERSION '0.1.1', but this version string is missing in the commit subject line. Please mention the new version in the subject, e.g. ': update to 0.1.1'.

Commit e218ea5 - Merge branch 'master' into patch-3:

  • Embedded patch file 'net/unbound/patches/010-configure-uname.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

⚠️ STYLISTIC WARNINGS & SUGGESTIONS

Commit e218ea5 - Merge branch 'master' into patch-3:
PKG_LICENSE value 'NPSL-0.95' is not a known SPDX identifier. Pick the matching identifier from https://spdx.org/licenses/, or write it as LicenseRef-<name> if this license is not on the SPDX list.

Package Release Audit:

  • ⚠️ Content changed in these packages, but without a PKG_RELEASE or version bump:

    • net/nlbwmon

    Increment PKG_RELEASE by 1 (or bump PKG_VERSION/PKG_SOURCE_DATE and reset PKG_RELEASE to 1) so users receive the update.

Do not increment release for minor changes. Cosmetic edits (e.g., typos in comments, copyright updates, formatting/whitespace), changing the package maintainer (PKG_MAINTAINER), or updating source download info (PKG_SOURCE_URL / PKG_HASH) do not require incrementing PKG_RELEASE.

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 0e15d1c deployed on 2026-08-12 22:36:32 CEST

@Mahmudul-009 Mahmudul-009 changed the title nlbwmon: Enhance init script with error handling, logging, and resource management nlbwmon: enhance init script with logging and health checks Jun 30, 2026
@Mahmudul-009
Mahmudul-009 requested review from brada4 and Copilot June 30, 2026 18:04

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Mahmudul-009
Mahmudul-009 requested a review from Copilot June 30, 2026 18:05

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Mahmudul-009
Mahmudul-009 requested a review from Copilot June 30, 2026 18:05

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Mahmudul-009
Mahmudul-009 requested a review from Copilot June 30, 2026 18:05

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Mahmudul-009
Mahmudul-009 requested a review from Copilot June 30, 2026 18:05

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@brada4 brada4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, no impact on past config. Adds some safety barriers against runaway process.
Try to collapse commits into one as it is commonplace here.

@Mahmudul-009
Mahmudul-009 requested a review from Copilot June 30, 2026 18:17

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Mahmudul-009

Copy link
Copy Markdown
Author

Looks good, no impact on past config. Adds some safety barriers against runaway process. Try to collapse commits into one as it is commonplace here.

Thanks for the approval! Since I am using the GitHub web interface and don't have a local Git setup ready right now, could you please squash the commits into one during the merge? I'd really appreciate it!

@brada4

brada4 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Repo owners can.

@Mahmudul-009

Copy link
Copy Markdown
Author

Repo owners can.

okey bro

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment on lines +13 to +29
log_msg() {
local level="${1:-INFO}"
shift
local msg="$*"

case "$level" in
ERROR)
echo "[nlbwmon] ERROR: $msg" | logger -t nlbwmon -p user.err >&2
;;
WARN)
echo "[nlbwmon] WARN: $msg" | logger -t nlbwmon -p user.warn
;;
*)
echo "[nlbwmon] INFO: $msg" | logger -t nlbwmon -p user.info
;;
esac
}
Comment on lines +185 to 189
# [FIXED] Proper conditional block formatting without broken hyperlink syntax
if [ -n "$interface" ] && [ "$ignore" -eq 0 ]; then
procd_add_interface_trigger "interface.*" "$interface"
fi
}
Comment on lines +34 to +38
health_check() {
local pidfile="/var/run/nlbwmon.pid"

if [ -f "$pidfile" ]; then
local pid=$(cat "$pidfile")
Comment on lines +109 to +113
config_get thread_count "$cfg" thread_count ""
config_get memory_limit "$cfg" memory_limit ""

[ -n "$thread_count" ] && procd_append_param command '--threads' "$thread_count"
[ -n "$memory_limit" ] && procd_append_param command '--memory-limit' "$memory_limit"
@Mahmudul-009 Mahmudul-009 reopened this Jul 1, 2026
Line Range	Component	What Changed	Why	Benefit
11-27	Logging Functions	NEW	No logging existed	Debug-friendly, monitoring-capable
29-40	Health Check	NEW	No status check	Service monitoring, health verification
42-56	add_subnet()	Refactored	Called helper function	Eliminated duplication, cleaner code
58-76	_process_subnets()	NEW	Code deduplication	Single source of truth, maintainable
81-93	add_bool()	FIXED	Variable quoting & default	Security fix, shell injection prevention
95-108	add_performance_options()	NEW	No tuning options	Hardware optimization, flexibility
110-121	add_debug_mode()	NEW	No debug capability	Troubleshooting support
123-162	parse_config()	Enhanced	Error handling	Graceful failure, clear errors
164-178	start_service()	Enhanced	Resource limits + logging	System protection, visibility
180-187	add_interface_trigger()	Improved	Better quoting & formatting	Safety, readability
189-198	status_service()	NEW	No status command	Service monitoring
200-205	stop_service()	NEW	No stop logging	Audit trail, lifecycle tracking

Signed-off-by: Mahmudul Hasan  <md.mahmudul2022@gmail.com>
Refactored logging functions into a single unified function for better maintainability. Updated various sections for improved error handling and formatting.

Signed-off-by: Mahmudul Hasan  <md.mahmudul2022@gmail.com>
@BKPepe

BKPepe commented Jul 15, 2026

Copy link
Copy Markdown
Member

The checks/formalities are still failing here and need to be looked at, otherwise I will close this pull request.

@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.

Commit checks

  • 5332e70 "Enhance nlbwmon with logging, health checks, and options" — the commit message table claims status_service() (rows "189-198") and stop_service() (rows "200-205") were added, but neither function exists in this commit or the final tree. The message also does not mention that service_triggers() was removed, which is the most consequential change in the diff. Please align the message with the actual changes (and note that the tab-separated table is not a usable commit-message format — a nlbwmon: subject prefix plus a prose body is expected).
  • 85e2d43 "Refactor logging functions and improve error handling" — matches the diff (merges the separate log_info/log_warn/log_error helpers into a single log_msg).

Generated by Claude Code

Comment thread net/nlbwmon/files/nlbwmon.init
[ -n "$interface" -a $ignore -eq 0 ] && procd_add_interface_trigger "interface.*" "$interface" /etc/init.d/nlbwmon reload
# [FIXED] Proper conditional block formatting without broken hyperlink syntax
if [ -n "$interface" ] && [ "$ignore" -eq 0 ]; then
procd_add_interface_trigger "interface.*" "$interface"

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.

The /etc/init.d/nlbwmon reload command argument was dropped from this call. The signature is procd_add_interface_trigger <name> <interface> <command...>; without the command the trigger fires but runs nothing, so interface changes never trigger a reload. Restore the action:

Suggested change
procd_add_interface_trigger "interface.*" "$interface"
procd_add_interface_trigger "interface.*" "$interface" /etc/init.d/nlbwmon reload

Generated by Claude Code

config_get thread_count "$cfg" thread_count ""
config_get memory_limit "$cfg" memory_limit ""

[ -n "$thread_count" ] && procd_append_param command '--threads' "$thread_count"

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.

nlbwmon does not accept these long options. Its argument parser is short-option only — getopt(argc, argv, "b:i:r:s:o:p:G:I:L:PZ") (no getopt_long), see https://github.com/jow-/nlbwmon/blob/29236be687927b0c81ee6e2642e7caa8787c4ad3/nlbwmon.c#L218 . Passing --threads/--memory-limit here (and --debug at line 124) will not enable any feature; getopt stops at the first --, so the values are treated as stray non-option args rather than tuning. nlbwmon is also single-threaded, so there is no thread-count knob to expose. Please drop add_performance_options/add_debug_mode unless you can point to the flags in nlbwmon's option table.


Generated by Claude Code

# ============================================
# [NEW] Health Check Function
# ============================================
health_check() {

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.

health_check() is defined but never called anywhere in the script, so it is dead code. If it is meant to back a status/health command, wire it into a status_service(); otherwise remove it.


Generated by Claude Code

@openwrt

openwrt Bot commented Jul 31, 2026

Copy link
Copy Markdown

This PR is stale because it has been inactive for 14 days and has the "not following guidelines" label.
It will be closed if no further activity occurs within 14 days.

@openwrt openwrt Bot added the stale label Jul 31, 2026

@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 1 new commit since 85e2d43.

e218ea5 is a clean merge of master into the branch — it does not touch net/nlbwmon/, and git diff 9587521..e218ea5 is still just the single 106/-25 change to nlbwmon.init, so nothing was smuggled in by the merge. net/nlbwmon/files/nlbwmon.init is byte-identical to the state reviewed at 85e2d43, which means the findings from that review still apply unchanged (bogus --threads/--memory-limit/--debug flags, the dropped /etc/init.d/nlbwmon reload action, the unused health_check()). Only the service_triggers() regression is re-raised inline, because its thread was resolved without the code changing.


Generated by Claude Code

if [ -n "$interface" ] && [ "$ignore" -eq 0 ]; then
procd_add_interface_trigger "interface.*" "$interface"
fi
}

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.

Re-raising because the thread for this was marked resolved without a corresponding code change: service_triggers() is still deleted here, and it is the only entry point procd has for registering triggers — _procd_close_service() calls it unconditionally between _procd_open_trigger/_procd_close_trigger (procd.sh:98-102). With the function gone, the stub in rc.common runs instead and no triggers are registered, so two behaviours are lost:

  • procd_add_reload_trigger "dhcp" "system" "nlbwmon" — the service no longer reloads on dhcp/system/network config changes.
  • config_foreach add_interface_trigger dhcp — which makes add_interface_trigger() above dead code that is never called.

Restoring the function at the end of the file fixes both:

Suggested change
}
}
service_triggers() {
procd_add_reload_trigger "dhcp" "system" "nlbwmon"
config_load dhcp
config_foreach add_interface_trigger dhcp
}

Generated by Claude Code

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.

6 participants