fix: routing ip rule missing after reboot, busybox compat, skill restructure

Routing fixes (2026-07-14):
- Add missing ip rule 'from 10.11.13.0/24 lookup 100' to hotplug ifup case
- Add UCI network rule persistence so netifd restores it on boot
- Verify ip rule exists in zt-gateway-switch do_force/do_graceful
- Fix BRIDGE_PORTS auto-detect: use /proc/net/dev instead of broken
  awk-over-ip pipeline (busybox awk mishandles exit in compound if)
- Validate bridge port candidate exists as network interface
- Fix setup-routing: use dev br-zt not dev ztX (ZT iface has no IP
  when enslaved to bridge, causing 'Nexthop has invalid gateway')
- Replace ip rule replace (GNU-only) with del+add for busybox

Infrastructure:
- Fix deploy:install stdin starvation: ssh/scp consume pipe data in
  find|while loop; add </dev/null to prevent truncation
- Move luci-dev skill from root/ to skills/ with .agents/skills/ symlink
- Add policy routing and busybox gotcha sections to SKILL.md
- Add diagnostics doc for the routing fix session
This commit is contained in:
2026-07-14 18:01:30 +05:30
parent 10081b33e2
commit 581d625044
9 changed files with 294 additions and 15 deletions

View File

@@ -199,6 +199,10 @@ do_force() {
preflight_ping "$new_ip" || die 2 "gateway ${new_ip} is unreachable over ${PING_IFACE}"
# Ensure WIBLAN traffic uses the policy table (may be missing after reboot)
ip rule del from "$WIBLAN_CIDR" table "$TABLE_MAIN" priority 100 2>/dev/null || true
ip rule add from "$WIBLAN_CIDR" table "$TABLE_MAIN" priority 100
set_host_route "$new_ip"
set_table_default "$new_ip" "$TABLE_MAIN"
ensure_mwan_return
@@ -249,8 +253,8 @@ drain_install_rules() {
old_ip=$1
ip route replace default via "$old_ip" dev "$BRIDGE" table "$TABLE_DRAIN"
mangle_rules_install
ip rule add fwmark "$FWMARK" table "$TABLE_DRAIN" priority "$DRAIN_PRIORITY" 2>/dev/null || \
ip rule replace fwmark "$FWMARK" table "$TABLE_DRAIN" priority "$DRAIN_PRIORITY"
ip rule del fwmark "$FWMARK" table "$TABLE_DRAIN" priority "$DRAIN_PRIORITY" 2>/dev/null || true
ip rule add fwmark "$FWMARK" table "$TABLE_DRAIN" priority "$DRAIN_PRIORITY"
}
drain_cleanup() {
@@ -353,6 +357,10 @@ do_graceful() {
fi
preflight_ping "$new_ip" || die 2 "gateway ${new_ip} is unreachable over ${PING_IFACE}"
# Ensure WIBLAN traffic uses the policy table (may be missing after reboot)
ip rule del from "$WIBLAN_CIDR" table "$TABLE_MAIN" priority 100 2>/dev/null || true
ip rule add from "$WIBLAN_CIDR" table "$TABLE_MAIN" priority 100
printf '%s\n' "$new_ip" >"$DRAIN_NEWFILE"
printf '%s\n' "$old_ip" >"$DRAIN_OLDFILE"