Repository navigation
fix: dynamic VLAN bridge discovery for QoS (detects all br-* interfaces) - #21
Merged
Merged
Conversation
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
There was a problem hiding this comment.
🟡 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
0is documented by the prompt as “skip”, but this condition immediately convertsprio=skipinto the default priority andwrite_configstill 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.
| IOT) PRIOR_IOT=$pri ;; | ||
| GUEST) PRIOR_GUEST=$pri ;; | ||
| TAILSCALE) PRIOR_TAILSCALE=$pri ;; | ||
| *) eval "PRIOR_${config_name}=${pri}" ;; |
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 on lines
+240
to
+241
| local classid="1:$(printf '%x' $((10 + idx * 10)))" | ||
| local classid_dec=$((10 + idx * 10)) |
Comment on lines
+255
to
+256
| local classid="1:$(printf '%x' $((10 + idx * 10)))" | ||
| local classid_dec=$((10 + idx * 10)) |
| 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 |
| } | ||
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 dynamicallystop_qos(),setup_nft(),apply_wan_rooted_qos()all iterate dynamicallyget_bw_config()reads per-bridge bandwidth/priority from config (QOS_BW*, QOS_PRIO_)select_priority()lists all discovered bridgeswrite_config()generates config for all discovered bridges + tailscale0detect_vlanscommand to list detected interfacesinstall()function (usecommand install)lsiteration with glob patternsBackward 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).