Commit 6b450a1d authored by Vitaly Lipatov's avatar Vitaly Lipatov

route-update.sh: detect and handle table number changes from rt_tables

When saved table number differs from current (e.g. after manual rt_tables edit), flush old table and ip rule before reloading into new table. Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent dc72ce25
......@@ -323,6 +323,20 @@ process_routes()
continue
fi
# Detect table number change (e.g. rt_tables edited manually)
if [ -f "$STATE_DIR/$state/table" ] ; then
local saved_table
read -r saved_table < "$STATE_DIR/$state/table"
if [ "$saved_table" != "$table" ] ; then
log "[$name]$label Table changed $saved_table$table, flushing old"
if [ -z "$SHOW" ] ; then
$ipcmd route flush table "$saved_table" 2>/dev/null
$ipcmd rule del lookup "$saved_table" 2>/dev/null
rm -f "$STATE_DIR/$state/hash"
fi
fi
fi
# Compute hash of all list contents + gateway + options
local current_hash=$(md5_lists "$gwdir/gateway" "$gwdir/options" $lists)
......
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