Commit bf391c49 authored by Vitaly Lipatov's avatar Vitaly Lipatov

route-update.sh: fix multipath route counting and stale detection

Filter out nexthop continuation lines (starting with tab) when counting routes and detecting stale entries. Fixes incorrect count with multipath. Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent a34e70af
...@@ -456,7 +456,7 @@ process_routes() ...@@ -456,7 +456,7 @@ 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 '{print $1}' | sort | \ $ipcmd route show table "$table" 2>/dev/null | awk '/^[^\t ]/{print $1}' | sort | \
comm -23 - "$resolved_new" > "$stale" comm -23 - "$resolved_new" > "$stale"
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"
...@@ -466,7 +466,7 @@ process_routes() ...@@ -466,7 +466,7 @@ process_routes()
rm -f "$stale" rm -f "$stale"
# Verify route count matches expected # Verify route count matches expected
local actual=$($ipcmd route show table "$table" 2>/dev/null | wc -l) local actual=$($ipcmd route show table "$table" 2>/dev/null | grep -c '^[^\t ]')
if [ "$actual" != "$count" ] ; then if [ "$actual" != "$count" ] ; then
log "[$name]$label WARNING: route count mismatch: expected $count, got $actual" log "[$name]$label WARNING: route count mismatch: expected $count, got $actual"
else else
......
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