Commit fc0b9f7d authored by Vitaly Lipatov's avatar Vitaly Lipatov

router: fix stale route removal for /32 host routes

ip route show omits /32 suffix for host routes, but resolved lists from antifilter contain explicit /32. This mismatch caused comm to mark all host routes as stale and delete them immediately after loading. Normalize both sides by stripping /32 before comparison. Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 3f77cee1
...@@ -411,8 +411,11 @@ process_routes() ...@@ -411,8 +411,11 @@ process_routes()
sed "s|^|route replace |; s|$| $route_via|" "$resolved_new" | \ sed "s|^|route replace |; s|$| $route_via|" "$resolved_new" | \
$ipcmd -batch - 2>&1 | grep -v "^$" | head -5 $ipcmd -batch - 2>&1 | grep -v "^$" | head -5
local stale=$(mktemp) local stale=$(mktemp)
$ipcmd route show table "$table" 2>/dev/null | awk '/^[^\t ]/{print $1}' | sort | \ local resolved_norm=$(mktemp)
comm -23 - "$resolved_new" > "$stale" sed 's|/32$||' "$resolved_new" | sort > "$resolved_norm"
$ipcmd route show table "$table" 2>/dev/null | awk '/^[^\t ]/{print $1}' | sed 's|/32$||' | sort | \
comm -23 - "$resolved_norm" > "$stale"
rm -f "$resolved_norm"
if [ -s "$stale" ] ; then if [ -s "$stale" ] ; then
vlog "[$name]$label removing $(wc -l < "$stale") stale routes" vlog "[$name]$label removing $(wc -l < "$stale") stale routes"
sed "s|^|route del |; s|$| table $table|" "$stale" | \ sed "s|^|route del |; s|$| table $table|" "$stale" | \
......
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