Commit 3cf04915 authored by Vitaly Lipatov's avatar Vitaly Lipatov

route-update.sh: remove --set-rules mode, default run restores lost rules/routes

The default (no args) mode already detects missing ip rules and empty routing tables, making --set-rules redundant. This simplifies the interface and service configuration. Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 43c3ad74
......@@ -2,7 +2,7 @@
# Unified route updater: reads directory-based config from routes.d/ and routes6.d/
# Each subdirectory = route group with gateway/table files and .list symlinks
#
# Usage: route-update.sh [--force] [--resolve] [--show] [--verbose] [--set-rules]
# Usage: route-update.sh [--force] [--resolve] [--show] [--verbose]
# route-update.sh --add IP|DOMAIN GROUP
# route-update.sh --del IP|DOMAIN GROUP
# route-update.sh --flush GROUP
......@@ -19,7 +19,6 @@ STATE_DIR=.state
FORCE=
RESOLVE=
SHOW=
SET_RULES=
VERBOSE=
# Parse arguments
......@@ -50,9 +49,6 @@ MODES OF OPERATION:
--show Dry-run: show what would be done without making changes.
Can be combined with other flags.
--set-rules Only create ip rules for all groups (no route loading).
Useful after network restart to restore rules quickly.
--flush GROUP Flush all routes in the specified group's table and exit.
--add IP|DOMAIN GROUP
......@@ -71,7 +67,7 @@ DIRECTORY STRUCTURE:
routes.d/GROUP/gateway Gateway: IP, hostname, or "default" (one per line).
Hostnames are resolved via dig. Multiple lines = multipath.
routes.d/GROUP/options Optional flags, one per line:
set-default Also set system default route via gateway.
set-default Managed by route-health.sh (default route failover).
routes.d/GROUP/table (legacy) Routing table number override.
routes.d/GROUP/*.list Symlinks to files with IPs, subnets, or domains.
routes6.d/ Same structure for IPv6 groups.
......@@ -98,7 +94,6 @@ while [ -n "$1" ] ; do
--force) FORCE=1 ;;
--resolve) RESOLVE=1 ;;
--show) SHOW=1 ;;
--set-rules) SET_RULES=1 ;;
--verbose|-v) VERBOSE=1 ;;
--help|-h) show_help ;;
--flush) FLUSH_GROUP="$2" ; shift ;;
......@@ -542,25 +537,6 @@ cleanup_state()
done
}
# --- Set-rules only mode ---
if [ -n "$SET_RULES" ] ; then
for routes_dir in "$ROUTES_DIR" "$ROUTES6_DIR" ; do
[ -d "$routes_dir" ] || continue
ipcmd="ip"
[ "$routes_dir" = "$ROUTES6_DIR" ] && ipcmd="ip -6"
for gwdir in "$routes_dir"/*/ ; do
[ -d "$gwdir" ] || continue
read_group_config "$gwdir" "$ipcmd" || continue
pref=$(rule_pref "$table")
if ! $ipcmd -N rule show | grep -q "lookup $table.*pref $pref" ; then
$ipcmd rule add lookup "$table" pref "$pref"
fi
done
done
exit
fi
# --- Main ---
[ -n "$SHOW" ] && log "Dry-run mode (no changes will be made)"
[ -n "$VERBOSE" ] && log "Verbose mode, state_dir=$STATE_DIR"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment