r80xcore
Regular Contributor
I will take a deeper look on the install/uninstall and the templates tomorrow. Today i had to fix some other issues reported with the core script "mervlan_manager.sh"
version 0.47 of the mervlan_manager.sh is up.This should hopefully cure any problems with JSON -> SSID -> brX parsing that has been reported. Probable cause was that the name was not normalized. Added more safety features to make sure the VLANS are added safely and correctly.
JSON & parsing
version 0.47 of the mervlan_manager.sh is up.This should hopefully cure any problems with JSON -> SSID -> brX parsing that has been reported. Probable cause was that the name was not normalized. Added more safety features to make sure the VLANS are added safely and correctly.
JSON & parsing
- BusyBox-safe key escaping: esc_key() to escape [].^$* before sed patterns.
- Robust scalar read: read_json() pulls either a quoted string or a bare number, trims whitespace.
- Numeric read helper: read_json_number() (digit-only).
- Array read helper: read_json_array() flattens ["eth4","eth5"] → eth4 eth5.
- Whitespace/UTF cleanup: normalize_basic() strips BOM, CR, zero-width chars, trims.
- Consistent iface/SSID normalization: normalize_iface() / normalize_ssid() unify hyphens/quotes (—/–→-, smart quotes → ascii).
- Case-insensitive SSID matching with safeguards: exact match first; if not, lowercase fallback; logs ambiguity if multiple matches.
- Band-agnostic lookup: find_if_by_ssid_any() scans all *_ssid nvram entries and maps to ifnames.
- VLAN input guard: validate_vlan_id() accepts none/trunk or 2–4094; hard-rejects 1.
- Internal VAP filter: is_internal_vap() skips wl*.4–9.
- Existence checks: iface_exists() + wait_for_interface() with exponential backoff.
- Idempotent bring-up: ensure_vlan_bridge() creates ${WAN_IF}.VID and brVID, brings them up, stp off, setfd 0.
- Accurate membership test: member_of_bridge() uses sysfs first, brctl AWK fallback that handles continuation lines.
- Attach-verify-retry: After brctl addif, we verify membership; if not present, sleep, retry once, then queue for watchdog.
- Staging log gating: WATCHDOG_QUEUE_LOG controls whether queue_watch() emits
- Clean teardown: cleanup_existing_config() detaches ports, deletes br[1+], and removes ${WAN_IF}.* VLAN links.
- Change audit trail: track_change() writes human-readable deltas to a per-run file under $CHANGES.
