Skip to content

fix: dynamic VLAN bridge discovery for QoS (detects all br-* interfaces) - #21

Merged
wickedyoda merged 2 commits into
masterfrom
fix/remove-install-from-checksums
Sep 11, 2026
Merged

wickedyoda merged 2 commits into
masterfrom
fix/remove-install-from-checksums

Conversation

@wickedyoda

Copy link
Copy Markdown
Owner

Problem

The QOS mode was hardcoded to only detect br-lan, br-iot, br-guest, and tailscale0.
On routers with 5+ VLANs (e.g., br-vlan2, br-vlan3, etc.), the missing bridges were
not detected or shaped.

Fix

  • discover_bridges() now enumerates all /sys/class/net/br-* interfaces dynamically
  • stop_qos(), setup_nft(), apply_wan_rooted_qos() all iterate dynamically
  • get_bw_config() reads per-bridge bandwidth/priority from config (QOS_BW*, QOS_PRIO_)
  • Setup wizard's select_priority() lists all discovered bridges
  • write_config() generates config for all discovered bridges + tailscale0
  • Added detect_vlans command to list detected interfaces
  • Fixed self-invoking install() function (use command install)
  • Fixed SC2045: replaced ls iteration with glob patterns

Backward compatibility

Config files with QOS_LAN_BW_UP/QOS_IOT_BW_UP/QOS_GUEST_BW_UP/QOS_TAILSCALE_BW_UP
still work via load_config() defaults. New config files use QOS_BW* based on
the actual bridge name (e.g., QOS_VLAN2_BW_UP).

The QOS mode was only detecting br-lan, br-iot, br-guest, and tailscale0.
On routers with 5+ VLANs, the missing bridges were silently ignored.

Changes:
- discover_bridges() now enumerates all /sys/class/net/br-* interfaces
- stop_qos(), setup_nft(), apply_wan_rooted_qos() all iterate dynamically
- get_bw_config() reads QOS_<NAME>_BW_* and QOS_PRIO_<NAME> from config
- select_priority() in setup wizard lists all discovered bridges
- write_config() generates bandwidth config for all discovered bridges
- Added detect_vlans command to list detected interfaces
- Fixed self-invoking install() function (command install)
- Fixed SC2045: replaced ls iteration with glob patterns
Copilot AI lite review requested due to automatic review settings September 11, 2026 20:26

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.

🟡 Changes recommended

Critical runtime, setup, qdisc, class-ID, and installation issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates QoS to dynamically discover and configure all br-* VLAN bridges.

Changes:

  • Adds dynamic bridge discovery and per-bridge QoS configuration.
  • Updates runtime and setup flows for discovered bridges.
  • Adds VLAN detection and fixes installation/configuration handling.
File summaries
File Summary Findings
glinet-vlan-qos.sh Runtime discovery, QoS setup, cleanup, and installation Critical: Fix invalid dynamic class IDs and the missing 1:10 default class (3 votes); apply the same correction to tailscale (2 votes). Critical: Avoid generating invalid 3:: qdisc handles (3 votes), sanitize bridge names before variable expansion (3 votes), and correct installer source handling (1 vote).
glinet-vlan-qos-setup.sh Dynamic bridge priority selection and configuration generation Critical: Sanitize dynamic bridge names before eval assignments (3 votes). Moderate: Preserve the documented skip option instead of emitting the bridge configuration (1 vote).
Review details

Suppressed comments (1)

glinet-vlan-qos-setup.sh:219

  • Entering 0 is documented by the prompt as “skip”, but this condition immediately converts prio=skip into the default priority and write_config still emits the bridge. The selected bridge is therefore still shaped rather than skipped; preserve an explicit skip through config generation and runtime class creation, or remove the skip option from the prompt.
      [ -z "$prio" ] || [ "$prio" = "skip" ] && {
  • Files reviewed: 2/2 changed files
  • Comments generated: 6
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread glinet-vlan-qos-setup.sh
IOT) PRIOR_IOT=$pri ;;
GUEST) PRIOR_GUEST=$pri ;;
TAILSCALE) PRIOR_TAILSCALE=$pri ;;
*) eval "PRIOR_${config_name}=${pri}" ;;
Comment thread glinet-vlan-qos.sh
Comment on lines +189 to +193
br-*) config_name=$(echo "$br" | sed 's/br-//' | tr '[:lower:]' '[:upper:]') ;;
*) config_name=$(echo "$br" | tr '[:lower:]' '[:upper:]') ;;
esac

eval "up_bw=\${QOS_${config_name}_BW_UP:-}"
Comment thread glinet-vlan-qos.sh
Comment on lines +240 to +241
local classid="1:$(printf '%x' $((10 + idx * 10)))"
local classid_dec=$((10 + idx * 10))
Comment thread glinet-vlan-qos.sh
Comment on lines +255 to +256
local classid="1:$(printf '%x' $((10 + idx * 10)))"
local classid_dec=$((10 + idx * 10))
Comment thread glinet-vlan-qos.sh
bw_data=$(get_bw_config "$br")
up_bw=$(echo "$bw_data" | awk '{print $1}')
bridge_handle=$((2 + idx))
add_qdisc_htb "$br" "${bridge_handle}:" 10
Comment thread glinet-vlan-qos.sh
}
install() {
install -m 0755 "$MAIN_SCRIPT" /usr/local/sbin/glinet-vlan-qos.sh
command install -m 0755 "$MAIN_SCRIPT" /usr/local/sbin/glinet-vlan-qos.sh
@wickedyoda
wickedyoda merged commit d1697e7 into master Sep 11, 2026
2 checks passed
@wickedyoda
wickedyoda deleted the fix/remove-install-from-checksums branch September 11, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants